Page 1 of 1

Differentiating between enemy unit classes in scripting

Posted: Sat Sep 12, 2009 2:42 am
by Sky_216
I have a scripting question: how do you differentiate between enemy unit classes that have been killed by the player and are on the same team? IE rocketeers and snipers.

Part of the code I'm currently using:
Hidden/Spoiler:
function(object, killer)
if killer and IsCharacterHuman(killer) and GetObjectLastHitWeaponClass(object) == "snatch" and GetObjectTeam(object) == 2 then
Red bit needs to be different, obviously.

Re: Differentiating between enemy unit classes in scripting

Posted: Sat Sep 12, 2009 12:30 pm
by Frisbeetarian
GetEntityClass(killer)

Re: Differentiating between enemy unit classes in scripting

Posted: Sat Sep 12, 2009 12:30 pm
by [RDH]Zerted
I don't know what you're talking about or trying to do. Unit classes don't have teams and if they are enemies of the player, then they aren't on the same team as the player. So...

Re: Differentiating between enemy unit classes in scripting

Posted: Sat Sep 12, 2009 12:44 pm
by Frisbeetarian
I know what you are trying to do.

I hope that "snatch" is the name of the ODF of that weapon, otherwise it won't work. You don't need the "if killer and" you can just go straight into "if IsCharacter..." You don't need the red part if you're using the function call OnCharacterDeathTeam() or OnObjectKillTeam().