Mission Scripting - Endings
by Chavez [Alpha Squad]
Published : 27 January 2003
Feedback : Here

Introduction

Scripting a mission to end when an objective can no longer be succesfully completed is a common requirement. Chavez of Alpha Squad takes us through the steps required to end a mission if a Demolition character is killed, or runs out of the required number of charges/heat missiles before his objective is met.

There are several ways to end the mission if you want based upon the number of remaining democharges or rockets and the status of one or more enemy vehicles. In this example I will show you how to end it if a SA13 Mobile AT launcher is still alive in your mission, and none of your players have any democharges or anti-armour missiles left.

Example File

I have made a mission called BlackHawk Two is down! This is a download link to the betaversion. BH2D is my first real IGOR mission, so don't use it to find really good scripting routines. It's a scripting mess!

Objectives

In this mission an SA13 has to be taken out before the Ghosts can escape out of Grozny in their Blackhawk (from the helipad on the Embassy roof). The special thing with this SA13 is that it can be killed with a remote democharge (recommended/objective completes) or an AntiTank rocket (objective will fail, but it will open for a possible extraction).

The very easiest way to check this is to have a scriptblock that is triggered by timeelapsed 1 second, and has 3 continue if statements that checks for dead sa13 and democharge and rocket count within the players platoon.

I here assume that you know how to use the playersplatoon variable. (if not then seek "playerplatoon" or "players platoon" in the GhostRecon.net Missions forum). Set up a counter that goes to the value 1 when your sa13 is killed.

Group: <Default>
Comment:
SA13 is killed!
Trigger Event:
sa13 has been destroyed.
Responses:
Prevent this block from being reactivated.
Set sa13_counter to 1.

Solution

1. Set up a new block (trigger it by time elapsed 1 second)
2. BlockPreserve (Let it reactivate)
3. Continue-if the sa13_counter is set to 0 (sa13 not killed).
4. Countinue if PlatoonDemoChargeCount. (Zero charges)
5. Countinue if PlatoonAntitankRocketCount.(Zero rockets)
6. End game with a msgs that there aren't enough charges/rockets.
7. Block Remove (deny reactivation of this script block)

Here is a printout from my script summary used in BH2D (BlackHawk Two is Down)

Group: <Default>
Comment:
0.02 enough charges/rockets?
Trigger Event:
2 second(s) elapsed.
Responses:
Allow this block to be reactivated.
Continue executing responses if ((The value of sa13_counter) is equal to 0).
Continue executing responses if ((The number of demo charges available to player platoon) is equal to 0).
Continue executing responses if ((The number of anit-tank rockets available to player platoon) is equal to 0).
Display "Not Enough democharges/antitank rockets to kill the SA13. *** Mission Failed ***" and register mission failure.
Prevent this block from being reactivated.

There is also a lot of different ways to do this smarter. The one I use nowadays is to place this check in a special scriptblock group category and then disable that scriptblock group when the SA13 is killed.

Have fun!

Chavez

 


© GhostRecon.net