I have seen traps in MotS give the kill credit to the person who activates a trap. Like the detonator trap. I think the verb used is GetThingGuid or something. Well how can I do this in Jedi Knight. SetThingParent isnt working. Here is the client of the trap cog.
code
#------------------------------------------------------
trigger:
if(GetSourceRef() != trigID || locked) Return;
locked = 1; // Lock the message
SetWallCel(switch, 1);
PlaySoundPos(on_snd, SurfaceCenter(switch), 1, 5, 10, 0);
for(x=0; x < rounds; x=x+1)
{
for(i = 0; i <= 5; i = i + 1)
{
SetThingParent(CreateThing(thingTpl, pos0), GetParam(0));
Sleep(rate);
}
}
Sleep(delay);
SetWallCel(switch, 0);
PlaySoundPos(off_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
locked = 0;
Return;
#------------------------------------------------------
end
Isnt this the right way? Heres the server.
symbols
surface switch
thing console
flex waitTime=8.0
int active=0 local
int trigID
message activated
end
#==============================================================#
code
#------------------------------------------------------
activated:
if(active == 1) Return;
active = 1;
// Send the trigger with the activating player as param 0.
SendTrigger(-1, trigID, GetThingSignature(GetSourceRef()), 0, 0, 0);
Sleep(waitTime);
active = 0;
Return;
#------------------------------------------------------
end
[This message has been edited by Gelatinous_Drool (edited August 27, 2002).]
code
#------------------------------------------------------
trigger:
if(GetSourceRef() != trigID || locked) Return;
locked = 1; // Lock the message
SetWallCel(switch, 1);
PlaySoundPos(on_snd, SurfaceCenter(switch), 1, 5, 10, 0);
for(x=0; x < rounds; x=x+1)
{
for(i = 0; i <= 5; i = i + 1)
{
SetThingParent(CreateThing(thingTpl, pos0), GetParam(0));
Sleep(rate);
}
}
Sleep(delay);
SetWallCel(switch, 0);
PlaySoundPos(off_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
locked = 0;
Return;
#------------------------------------------------------
end
Isnt this the right way? Heres the server.
symbols
surface switch
thing console
flex waitTime=8.0
int active=0 local
int trigID
message activated
end
#==============================================================#
code
#------------------------------------------------------
activated:
if(active == 1) Return;
active = 1;
// Send the trigger with the activating player as param 0.
SendTrigger(-1, trigID, GetThingSignature(GetSourceRef()), 0, 0, 0);
Sleep(waitTime);
active = 0;
Return;
#------------------------------------------------------
end
[This message has been edited by Gelatinous_Drool (edited August 27, 2002).]