OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 10 Feb 2005, 17:11:29
-
i have this problem i have it so when the allied tanks get destroyed you request an artillery strike the artillery and scripts work but the condition field of the trigger doesnt ive put (not canmove tank1) and (not canmove tank4)" and so on that usually works but now it doesnt? i think its because that the player has to know that these tanks arent alive but im not sure because it usaully works and the tanks are usually right in front of me but these one arent. ive also tried (can move tank1) but that just activates the scripts straight away.?
-
Its,
Not (canmove tank1) and not (canmove tank2)
Try it that way.
-
no tryed that didnt work something like "{count x} not alive tank" would work but im not sure what the exact line is
-
wait actually now ive tried it again and this time it worked ive tried to do it again but the tanks keep surviving so im guessing it works but if anyone else has adifferent code line that will be very much apreciated
-
dammage 1 = destroyed
in looping script:
#start
?(GetDammage tank1 > .9): goto "next"
~.5
goto "start"
#next
[] exec "artillery.sqs"
exit
in trigger:
(GetDammage tank1 > .9): exec "artillery.sqs"
-
how can i link that with all 4 tanks so the artillery activates once all 4 tanks get destroyed because that will activate the artillery after each tanks that gets blown up?
-
To accomplish this with 6 triggers:
trigger1:
put over any unit
activated by anyone
condition : this
on activation : tank1dead = false; tank2dead = false; tank3dead = false; tank4dead = fasle
trigger2
activated by none
condition : GetDammage tank1 > .9
on activation : tank1dead = true
trigger3
activated by none
condition : GetDammage tank2 > .9
on activation : tank2dead = true
trigger4
activated by none
condition : GetDammage tank3 > .9
on activation : tank3dead = true
trigger5
activated by none
condition : GetDammage tank4 > .9
on activation : tank4dead = true
trigger6
activated by none
condition : tank1dead and tank2dead and tank3dead and tank4dead
on activation : [] exec "artillery.sqs"
There is a better way to do this-with eventhandler killed i think--but i can't think to put it together right now lol
;D
-
gawd... that's an awfully cumbersome way of doing things.
Never use getdammage to check if a unit is alive. It's probably about the most unreliable method there is...
Normally I'd say use not (alive unit), but because we're dealing with tanks you're better to use not (canmove tank) or not (canfire tank).
So, in one trigger try this as the condition field:
"not (canmove _x) or not (canfire _x)" count [ tank1, tank2, tank3, tank4, tank5, tank6 ] == 6
That detects when all the tanks are disabled (can't fire or move).
You can have as many tanks as you want in the array, provided you change the number at the end to equal the number in the array ;)
-
yep thanks got it working
-
right the line that sui mentioned
"not (canmove _x) or not (canfire _x)" count [ tank1, tank2, tank3, tank4, tank5, tank6 ] == 6" isnt working it says theres a local variable in local space and highlights the
"not (canmove _x#"" where that # is is saying where the erroe is well first of all what does the error mean and why is it happening
-
Are you using the names of the tanks in that array, rather than local variables?
-
the exact thing i put was not
"(canmove _x) or not (canfire _x)" count [ m1, m2, m3, m4 ] == 4"
and m1 - m4 is the names of the tanks
-
Hmmmm
You might need to move that quote mark.
The final quote is misplaced:
not"(canmove _x) or not (canfire _x)"count [ m1, m2, m3, m4 ] == 4"
and make it so:
"not (canmove _x) or not (canfire _x)" count [ m1, m2, m3, m4 ] == 4
I think
Planck