OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: The-Architect on 26 May 2006, 14:51:18

Title: Modifying a burn script
Post by: The-Architect on 26 May 2006, 14:51:18
How can I edit this script to make it work on any unit?

Something like [unit1,unit2] exec "napdeath2.sqs"

Right now I get an error message.

;======== MIF_napalmfx ===========;
;          \--mif_nfx/napdeath2.sqs
;=================================;
; Napalm Death2: make the affected unit burn
_unit = _this select 0

;unit behaviour part, remove if necessary:
;----------------------------------------;
_unit setSpeedMode "FULL"
_lastPos = getPos _unit
_lastDir = getDir _unit
_unit doMove [(_lastPos select 0)-100+(random 100*2),(_lastPos select 1)-100+(random 100*2),0]
;----------------------------------------;
_d = getDammage _unit

#burn
drop ["cl_fire", "", "Billboard", 4, 2, [0,0,1], [1*(sin(_lastDir)),1*(cos(_lastDir)),1], 1, 1.225, 1, 0, [.5, 2.5+(random .5),5], [[1,1,1,0], [1,1,1,0.3], [0.3,0.3,0.3,0.5], [0,0,0,0]], [0,1,0], 0.1, 0.5, "", "", _unit]
_lastPos = getPos _unit
_lastDir = getDir _unit
_unit setDammage _d
~.01
_d = _d + .005
? (getDammage _unit) >= 1 : _i = 0; goto "lowburn"
goto "burn"

#lowburn
drop ["cl_fire", "", "Billboard", 4, 3, [(_lastPos select 0)-1+(random 1*2)*(sin(_lastDir)),(_lastPos select 1)-1+(random 1*2)*(cos(_lastDir)),_lastPos select 2], [0,0,0], 1, 1.125, 1, 1, [2, 1.5,.2], [[1,1,1,0], [1,1,1,0.3], [0.3,0.3,0.3,0.5], [0,0,0,0]], [0,1,0], 0, 0, "", "", ""]
_i = _i + 1
~.1
? (_i >= 400) : exit
goto "lowburn"
Title: Re: Modifying a burn script
Post by: bedges on 26 May 2006, 15:11:26
i would tackle this a different way. instead of modifying the single unit burn script, call a script which calls the burn script. like so

[unit1, unit2, unit3] exec "flame_on.sqs"


Code: [Select]
;flame on script

_units = _this
_i = 0

#loop

_who = _units select _i

_who exec "napdeath.sqs"

_i = _i + 1

?not (_i > count _units):goto "loop"

exit

untested but it should work.
Title: Re: Modifying a burn script
Post by: Wadmann on 26 May 2006, 17:24:39
I modified this same script long ago to do the same thing but I just do not remember how I did it at the moment.

I can track my version down and post it but it may not be until later into the weekend as I am very busy ATM.

I will check back over the weekend and if you question has not already been answered, I will locate and post my version.

Wadmann

PS - It feels so good to view and post at OFPEC again.
Title: Re: Modifying a burn script
Post by: Garcia on 26 May 2006, 17:45:19
I think you're better off if you execute that script from another script. If you got an array of units in another script you can do something like this:
Code: [Select]
#loop
_array = [unit1,unit2]
_n = count _array
_m = 0

_u = _array select _m
_m = _m + 1
[_u] exec "napdeath2.sqs"
? (_m < _n : goto "loop"

doubt that'll work, but something like that...
Title: Re: Modifying a burn script
Post by: Mandoble on 26 May 2006, 19:50:47
A short version:
Code: [Select]
"[_x] exec ""napdeath2.sqs""" forEach [unit1, unit2, unit3, unit4]