OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: borrowed soap on 04 Jul 2003, 20:53:59

Title: from units to arrays in scripting~hidebodies easier?
Post by: borrowed soap on 04 Jul 2003, 20:53:59
i want two arrays to utilize snYpir's isbodyhidden script, not just two units.

arrays make scripting easier: if i have array1 = [unit1,unit2,unit3,unit4]

@unitReady _unit1
@unitReady _unit2
@unitReady _unit3
@unitReady _unit4

becomes:

@ "unitReady _x" count array1 == count array1

much much simpler of course so if i add another array and have both arrays:

array1 = [unit1,unit2,unit3,unit4]
array2 = [unitA,unitB,unitC,unitD]

MY QUESTION is then how do i apply the new syntax for my arrays to the following

line taken from snYpir's killer "isbodyhidden.sqs" snippet:

? NOT(alive _corpse) AND (_corpse Distance _searcher) < 35 AND (GetPos _corpse

select 2) > -0.5 : goto "Alarm"

i want to adapt this snYpir snippet to accommodate two arrays, otherwise the calls

and the amount of scripting (even with cut and paste) becomes unworldly. i started

by trying to break down the component parts of the statement, but i dont have any

vocabulary for what i need to do to translate and simplify. i want two arrays to

utilize snYpir's isbodyhidden script, not just two units.

? NOT(alive _unit1)                  //thru _unit4, 4 times instead of once//
? (_unit1 distance _searcher) <= 5   //for each query//
? (GetPos _a select 2) > -0.5

what, if anything, is next to do? or am i waaaay off, wouldnt b the first time
Title: Re:from units to arrays in scripting~hidebodies easier?
Post by: LCD on 04 Jul 2003, 23:53:33
hi soup

i sugest u c dat script - its beter ;D (http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=7078)

u can exec 2 scripts ;D like dat

script 1

Code: [Select]
"[_X] exec {script2.sqs}" foreach _this
exit

exec it

[arrayofdetectors] exec "script1.sqs"

script 2

Code: [Select]
_man = _this select 0

"[_man,_X] exec {isbodyhidden.sqs}" foreach arrayofbodies

;D

im not sure but it shud work - nd  u dont need 2 edit snYpirs (or my) scripts

LCD OUT
Title: Re:from units to arrays in scripting~hidebodies easier?
Post by: borrowed soap on 05 Jul 2003, 00:31:47
u r still da man   8)
im gonna dig into that tonight