teamkill script?

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
RacoonLR
Second Lance Corporal
Second Lance Corporal
Posts: 105
Joined: Fri Apr 25, 2014 5:31 pm
xbox live or psn: No gamertag set
Location: UNDER YOUR BED

teamkill script?

Post 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?
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: teamkill script?

Post 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.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: teamkill script?

Post 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)
RacoonLR
Second Lance Corporal
Second Lance Corporal
Posts: 105
Joined: Fri Apr 25, 2014 5:31 pm
xbox live or psn: No gamertag set
Location: UNDER YOUR BED

Re: teamkill script?

Post by RacoonLR »

Where do I have to put this in?
In the map lua? Sorry i'm new to scripting
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: teamkill script?

Post by razac920 »

Yes, in your map lua's in data_***/Common/scripts/***/
Post Reply