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 → Give kill credit
Give kill credit
2002-08-27, 3:51 PM #1
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).]
2002-08-29, 5:48 AM #2
SetThingParent() is a MotS verb, so you'll have to use an alternative. The only Cog verb that does set a created thing's parent is FireProjectile(). So, use some code like this in the client cog:
Code:
newThing=FireProjectile(GetParam(0), thingTpl, -1, -1, '0 0 0', '0 0 0', 0, 0x0, 0, 0);
TeleportThing(newThing, pos0);
SetThingLook(newThing, '0 1 0');

That will replace the CreateThing() code in the for loop. GetParam(0) should be the player who activated the switch/console.

In the server cog, change:
Code:
SendTrigger(-1, trigID, GetThingSignature(GetSourceRef()), 0, 0, 0);

back to:
Code:
SendTrigger(-1, trigID, GetSourceRef(), 0, 0, 0);


After you make those changes, the created thing will be like any projectile with a player as its parent. When its explosion kills a thing, it should attribute the kill to its parent. Try it and see how it works. [http://forums.massassi.net/html/wink.gif]


------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-29, 7:27 AM #3
That gives credit but a series of projectiles is left at the feet of whoever hits the button or console, which promptly kill that person.

[This message has been edited by Gelatinous_Drool (edited August 29, 2002).]
2002-08-29, 3:10 PM #4
Are the barrels teleported or do they remain with the player?

------------------
Author of the <A HREF="http://www.geocities.com/sabersdomain/fileframe.html" TARGET=_blank>JK
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-29, 8:01 PM #5
They are duplicated (thermal detonators and sequence charges)...They appear where they should at the teleport spot AS WELL as where the player is
...Maybe I need to make the newThing local. I havent tried it that way yet.
2002-08-31, 4:35 AM #6
The problem might be if you have identified the ghosts in JED. Sometimes I put a ghost in, and then forget to list it in the cog.
"The world is neither black nor white but differing shades of gray."
-By me.
2002-08-31, 4:37 AM #7
Are there duplicate projectiles created on all computers in the game? Did the player who pressed the button see the projectiles at his position? I really don't see how they could be duplicated unless you've set up multiple client cogs that respond to the same trigger. Because the cog uses 0x240 flags, the projectiles will be local to each computer - so they can't affect the projectiles on other computers.

If you can't find out what's causing it, email me your level with the cogs placed, and I'll test it in MP.

And make sure that you've defined all of the ghosts as Talon said. If you gave any ghost a player's value, then some of the projectiles would end up being teleported to players' positions.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited August 31, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!