Jump to content
Sign in to follow this  
.COMmunist

trigger goes off when particular units are dead

Recommended Posts

Working on the mission where a player gets to target a chopper to armored AA. By a trigger chopper joins player

[chopper] join player

upon destroying 3 Vulcans, some sort of a trigget or condition needs to kick in. I named Vulcans Vul1, Vul2 and Vul3. I need the game to "know" when all three Vuls are destroyed. Some sort of a trigger or something... This will initiate another chain of events

Any ideas? Thanks guys!

Share this post


Link to post
Share on other sites

type in the trigger condition:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(Not(Alive Vul1)) && (Not(Alive Vul2)) && (Not(Alive Vul3))

Share this post


Link to post
Share on other sites

I would rather use

canFire && canMove

I mean, when you have made sure that an enemy unit can't fire and can't move, then it's game over for that enemy unit isn't it?

Using alive could create very annoying situations for players when they think that they have done enough but in fact the enemy unit is still alive, it just can't move and can't shoot but is still alive... and the mission never ends as the player can't figure out what is wrong...

Share this post


Link to post
Share on other sites

Thank you very much gents! I'll try both...

Ah, just tried it and both of your examples are not working confused_o.gif

when I put this in on Activation in the trigger:

(Not(Alive NAME1)) && (Not(Alive NAME2)) && (Not(Alive NAME3))

I get a message:

Type Bool, Expected Nothing

and when I tried this:

?!(canFire _Vul1) : player sideChat "Tank disabled!"

I get a message:

Invalid number in expression

Please help!

Share this post


Link to post
Share on other sites

You are not supposed to put a condition to the On Activation field of a trigger. Also you seemed to use a local variable where you should have used a global variable (_Vul1--> Vul1 from the Vulcan's name field). Edit: Actually the second codeline of yours is not going to work in a trigger anyways.

Put a condition to the Condition field.

A suitable condition could be:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(!canFire vulcan1 && !canMove vulcan1) && (!canFire vulcan2 && !canMove vulcan2) && (!canFire vulcan3 && !canMove vulcan3)

then you put to the On Activation field whatever you want to happen...

An example mission in which you are T-72 gunner and after you have destroyed three Vulcans, a hint "Victory!" is displayed:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11;

class Mission

{

addOns[]=

{

"catracked",

"desert"

};

addOnsAuto[]=

{

"catracked",

"desert"

};

randomSeed=11409923;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

class Groups

{

items=4;

class Item0

{

side="GUER";

class Vehicles

{

items=1;

class Item0

{

position[]={2543.685303,13.860000,2639.254150};

azimut=225.000000;

id=0;

side="GUER";

vehicle="Vulcan_RACS";

leader=1;

skill=0.600000;

text="vulcan1";

};

};

};

class Item1

{

side="GUER";

class Vehicles

{

items=1;

class Item0

{

position[]={2542.557861,13.860000,2689.427979};

azimut=225.000000;

id=1;

side="GUER";

vehicle="Vulcan_RACS";

leader=1;

skill=0.600000;

text="vulcan2";

};

};

};

class Item2

{

side="GUER";

class Vehicles

{

items=1;

class Item0

{

position[]={2543.121582,13.860000,2734.527344};

azimut=225.000000;

id=2;

side="GUER";

vehicle="Vulcan_RACS";

leader=1;

skill=0.600000;

text="vulcan3";

};

};

};

class Item3

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={2482.295898,13.860000,2538.853271};

azimut=30.000000;

id=3;

side="EAST";

vehicle="T72";

player="PLAYER GUNNER";

leader=1;

skill=0.600000;

};

};

};

};

class Sensors

{

items=1;

class Item0

{

position[]={2698.729980,16.524294,2537.381348};

a=0.000000;

b=0.000000;

interruptable=1;

age="UNKNOWN";

expCond="(!canFire vulcan1 && !canMove vulcan1) && (!canFire vulcan2 && !canMove vulcan2) && (!canFire vulcan3 && !canMove vulcan3)";

expActiv="hint ""Victory!""";

class Effects

{

};

};

};

};

class Intro

{

addOns[]=

{

"desert"

};

addOnsAuto[]=

{

"desert"

};

randomSeed=1459203;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

class OutroWin

{

addOns[]=

{

"desert"

};

addOnsAuto[]=

{

"desert"

};

randomSeed=8199171;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

class OutroLoose

{

addOns[]=

{

"desert"

};

addOnsAuto[]=

{

"desert"

};

randomSeed=13598723;

class Intel

{

startWeather=0.100000;

forecastWeather=0.300000;

year=2007;

month=6;

day=7;

hour=8;

};

};

Create & save a new mission on Rahmadi and replace the contents of its mission.sqm file (you can open it in notepad) with the code from above, save the file and reload the mission to test it.

Share this post


Link to post
Share on other sites
Quote[/b] ](Not(Alive Vul1)) && (Not(Alive Vul2)) && (Not(Alive Vul3))

Try this instead :

Not (Alive Vul1) && Not (Alive Vul2) && Not (Alive Vul3)

Share this post


Link to post
Share on other sites
Quote[/b] ](Not(Alive Vul1)) && (Not(Alive Vul2)) && (Not(Alive Vul3))

Try this instead :

Not (Alive Vul1) && Not (Alive Vul2) && Not (Alive Vul3)

I think the error was that he put a condition into the "On Activation" field of a trigger, as he said he had done. That is not going to work.

You just reduced some parenthesis but that doesn't make the logic of this code any different.

And I really advice to use !canFire and !canMove instead of !alive, so that the players are less likely to get significant, sudden hair loss.

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  

×