Mission victory/defeat on destruction of object?

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
User avatar
=BloodyRoses=
Private Recruit
Posts: 24
Joined: Sat Jan 17, 2009 4:39 pm

Mission victory/defeat on destruction of object?

Post by =BloodyRoses= »

Title pretty much self-explanatory. I need to make a map where the objective is to guard/destroy an object which when destroyed triggers endgame. Sorting through the campaign mission objective scripts hasn't helped. Need specific LUAs and coding. Sorry if this has been posted before, can't find it anywhere though.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Mission victory/defeat on destruction of object?

Post by AQT »

A combination of this and the two following LUA functions should do the trick. They should replace PlayAnimation():

Code: Select all

MissionDefeat() 
MissionVictory()
The name of the team you want to lose/win should go in between the parentheses, and make sure the names are defined first.
User avatar
=BloodyRoses=
Private Recruit
Posts: 24
Joined: Sat Jan 17, 2009 4:39 pm

Re: Mission victory/defeat on destruction of object?

Post by =BloodyRoses= »

That's great, now can someone explain the add points on destruction of object script that AQT mentioned, I'd like a working example since mine isn't working properly.

EDIT
=BloodyRoses= wrote:That's great, now can someone explain the add points on destruction of object script that AQT mentioned, I'd like a working example since mine isn't working properly.
I really need this soon. Any help would be appreciated.
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Mission victory/defeat on destruction of object?

Post by Firefang »

Code: Select all

killobject = OnObjectKill(
   function(object, killer)
      if  GetEntityName(object) == "objectbeingkillednameinZeroEditor" then
         AddAssaultDestroyPoints(killer)
         MissionVictory(ATT)
      end
   end
)
Assuming that ATT is the enemy team, this should work. If the enemy team is DEF, then change it accordingly.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Mission victory/defeat on destruction of object?

Post by THEWULFMAN »

You could replace ATT with the actual team name, like REP/CIS/IMP/ALL
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Mission victory/defeat on destruction of object?

Post by Firefang »

That works as well, but I used ATT and DEF because they are universal and not limited to one era.
Post Reply