Code:
#================================================================================================# # Jedi Knight Cog Script # # # # STUNHIT.COG # # # # [Darth Haun 1999] # #================================================================================================# symbols thing victim local template sphere_tpl=+stunfield local int sphere=-1 local int type local flex weapon local message touched message timer end #================================================================================================# Code Touched: victim = GetSourceRef(); type = GetThingType(victim); if(type == 2) // ACTOR { sphere = CreateThingAtPosNR(sphere_tpl, GetThingSector(victim), GetThingPos(victim), '0.0 0.0 0.0'); AttachThingToThingEx(sphere, victim, 0x8); SetParticleGrowthSpeed(sphere, -0.3); SetLifeLeft(sphere, 1.5); SetActorFlags(victim, 0x40000); weapon=GetActorWeapon(victim, 1); SetActorWeapon(victim, 1, -1); KillTimerEx(victim); SetTimerEx(1.5, victim, GetThingSignature(victim), 0); } else if(type == 10) // OTHER PLAYER { sphere = CreateThingAtPosNR(sphere_tpl, GetThingSector(victim), GetThingPos(victim), '0.0 0.0 0.0'); AttachThingToThingEx(sphere, victim, 0x8); SetParticleGrowthSpeed(sphere, -0.3); SetLifeLeft(sphere, 1.5); SetActorFlags(victim, 0x40000); KillTimerEx(victim); SetTimerEx(1.5, victim, GetThingSignature(victim), 0); } Return; #................................................................................................# Timer: if(GetParam(0) == GetThingSignature(GetSenderId())) { if(type == 2) { ClearActorFlags(GetSenderId(), 0x40000); SetActorWeapon(GetSenderId(), 1, weapon); } ClearActorFlags(GetSenderId(), 0x40000); } Return; End #===============================================#
This is IWP2's stunhit cog. But it has at least two problems.
When you stun an AI, this cog finds out what weapon the AI has and saves it to a variable.
Then, the cog sets the actor's weapon to -1. So, if you stunned him twice, weapon would get a
value of -1 and the real value would be lost.
I think that can be fixed with
Code:
Does that seem ok?if(getactorweapon(victim, 1) > -1) weapon=GetActorWeapon(victim, 1);
The other problem is when you stun two AI. Weapon will be set to the last stunned AI's
weapon bin number. So, the one that was stunned first will be given the second's bin
number when the timer ends. This problem I really need help on as it is way too complicated for me.
Thankyou
------------------
And though your very flesh and blood
..Be what your Eagle eats and Drinks,
You'll praise him for the best of birds,
..Not knowing, what the Eagle thinks. -Cassandra
[This message has been edited by SaberMaster (edited April 19, 2001).]
[This message has been edited by SaberMaster (edited April 19, 2001).]