Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Client/server cog only working for host
Client/server cog only working for host
2001-04-01, 10:34 PM #1
Hello. I am struggling with Cog code...and I need help. This cog will drop powerup weapons in ghost positions when activated. The problem I am encountering is, although all players can see the powerups...ONLY THE HOST can pick them up cand use them. Here is the server and client cog...followed by the templates relevant to the cog...

# Jedi Knight Cog Script
#
# RaildetServer.COG
#
# This will generate a series of rails per 'round' when the switch is activated.
# The trap resets in 'delay' seconds afterwards. Server side.
# Originally a thermal detonater cog edited by Jimanatore.
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

surface switch desc=switch
thing console desc=console
flex totaltime=8.0 // 4 * rate * rounds + delay + 0.05

int active=0 local
int trapID

message activated
message timer

end

# ========================================================================================

code

activated:
if(active == 1) Return;
active = 1;

// Send a TRIGGER_f.destructions with its parameters
SendTrigger(-1, 11001 + trapID, GetThingGuid(GetSourceRef()), 0, 0, 0);

SetTimer(totalTime);

Return;

# ........................................................................................

timer:
active = 0;

Return;

end

# Jedi Knight Cog Script
#
# RailtrapClient.cog
#
# This will generate a series of 10 rails per 'round' when the switch is activated.
# The trap resets in 'delay' seconds afterwards. Client side.
# Originally a thermal detonator trap editied by Jimanatore
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

flags=0x240

symbols

surface switch desc=switch
thing console desc=console

thing fdest1 nolink,desc=fdest1
thing fdest2 nolink,desc=fdest2
thing fdest3 nolink,desc=fdest3
thing fdest4 nolink,desc=fdest4
thing fdest5 nolink,desc=fdest5
thing fdest6 nolink,desc=fdest6
thing fdest7 nolink,desc=fdest7
thing fdest8 nolink,desc=fdest8

int rounds=4 desc=rounds
int trapID

flex rate=0.01 desc=rate
flex delay=0.5 desc=delay

int cur_round=0 local
int dummy local

template proj_tpl=+Theconcrifle local

sound on_snd=set_hi2.wav local
sound off_snd=lgclick1.wav local

message trigger

end

# ========================================================================================

code

trigger:

// Handle only f_destructiontrap
if(GetSourceRef() != 11001 + trapID) Return;

dummy = SetWallCel(switch, 1);
dummy = PlaySoundPos(on_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0);

cur_round = 0;
while(cur_round < rounds)
{
dummy = CreateThing(proj_tpl, fdest1);

// give it the correct parent via the parent's guid passed in the trigger this
// is essential to credit the kill to the guy who activated the switch..
SetThingParent(dummy, GetParam(0));
Sleep(rate);

dummy = CreateThing(proj_tpl, fdest2);
SetThingParent(dummy, GetParam(0));
Sleep(rate);

dummy = CreateThing(proj_tpl, fdest3);
SetThingParent(dummy, GetParam(0));
Sleep(rate);


dummy = CreateThing(proj_tpl, fdest4);
SetThingParent(dummy, GetParam(0));
Sleep(rate);


dummy = CreateThing(proj_tpl, fdest5);
SetThingParent(dummy, GetParam(0));
Sleep(rate);

dummy = CreateThing(proj_tpl, fdest6);
SetThingParent(dummy, GetParam(0));
Sleep(rate);

dummy = CreateThing(proj_tpl, fdest7);
SetThingParent(dummy, GetParam(0));
Sleep(rate);

dummy = CreateThing(proj_tpl, fdest8);
SetThingParent(dummy, GetParam(0));
Sleep(rate);




cur_round = cur_round + 1;
}

Sleep(delay);

dummy = SetWallCel(switch, 0);
dummy = PlaySoundPos(off_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0);

Return;

end

# DESC: RailGun Pickup
# BBOX: -.018484 -.070714 -.030025 .019883 .081826 .013227
+Therailgun _powerup2 timer = 8.0000 thingflags=0x400 model3d=rldp.3do cog=pow_railgun.cog respawn = 0.000000
# DESC: Concussion Rifle Pickup
# BBOX: -.030347 -.072704 -.024787 .009211 .072704 .024341
+Theconcrifle _powerup2 timer = 8.0000 thingflags=0x400 model3d=conp.3do cog=pow_concrifle.cog respawn = 0.000000
# DESC:
# BBOX: 0 0 0 0 0 0
_powerup2 none timer = 8.0000 orient=(0.000000/0.000000/0.000000) type=item collide=1 move=physics size=0.100000 movesize=0.010000 surfdrag=3.000000 airdrag=1.000000 mass=10.000000 height=0.050000 physflags=0x400000 angvel=(45.000000/45.000000/45.000000) typeflags=0x1 respawn=0.000000
2001-04-03, 4:12 AM #2
When you "CreateThing()" it only creates the thing localy. I beleive the multiplayer command is "CreateThingEx()" Try using that.

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2001-04-03, 4:26 AM #3
I think.
CreateThingNR();

------------------
http://millennium.massassi.net/ - Millennium
2001-04-05, 7:13 PM #4
I tried GetThingnr and it stopped the respawn good...but only for the host...And non-hosts still cant pick up the things...I havent tried GetThingex but I didnt see it on the specs page as a thing cog verb...so I am still not sure how to get this function working.
2001-04-05, 7:14 PM #5
I meant CreateThingnr....sorry
2001-04-06, 8:42 AM #6
Also, If CreateThing only places things locally why does this cog work with projectile templates?...It kills hosts and nonhosts alike.

And why doesnt the respawn=0.0000000 in the CreateThing templates still respawn anyway?

↑ Up to the top!