
- Kod: Zaznacz cały
Skrypt RDBurn.sqs:
;
; Burn skript by mav
; Usage:
; Par1: Type of unit in Par2
; Par2: Unit that was hit by flames
;
; Each type of unit has a certain probability of being
; set aflame. Men burn more easily than tanks (doh!)
;
_Type = _this select 0
_Unit = _this select 1
_s = objNull
; Probability for an object to burn
_prob = 0
; Damage an object takes per 1/100 sec
_ddmg = 0
? (_Type == "Man") : _prob = 100; _ddmg = 0.035
? (_Type == "Car") : _prob = 30; _ddmg = 0.012
? (_Type == "Tank") : _prob = 5; _ddmg = 0.003
? (_Type == "Air") : _prob = 20; _ddmg = 0.005
? (_Type == "Ship") : _prob = 10; _ddmg = 0.005
? ((Random 100) >= _prob) : exit
_Unit InFlame true
_fl = "RDFire" CamCreate (getPos _Unit)
_fl InFlame true
; Make unit run away
_cnt = 0
_Unit SetCombatMode "BLUE"
_Unit SetSpeedMode "FULL"
#MoveLoop
_upos = getPos _Unit
? (_cnt % 50)==0 : _Unit doMove [((_upos select 0) + random 15), ((_upos select 1) + random 15)]
_cnt=_cnt+1
_Unit SetDammage ((getDammage _unit)+_ddmg)
_fl SetPos _upos
~0.01
; if unit is still alive then continue burning
? (getDammage _unit)<1.0 : goto "MoveLoop"
; even after the unit's death the fire needs to be adjusted to look good.
~0.5
_fl SetPos getPos _Unit
~0.5
_fl SetPos getPos _Unit
~0.5
_fl SetPos getPos _Unit
~0.5
_fl SetPos getPos _Unit
~2.5
_fl SetPos getPos _Unit
; create smouldering effect
_s = "RDSmoke" CamCreate getPos _Unit; _s Inflame true
~1
_fl InFlame false
_fl SetDammage 1.0
_fl SetPos [1,1,1]
~20
_s InFlame false
_s SetDammage 1.0
_s SetPos [1,1,1]
exit
- Kod: Zaznacz cały
Skrypt RDFindTargets.sqs:
;
; FindTargets skript by mav
; Usage:
; Par1: a Trigger to determine which units will burn
; Par2: last known position of the flames
;
; The trigger is set to the last known position of the flames
; and the list of units in the trigger is determined.
; For each unit affected its type is retrieved and another
; script (burn.sqs) is called to perform the actual burning
;
_Trig = _this select 0
_Pos = _this select 1
_Trig SetPos _Pos
~0.05
_hit = List _Trig
_hitcnt = count _hit
? (_hitcnt < 1) : exit
_i = 0
#FindLoop
_run = _hit select _i
? (getDammage _run)>=1.0 : goto "Skip"
_typecnt = "Man" CountType [_run]
? (_typecnt==1) : ["Man",_run] exec "RDburn.sqs"; goto "Skip"
_typecnt = "Car" CountType [_run]
? (_typecnt==1) : ["Car",_run] exec "RDburn.sqs"; goto "Skip"
_typecnt = "Tank" CountType [_run]
? (_typecnt==1) : ["Tank",_run] exec "RDburn.sqs"; goto "Skip"
_typecnt = "Air" CountType [_run]
? (_typecnt==1) : ["Air",_run] exec "RDburn.sqs"; goto "Skip"
_typecnt = "Ship" CountType [_run]
? (_typecnt==1) : ["Ship",_run] exec "RDburn.sqs"; goto "Skip"
#Skip
? (_i < _hitcnt) : _i=_i+1; goto "FindLoop"
exit
- Kod: Zaznacz cały
i ostatni RDFlamethrowe.sqs:
;
; Flamethrower skript by mav
; Usage:
; Par1: Unit firing Flamethrower
; Par2: Weapon ("RDFlamethrower")
; Par3: a Trigger to determine which units will burn
;
; Skript waits for flamethrower to be fired and tracks the flame
; If the flame hits something, hits the ground or is beyond 40m from
; the firing unit a trigger will be positioned at the last known
; position of the flame and the units burnt are determined (findtargets.sqs)
_Unit = _this select 0
_Weapon= _this select 1
_Trig = _this select 2
_oldammo = _Unit Ammo _Weapon
@ _oldammo != _unit Ammo _Weapon
[_Unit, _Weapon, _Trig] exec "RDflamethrower.sqs"
; NearestObject [Object, Class] works because RDFlames inherits from Target
; couldn't get it to work for other classes
_flame = NearestObject [_Unit, "RDFlames"]
;? (IsNull _flame) : Hint "No Flame?!"; exit
? (IsNull _flame) : exit
#LoopStart
_fpos = getPos _flame
? ((_fpos select 0)>0) : _fposold = _fpos
;? (IsNull _flame) : Hint "Flame gone"; goto "StopLoop"
;? ((_fpos select 2) < 0.1) : Hint "Flame hit the ground"; goto "StopLoop"
;? ((_flame Distance _Unit)>40) : Hint "Flame flew too far"; goto "StopLoop"
? (IsNull _flame) : goto "StopLoop"
? ((_fpos select 2) < 0.1) : goto "StopLoop"
? ((_flame Distance _Unit)>40) : goto "StopLoop"
~0.01
goto "LoopStart"
#StopLoop
_height = _fposold select 2
_flame SetDammage 1.0
_flame SetPos [0,0,0]
;? (_height > 2.5) : Hint "Flame died too high"; goto "tooHigh"
? (_height > 2.5) : goto "tooHigh"
[_Trig, _fposold] exec "RDfindtargets.sqs"
#tooHigh
exit
Podałem trochę nie po kolei, ale mam nadzieję, że dojdziesz co i jak
![:]](./images/smilies/icon_krzywy.gif)