3rd team changing neutrality.

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
fiddler_on_the_roof
1st Lieutenant
1st Lieutenant
Posts: 460
Joined: Wed Nov 12, 2008 5:28 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

3rd team changing neutrality.

Post by fiddler_on_the_roof »

Is it possible to have a 3rd team, and have them be neutral, unless they get hit by a shot, in which case, they change to your enemies?

If it is possible, how would it be done?

thanks
User avatar
Fierfek
High General
High General
Posts: 805
Joined: Wed Jul 01, 2009 4:38 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)

Re: 3rd team changing nuetrality.

Post by Fierfek »

It's very possible to make a neutral 3rd team, but I don't know about the hostile on engagement.
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: 3rd team changing neutrality.

Post by [RDH]Zerted »

When a unit on that team is damaged, set the team to be an enemy of the attacker. The scripting doc should have all the info in it you need in order to do that.
fiddler_on_the_roof
1st Lieutenant
1st Lieutenant
Posts: 460
Joined: Wed Nov 12, 2008 5:28 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: 3rd team changing neutrality.

Post by fiddler_on_the_roof »

ok, thank you so much! :thumbs:


edit1:

wait, should it look something like this?

Code:
"onObjectDamage(DamageTeam3)"
"SetTeamAsEnemy(Team3,Team1)"

"onObjectRespawn(rep_inf_ep3_sniper)
"SetTeamAsNeutral(Team3, Team1)"


the last bit is for after the player is killed.

or am i missing something, or not doing it correctly?
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: 3rd team changing neutrality.

Post by [RDH]Zerted »

What do you meant about the last bit? Does the 3rd team only have one player? If so, it is better to use OnCharacterDeath or OnCharacterSpawn (on death is better).

Your code structure is all wrong. The code will be more like (done from bad memory...):

Code: Select all

OnObjectDamage(function(object,attacker)
    --cancel if there was no attacker (maybe fell off a tower...)
    if attacker == nil then return end

    --cancel if the damaged object is not on the 3rd team
     if GetObjectTeam(object) ~= 3 then return end

    --3rd team is now an enemy of the attacker's team
    SetTeamAsEnemy(3,GetObjectTeam(attacker))
end)
fiddler_on_the_roof
1st Lieutenant
1st Lieutenant
Posts: 460
Joined: Wed Nov 12, 2008 5:28 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: 3rd team changing neutrality.

Post by fiddler_on_the_roof »

ok, thanks so much!!
Post Reply