OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: andersson on 24 Mar 2010, 00:04:34
-
Hi, need some help with a line of code.
I want to have 3 possible endings on a mission;
1 - 90% of the enemies are killed.
2 - 50% of all enemies are killed + a zone is empty of enemies.
3 - Out of time.
_enemy_count is a variable that counts the total enemies (random number of enemies spawned)
_10percent is 10% of _enemy_count
_50percent is 50% of _enemy_count
YES_enemies is default true until a trigger detects no enemies, then its YES_enemies = false
_curr_time is start time
_time_limit is set at 30
while{ ( _enemy_count > _10percent) AND ((_enemy_count > _50percent) AND YES_enemies) AND ((Time-_curr_time)<(_time_limit*60)) }do
The _Xpercent and time works just fine. Its the middle part I struggle with:
((_enemy_count > _50percent) AND YES_enemies)(_enemy_count > _50percent) for itself works just fine, when I have killed 50% the mission ends.
YES_enemies works just fine too. If I move away the trigger so no enemies are inside it the mission ends.
My problem is how to combine the two; (_enemy_count > _50percent) AND YES_enemies
I see no wrong with my line but right now its enough to kill 50% OR to have the YES_enemies as false. I need both at the same time.
Its probably something really easy, but I cant see it. Tried some variations but no...
-
Interesting approach.
Normally a condition should get true if a victory condition is reached.
((_enemy_count > _50percent) OR YES_enemies)will do your job since it will get false when both conditions are false.
-
I see.. I will try that.
I was to "verbal" when reading the code :D
Thank you :)