Since getting such great feed-back on some other cog probs, I thought It would be to ask about this other prob. Exploding crates are created which are set like throwable objects. They are nudgable. Im trying to complete a multiplayer match in which these crates will be basically in the same spot on all machines. Adding SyncThing has strange effects by itself, like making barrels moving backwards. I thought maybe somehow i could send a trigger when these crates are touched locally to have the server add that velocity to all the machines as its syncing the pos, after first getting the thouched thing's velocity (speed and direction?) ...
I have difficult time cause I dont fully understand all the server client stuff...I was thinking of adding the touched message here but then im not sure.
This is cog is called up like the exploding crate from within its template:
flags=0x80
symbols
message created
message damaged
message timer
message pulse
message touched
template barrel_exp=+xtank4_exp local
thing barrel local
vector getvector
int type
int yon
flex barrelhealth local
flex damage local
end
#=======================================================#
code
created:
barrel = GetSenderRef();
SetThingUserData(barrel, 35); // set initial user data ("health")
SetTimerEx(60.0, barrel, GetThingSignature(barrel), 0); // kill the barrel in 60 secs
SetThingPulse (barrel, 0.05);
Return;
#=======================================================#
damaged:
barrel = GetSenderRef();
damage = GetParam(0);
type=GetParam(1);
barrelhealth = GetThingUserData(barrel);
if(type ==0x1) Return;
else if (barrelhealth <= damage) //enough damage to kill barrel ?
SetTimerEx(0.5, barrel, GetThingSignature(barrel), 0);
else SetThingUserData(barrel, barrelHealth - damage);
Return;
#=========================================================#
touched:
barrel = GetSenderRef();
getvector=GetThingVel(barrel);
#=========================================================#
timer:
barrel=GetSenderId();
if(GetThingSignature(barrel) != GetParam(0)) Return;
CreateThing(barrel_exp, GetSenderID());
DestroyThing(GetSenderID());
Return;
#=========================================================#
pulse:
barrel = GetSenderRef();
yon=Isthingmoving(barrel);
If (yon==0) Return;
SyncThingPos(barrel);
Return;
end
[This message has been edited by Gelatinous_Drool (edited July 28, 2002).]
I have difficult time cause I dont fully understand all the server client stuff...I was thinking of adding the touched message here but then im not sure.
This is cog is called up like the exploding crate from within its template:
flags=0x80
symbols
message created
message damaged
message timer
message pulse
message touched
template barrel_exp=+xtank4_exp local
thing barrel local
vector getvector
int type
int yon
flex barrelhealth local
flex damage local
end
#=======================================================#
code
created:
barrel = GetSenderRef();
SetThingUserData(barrel, 35); // set initial user data ("health")
SetTimerEx(60.0, barrel, GetThingSignature(barrel), 0); // kill the barrel in 60 secs
SetThingPulse (barrel, 0.05);
Return;
#=======================================================#
damaged:
barrel = GetSenderRef();
damage = GetParam(0);
type=GetParam(1);
barrelhealth = GetThingUserData(barrel);
if(type ==0x1) Return;
else if (barrelhealth <= damage) //enough damage to kill barrel ?
SetTimerEx(0.5, barrel, GetThingSignature(barrel), 0);
else SetThingUserData(barrel, barrelHealth - damage);
Return;
#=========================================================#
touched:
barrel = GetSenderRef();
getvector=GetThingVel(barrel);
#=========================================================#
timer:
barrel=GetSenderId();
if(GetThingSignature(barrel) != GetParam(0)) Return;
CreateThing(barrel_exp, GetSenderID());
DestroyThing(GetSenderID());
Return;
#=========================================================#
pulse:
barrel = GetSenderRef();
yon=Isthingmoving(barrel);
If (yon==0) Return;
SyncThingPos(barrel);
Return;
end
[This message has been edited by Gelatinous_Drool (edited July 28, 2002).]