Jump to content
Sign in to follow this  
Törni

Victory conditions

Recommended Posts

This is really a basic one. How do I do a script which ends the game when either all units (or a certain number) are dead or destroyed?

And most importantly where do I put it. In a trigger?

Share this post


Link to post
Share on other sites

yes in a trigger!

say u want to check if all opfor are dead!

create a trigger

in the activation field :- opfor

click :- not present

in the type field :- end#1

adjust the axis a and b to the size you want

eg cover the whole island this will then check the whole island to see if all opfor is dead! smile_o.gif

Share this post


Link to post
Share on other sites

Sorry for double posting. Moderator is free to remove this post.

Share this post


Link to post
Share on other sites

Please try to avoid this type of mission designing - do you really want to hunt the last enemy for many hours just to finish the mission, especially if that enemy soldier went hiding under a rock?

Find alternative methods please. Like check if enemy is fleeing scared to death already, check how much enemies are alive (if only 1 or 2 is alive do they pose a real threat anymore...), do the enemies have weapons and ammunition to pose a threat, can enemy vehicles shoot at you anymore or move anymore, etc. There are a ton of better approaches.

Share this post


Link to post
Share on other sites

Regarding the "a certain number".

Set up the trigger area, make it activated by OPFOR present, and then write in the condition field

count thisList < #

# being whatever maximum number of units can still be alive at the end of the mission.

Untested, but should work? (might be a bit slow, dependant on how often the trigger updates thisList. Try messing around with repeatedly, and OPFOR present/not present -- whatever)

Regards,

Wolfrug

Share this post


Link to post
Share on other sites

As I thought - it was pretty straight forward by adjusting trigger settings.

Thanks anyway biggrin_o.gif

Share this post


Link to post
Share on other sites

For better mission design, you should consider more possibilities. For example, the units may flee, or some out of ammo, if they do a simple Not Present trigger may not pick up on this. What you should do is make use of the count command:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{alive _X && !(fleeing _X) && someAmmo _X} count thislist <= 0

Put that in the condition of your trigger, and you can change 0 to another number, being the minimum number of enemies that can still be alive, are not retreating, and have ammo for the trigger fire.

For vehicles, they can be defeated without necessarily being destroyed, and so you'll want to check for that too:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">!(alive Tank1) || !(canmove Tank1) || !(canfire Tank1) || ({alive _X} count (crew Tank1) <= 0) || ({fleeing _X} count (crew Tank1) >= 1)

This condition will fire when Tank1 is destroyed, Tank1 can't move (due to severe damage), Tank1 cannot fire (due to damage to the weapons/turrets), Tank1 is empty, Tank1's crew is dead, or Tank1 is fleeing.

Share this post


Link to post
Share on other sites

I know, but a basic trigger types work just fine in this case. It is a basic seek and destroy mission in which case the U.S. Sryker platoon attempt to clear a village.

If the opfor flee out of the village they move outside the trigger radius and the game ends with U.S. victory.

If the U.S. get reduced under certain number of units the game ends with opfor victory. Pretty simple.

It is even fun to spectate the night battle as a civilian.

Share this post


Link to post
Share on other sites

Alternatively use my favourite:

setup a trigger (OPFOR Present Once) and set the condition to be <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">count thislist == {fleeing _x} count thislist

Now, once all the enemy are  "...dead, dying or running home to Mom" the trigger activates. You've held your ground, the enemy is dead or running for the hills and you don't have to hunt down every last one to activate the trigger.

Ripped this from OFP posts and update for ArmA. Testing at present but it should work.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×