Home   Help Search Login Register  

Author Topic: Objective-based Endings  (Read 580 times)

0 Members and 1 Guest are viewing this topic.

shadow99

  • Guest
Objective-based Endings
« on: 16 Mar 2005, 06:22:35 »
What's the easiest way to make a trigger which checks the objectives to determine an ending?

Basically, I have a few civilians that must not be killed in order to complete Objective 4.

There are two endings to my mission, one where you have completed Objective 4 and one where you have not.

Could someone help me out here?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Objective-based Endings
« Reply #1 on: 16 Mar 2005, 08:21:05 »
AFIK you cannot check the status of objectives.  You need to have a variable that you set to a value indicating the status of the objective, and then check that.

shadow99

  • Guest
Re:Objective-based Endings
« Reply #2 on: 16 Mar 2005, 11:27:29 »
Okay, I've been using that method but I thought there would have been an easier way.

Although I have been attempting to use it, I can't quite pull it off.

The mission ends at the exact same point whether Objective 4 is failed or not. So how do I run two endings in the same place but with the difference of a variable?

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:Objective-based Endings
« Reply #3 on: 16 Mar 2005, 12:13:12 »
You must already have one end trigger - End#1 presumably - with working end conditions.  You need a second end trigger with the same conditions then ADD a 'civilians alive enough' condition to one and a 'civilians not alive enough' to the other. When the original end conditions are met, the end trigger that fires will depend upon the status of the civvies.

Easy way: copy End#1 then paste and edit it to End#2

End#1 condition: (all my original end conditions) && Alive Civ1 && Alive Civ2 && Alive Civ3 && Alive Civ4
This will only fire if ALL key civilians are alive.

End#2 condition: (all my original end conditions) && (!Alive Civ1 OR !Alive Civ2 OR !Alive Civ3 OR !Alive Civ4)
This will fire if one or more civilians are dead.

That may not be quite the logic  you want, but the principle's the same - just make sure the civilian conditions are:
1)  Exclusive so you can't fire both triggers (give one a short delay if you want to be really safe) and:
2)  Failsafe so there isn't a situation that fires neither trigger!

Then you can have the separate debriefings that I assume you need.

shadow99

  • Guest
Re:Objective-based Endings
« Reply #4 on: 16 Mar 2005, 12:27:30 »
Thanks ACF, just what I needed.

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:Objective-based Endings
« Reply #5 on: 16 Mar 2005, 13:37:54 »
It's worth considering THobson's suggestion if the logic (for the civilians in this case) is tricky and using a trigger or script to set a global variable. It's also easier to make failsafe:

Initialise the global variable in init.sqs or an init field with a useful default value/status, e.g.:

civstatus = "allcivsalive"

Then have a normal trigger that monitors for:
condition: !Alive civ1 OR !Alive civ2 OR !Alive civ3 OR !Alive civ4
on activation: civstatus = "somecivsdead"

The end triggers then become:
End#1 condition: (all my original end conditions) && civstatus == ""allcivsalive"

End#2 condition: (all my original end conditions) && civstatus == "somecivsdead"

The default value avoids having conditions that don't end the mission.