Page 1 of 1

3rd team changing neutrality.

Posted: Mon Jul 27, 2009 6:03 pm
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

Re: 3rd team changing nuetrality.

Posted: Mon Jul 27, 2009 6:10 pm
by Fierfek
It's very possible to make a neutral 3rd team, but I don't know about the hostile on engagement.

Re: 3rd team changing neutrality.

Posted: Tue Jul 28, 2009 5:49 am
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.

Re: 3rd team changing neutrality.

Posted: Mon Aug 03, 2009 12:48 pm
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?

Re: 3rd team changing neutrality.

Posted: Mon Aug 03, 2009 6:24 pm
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)

Re: 3rd team changing neutrality.

Posted: Tue Aug 04, 2009 1:14 pm
by fiddler_on_the_roof
ok, thanks so much!!