Home   Help Search Login Register  

Author Topic: Modifying a burn script  (Read 1200 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Modifying a burn script
« 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"
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Modifying a burn script
« Reply #1 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.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re: Modifying a burn script
« Reply #2 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.
Check out my Camouflage Collection! New items added 31 July 2005.

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re: Modifying a burn script
« Reply #3 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...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Modifying a burn script
« Reply #4 on: 26 May 2006, 19:50:47 »
A short version:
Code: [Select]
"[_x] exec ""napdeath2.sqs""" forEach [unit1, unit2, unit3, unit4]