PDA

View Full Version : Need help!


Brood_of_Evil
11th Nov 2001, 01:20 AM
ok sorry for the multiple posts, I tried posting earlier, but there seemed to be some problems with the forums, as they were extremely low, I tried to delete the other one, but anyways...

Ok. the problem is this, when I call a switch statement using PlayerReplicationInfo.Team as the switch, while in a team game, it always return the red team...look at the code below:

//some other code........

local int OwnerTeam;

OwnerTeam = Pawn(Owner).PlayerReplicationInfo.Team;

if(Level.Game.bTeamGame)
{
switch(OwnerTeam)
{
case 0:

BroadcastMessage("RedTeam");
tw.SetDisplayProperties(STY_Translucent, Texture'UPML.LDot', true, false);
break;

case 1:

BroadcastMessage("BlueTeam");
tw.SetDisplayProperties(STY_Translucent, Texture'UPML.BlueLDot', true, false);
break;

case 2:

BroadcastMessage("GreenTeam");
tw.SetDisplayProperties(STY_Translucent, Texture'UPML.GreenLDot', true, false);
break;

case 3:

BroadcastMessage("GoldTeam");
tw.SetDisplayProperties(STY_Translucent, Texture'UPML.GoldLDot', true, false);
break;
}
}

as you can see, I have put a BroadcastMessage() to follow up the evaluation of the code. but no matter what happens, it always land on 0 (Red team).

As far as I know the team is an array, with 0=Red, 1=blue, 2=green, 4=gold. Is that correct?

Does anyone knows what's wrong with this?
Is there another way to get the team number of pawn other than this?

Oh and another question, what's the differences a simulated function from a normal one?

Silver_Ibex
11th Nov 2001, 02:57 PM
A simulated function is only calculated on a client machine, things like the HUD

simulated function PostRender( canvas Canvas )


Since the host shouldn’t be bogged down with drawing everyone’s HUD, as that would needlessly hog bandwidth and the draw HUD function has no impact on the other players.

Brood_of_Evil
11th Nov 2001, 10:12 PM
Thanks. Well if only someone could help me with the first part of the problem...

usaar33
12th Nov 2001, 02:36 AM
is owner none?

BTW, Silver simulated actually means it CAN be run on the client. If the role of an actor is role_simulatedproxy, and a function that is being called is NOT simulated, the function will not be called.

tarquin
12th Nov 2001, 05:14 AM
Originally posted by Brood_of_Evil
OwnerTeam = Pawn(Owner).PlayerReplicationInfo.Team;


I'd stick a few lines of log after that line ^^ to check what the code thinks it is dealign with:
log( Owner )
log( Pawn(Owner ))
etc etc

Papapishu
12th Nov 2001, 06:45 PM
I thought it was the other way around, that the simulated functions were the ones that were run on the server...
waddya know...?

Is it like, when the client wants to call a non-simulated sunction, it calls the server asking it, and then the server returns the answer?
Or how does it work anyway?
I never did understand the tut's about this subject... :hmm:

Silver_Ibex
13th Nov 2001, 04:01 PM
Check out this link for info on simulated functions:cool:

http://unreal.epicgames.com/UTMods.html

Brood_of_Evil
13th Nov 2001, 10:51 PM
This is from sweeney's UScript language reference:
"Simulated: Declares that a function may execute on the client-side when an actor is either a simulated proxy or an autonomous proxy. All functions that are both native and final are automatically simulated as well."