Differentiating between enemy unit classes in scripting

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Differentiating between enemy unit classes in scripting

Post 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.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Differentiating between enemy unit classes in scripting

Post by Frisbeetarian »

GetEntityClass(killer)
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Differentiating between enemy unit classes in scripting

Post 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...
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Differentiating between enemy unit classes in scripting

Post 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().
Post Reply