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
3rd team changing neutrality.
Moderator: Moderators
-
fiddler_on_the_roof
- 1st Lieutenant

- Posts: 460
- Joined: Wed Nov 12, 2008 5:28 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Re: 3rd team changing nuetrality.
It's very possible to make a neutral 3rd team, but I don't know about the hostile on engagement.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: 3rd team changing neutrality.
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

- Posts: 460
- Joined: Wed Nov 12, 2008 5:28 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: 3rd team changing neutrality.
ok, thank you so much! 
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?
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?
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: 3rd team changing neutrality.
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...):
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

- Posts: 460
- Joined: Wed Nov 12, 2008 5:28 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: 3rd team changing neutrality.
ok, thanks so much!!
