Page 1 of 1

teamkill script?

Posted: Sat Jul 12, 2014 8:57 pm
by RacoonLR
Is it possible to make a script that if you attack a team member, that he will
get agressive and attack you? your if you make a teamkill and the other teammebers
want to revenge him? Or isn't that possible to make with the swbf2 al?

Re: teamkill script?

Posted: Sat Jul 12, 2014 9:59 pm
by Noobasaurus
Yes, it's possible. Just set the killer's team to 4 or something and have team 4 be enemies of the team that he was on before.

Re: teamkill script?

Posted: Sat Jul 12, 2014 10:05 pm
by razac920
Of course!
If friendly-fire is the trigger:

Code: Select all

  OnObjectDamage(function(object,damager)
  if GetObjectTeam(object) == GetCharacterTeam(damager) and GetCharacterUnit(damager) then
    SetObjectTeam(GetCharacterUnit(damager),2-GetObjectTeam(damager))
  end
  end)
If team-kill is the trigger:

Code: Select all

  OnObjectKill(function(object,damager)
  if GetObjectTeam(object) == GetCharacterTeam(damager) and GetCharacterUnit(damager) then
    SetObjectTeam(GetCharacterUnit(damager),2-GetObjectTeam(damager))
  end
  end)

Re: teamkill script?

Posted: Sun Jul 13, 2014 8:29 am
by RacoonLR
Where do I have to put this in?
In the map lua? Sorry i'm new to scripting

Re: teamkill script?

Posted: Sun Jul 13, 2014 10:44 am
by razac920
Yes, in your map lua's in data_***/Common/scripts/***/