Forum Jump :

Author Message


Posts: 20
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2012-05-12 16:27        
     
Tried to do this different ways, but can't get it to work properly.
If myvariable = 0 then (trigger0
I got a global variable that indicates amount of infected on the map. I want to activate trigger when its number equals zero.
Tried this in condition:
CHN_UNDEAD_ZEDCNT = 0;

but doesn't seem to activate trigger. Displayed the variable value and it was 0.


Author Message


Posts: 465
Rank:


Level: Member

Country: se
Location:
Occupation:
Age: 21
In-game name: Oksman

 
#2 Posted at 2012-05-12 16:41        
     
Try '==' instead of just '=' might be it.

However how do you count the zombies? If they're in the same faction or something you can use the count command.


Advertisement


Author Message


Posts: 20
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2012-05-12 18:15        
     
# Oksman : Try '==' instead of just '=' might be it.

However how do you count the zombies? If they're in the same faction or something you can use the count command.
There is an implemented variable that returns amount of infected units.

Added 2 hours 6 minutes later:

Tried == as condition:

myvariable1 == 0;


but at the beginning of the mission trigger is activated straight away, even if I know the value is not 0;
No idea how to do this.

This post was edited by tarsus4x4 (2012-05-12 20:22, 902 days ago)


Author Message

W0lle  

call me evil


Posts: 1801
Rank:


Country: de
Location:
Occupation: CWR² Developer
Age: 98
In-game name: CWR2 PR

 
#4 Posted at 2012-05-13 01:03        
     
Try to define the variable in the init.sqf, like:

CHN_UNDEAD_ZEDCNT = xx;

where xx is the amount of Undeads (or whatever) on mission start.


Author Message


Posts: 20
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2012-05-13 14:39        
     
# W0lle : Try to define the variable in the init.sqf, like:

CHN_UNDEAD_ZEDCNT = xx;

where xx is the amount of Undeads (or whatever) on mission start.
Cant define it. It's a mod variable implemented by guy who created the mod. It's value changes as the amount of undead changes through the mission.


Author Message


Posts: 20
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2012-05-14 16:01        
     
Okay, there is solution to the problem. And I noticed some posts about that before - unsolved.
All people usually recommend using == and this "should" work. Well, it doesn't.
I used >< signs instead, and they seem to work fine.

So:
ZOMBIES_ALIVE < 1;
This works.
However placing that kind of trigger on the map editor, will initiate the trigger straight away, as it seems, arma engine needs some time to sort out variables at the beginning.
My solution to this was, to create a variable, after doing something vital during the mission. Which must take some time. So I fly helicopter from base and land at the outpost. my presence there activates the trigger and sets up:

LANDED_AT_OUTPOST = true;

And mission is designed this way, that I MUST go to the outpost, no matter what.
This way it allows me to create a trigger on the map, initiating when all zombies are dead:

condition:
LANDED_AT_OUTPOST and ZOMBIES_ALIVE < 1;

on activation:
hint "All zombies are dead";

This is my way of avoiding problems during initial variable setting when mission starts, and setting of triggers.

Also, in condition field:
ZOMBIES_ALIVE == 50;
...does not work, but

ZOMBIES_ALIVE > 49 and ZOMBIES_ALIVE < 51;
...does work, if you want the number of zombies 50 to trigger an action.
No idea why, but this is what I learned from tests and observations.
Hope it will help others.