OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Thaatu on 16 Dec 2005, 00:10:55
-
Checking if a unit is fleeing is simple with "Fleeing"-command on condition field, but how to check if a whole group is fleeing?
-
I think a simple check of the leader should provide you with what the group is doing. If the group leader is fleeing, chances are the whole group is. ;) Try this:
fleeing leader GroupName
I could be wrong...but I don't think so in this case. ;D
-Pilot
-
I have a feeling that fleeing is a group property anyway, so if one member is fleeing then by definition they all must be. However Pilot is right: the leader is (almost always) the bravest member of the group, so if he is on the run the rest should be too.
-
Yeah, BUT what if the group leader is dead? Command reference says that dead or empty unit returns false. So lets say the leader is the first to die, then doesn't it after that assume the group is not fleeing if it only checks the leader?
BTW, solved this by making it check every unit independently in the groups (thank god there were ONLY 36 units)... But is there any way to use Foreach command in condition field?
-
No no no no no no no no no no no no no.
Read the comref again. And this time read it properly. ;)
(Never, ever, under any circumstances whatsoever, make a post in the forum or indeed read a post in the forum without looking up ALL commands in the online comref. You may use other versions of the comref for quick reference, but not using the online version in the Editors Depot the first time you encounter a command is merely stupid. In fact it is the ONLY version of the comref I ever use, because you never know what help somebody may have added since the last time you looked.)
Done that? Good. Now you understand that it is impossible for the group leader to be dead. If the group leader is dead, then by definition everybody in the group is dead. You MUST understand what a group is, and the difference between a unit and a group (which are barely even related) otherwise you are never going to get anywhere in OFP editing. Ask if you are unsure: that is what the forum is for.
Oh and yes of course you can use forEach in the Condition field of a trigger, in the same way that you can use virtually any command in virtually any circumstance where a command can be put.
-
Sorry about that, my brain melt for a second there (I haven't used "leader Group" much and used unit names instead, but I should have realized that). Thanks for clearing this up for me.
But I have tried using foreach in condition, but I can't seem to construct the whole litany correctly. Let's say:
"alive _x" foreach units group player ; Now this obviously doesn't work but what's the correct version of it?
-
"alive _x" foreach units group player
Read up on the count command. In general forEach is for making things happen: count is for checking things. In other words, in triggers, count tends to turn up in the condition field and forEach tends to turn up in the On Activation field.
You probably mean something like
"alive _x" count units group player > 4
You're doing fine btw, keep up the good work: OFP scripting is like poking knitting needles in your eyes at first but that phase doesn't last long once you get in to it.
-
I've been in that phase for a few years now. I'm still sticking needles in my eye, but now I'm used to the pain :)
Maybe I'll start making complete missions, not just fool around with the editor...
Solved.