Home   Help Search Login Register  

Author Topic: ECP Backblast  (Read 571 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
ECP Backblast
« on: 25 Feb 2005, 01:43:33 »
i was trying to apply ECP's backblast onto my static launcher but the files i took from ecp (backblast.sqs and backblastdamage.sqs) work to an extent, but then i geta  multitude of errors...

i did IM zayford on the official forums to ask for permission etc and help, but no reply. I was wondering if anyone had managed to get a working backblast/damage onto a static launcher yet and wouldnt mind sharing their scripts?
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:ECP Backblast
« Reply #1 on: 27 Feb 2005, 19:14:42 »
surely one of the ECP guys could give me a quick guide?
Proud Member of the Volunteer Commando Battalion

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:ECP Backblast
« Reply #2 on: 08 Mar 2005, 02:06:53 »
Hi mate,
sorry but I have been on Holiday.

Ok lets see,
righto, backblast should not be a problem to convert for your weapon. Back blast damage is a lil bit more tricky, simply because our damage script acquires its victim from a global array of all men units "ECP_units" (in v 1.071)

Code: [Select]
[_x,_unit,_damage,[_pos,_x_pos] call ECP_getDirPos] exec format["%1blood_squirt.sqs",blood_internal_scriptdir]
This probably gave you errors because you may not have defined several ECP global values  ;) hehe its easy to over look some values.

ECP_units = array of all men units

_x =  the victim acquired from ECP_units

_unit = the guy that fired the missile

ECP_bbda_dmg_dis = distance victim must be within to attain damage from backblast (default = 10m)

ECP_bbda_dmg_angle = angle that victim must be within while behind shooter to attain damage (default = 35 (degrees))

ECP_inAng = The global var function that checks the above angle (check init_once.sqs for this code)

ECP_bbda_dmg_max = maximum damage the back may cause the victim (default is 1)

ECP_getDirPos = The global var function that checks the direction to squirt the blood from victim. But you may not want this as you will also require ECP blood scripts and blood objects etc.

ECP_play_unit and ECP_play_sound = These are ECP specific pub vars that you need not worry about, they enable the victims scream to be heard on all clients in MP and are acquired on the clients through other monitoring scripts that wait for the pub vars to alter.  :)


Now,
backblast.sqs probably gave you errors for similar reasons.

Code: [Select]
drop ["cl_basic", "", "Billboard", 1, 4, _pos, _velocity, 1, 0.005, 0.0042, 0.05, [_startsize,_endsize],_finalcolour, [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]
Were ECP_gb_terrain and ECP_gb_c_desert etc defined?
If they werent then _finalcolour would have no value.

You can easily convert all these global vars into local ones for your addon mate. Let me know if you need any help. Just post your code up here and we'll sort it out, or send it to me via PM.

Sorry for not getting in touch sooner.

Zay

"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:ECP Backblast
« Reply #3 on: 16 Mar 2005, 16:34:04 »
ok... i assumed as much that by taking them from ECP, i may have lost a few inportant values...

the scripts are currently exactly the same as from ecp... so:

Code: [Select]
; --------------- AT backblast damage ---------------------------------------------

_unit = _this select 0

; rewritten by snYpir - 02/12/03

; get center angle of backblast
_ca = (getdir _unit) - 180
? _ca < 0 : _ca = _ca + 360

; get units within backblast distance and angle
_i = 0; _num = (count ECP_units) - 1; _pos = getpos _unit
#unit_loop
   _x = ECP_units select _i

   ? _x == _unit || !(alive _x) || !(local _x) || "Man" counttype [_x] == 0 : goto "no_check"

   _dis = _unit distance _x
   _x_pos = getpos _x

   ? _dis > ECP_bbda_dmg_dis : goto "no_check"
   ? !([_pos,_ca,ECP_bbda_dmg_angle,_x_pos] call ECP_inAng) : goto "no_check"

   ; damage unit (damage is proportional to distance)
   _damage = ECP_bbda_dmg_max * ((ECP_bbda_dmg_dis - _dis) / ECP_bbda_dmg_dis)
   _x setdammage ((getdammage _x) + _damage)

   ; make blood - 07/12/03
   [_x,_unit,_damage,[_pos,_x_pos] call ECP_getDirPos] exec format["%1blood_squirt.sqs",blood_internal_scriptdir]

   ; say ouch - 07/12/03
   ECP_play_unit = _x; publicvariable "ECP_play_unit"
   _ran = random (count ECP_gb_hitsounds)
   _ran = _ran - (_ran % 1)
   ? local _x : _x say (ECP_gb_hitsounds select _ran)
   ECP_play_sound = _ran; publicvariable "ECP_play_sound"

   #no_check
? _i < _num : _i = _i + 1; goto "unit_loop"

and

Code: [Select]
; AT backblast script by Sui, modified by RED
; ===========================================

_atguy = _this select 0

_pos = [(getpos _atguy select 0) + sin (getdir _atguy + 180) * 0.5, (getpos _atguy select 1) + cos (getdir _atguy + 180) * 0.5, (getpos _atguy select 2) + 1]

_velocity_smoke_right1 = [sin (getdir _atguy + 165) * 3, cos (getdir _atguy + 165) * 2, -0.5]
_velocity_smoke_left1 = [sin (getdir _atguy + 205) * 3, cos (getdir _atguy + 195) * 2, -0.5]
_velocity1 = [sin (getdir _atguy + 180) * 3, cos (getdir _atguy + 180) * 2, -0.5]

_intensity_dir = [0.7,0.7,0.6,0.05]
_intensity_dir1 = [0.75,0.75,0.75,0.05]
_lifeTime = 1
_lifeTime_fire = 0.1
_intensity = 10
_object = ""
_delay = 0.05

_colour = [0.4,0.4,0.4,0.7]
_colour1 = [0.8, 0.8, 0.8, 0.4]


; colour of dust based on terrain
? ECP_gb_terrain == 1 : _colourdust = ECP_gb_c_desert + [0.3]
? ECP_gb_terrain == 2 : _colourdust = ECP_gb_c_standard + [0.3]
? ECP_gb_terrain == 3 : _colourdust = ECP_gb_c_vietnam + [0.3]
? ECP_gb_terrain == 4 : _colourdust = ECP_gb_c_snow + [0.5]
? ECP_gb_terrain == 5 : _colourdust = ECP_gb_c_sand + [0.5]
? ECP_gb_terrain == 6 : _colourdust = ECP_gb_c_grass + [0.3]


; burst dust
;DustBurst = loadfile format["%1back_blast\dust_burst.sqf",ECP_path]
;~0.5
;_pos call DustBurst

_lifeTicks_fire = _lifeTime_fire / _delay
_lifeTick_fire = _lifeTicks_fire

_lifeTicks = _lifeTime / _delay
_lifeTick = _lifeTicks
_i = 0


; Smoke that travels fast away from unit
; ======================================

_deg = 0
_thiscolour = _colourdust
#loop

_ranvel = 24 + (random 8)

_velocity = [sin (getdir _atguy + (165 + _deg )) * _ranvel, cos (getdir _atguy + (165 + _deg)) * _ranvel, -0.5]

; randomise dust a little
_thiscolour set [3,0.1+(random 0.3)]
_finalcolour = [_thiscolour,_thiscolour,_thiscolour,[_thiscolour select 0,_thiscolour select 1,_thiscolour select 2,0]]

_startsize = 0.1 + (random 0.6)
_endsize = 6 + (random 2)

drop ["cl_basic", "", "Billboard", 1, 4, _pos, _velocity, 1, 0.005, 0.0042, 0.05, [_startsize,_endsize],_finalcolour, [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]
_deg = _deg + 2
? _deg < 30: goto "loop"

; Litlle bits of dust
; ===================

_posdust = [(getpos _atguy select 0) + sin (getdir _atguy + 180) * 1, (getpos _atguy select 1) + cos (getdir _atguy + 180) * 1, (getpos _atguy select 2) + 0.5]
_intensity_dir_dust = [0.4,0.4,0.3,0.5]
_deg = 0
#loop_2
_deg = _deg + 0.5
_velocity = [sin (getdir _atguy + (165 + _deg )) * 28, cos (getdir _atguy + (165 + _deg)) * 28 , (random 6) - 3]

;?(random 1) < 0.5: drop ["cl_basic", "", "Billboard", 1, 2, _posdust, _velocity, 1, 0.005, 0.0042, 0.05, [0.1,0.2],[_colourdust, _intensity_dir_dust], [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]

_RotationVelocity = 0.5
_Weight = 0.01
_Volume = 0.005
_Rubbing = 0.05
_RandomDirectionPeriod = 1.2
_RandomDirectionIntensity = 4

?(random 1) < 0.5 : drop ["sutr2", "", "SpaceObject", 1, 2, _posdust, _velocity, _RotationVelocity, _Weight, _Volume, _Rubbing, [0.14, 0.14], [[0.302,0.302,0.302, 1]], [0], _RandomDirectionPeriod, _RandomDirectionIntensity, "", "", _object]

? _deg < 30: goto "loop_2"

; Smoke that sticks around the unit
; =================================

#loop_3

drop ["cl_basic", "", "Billboard", 1, 5, _pos, _velocity1            , 1, 0.005, 0.0042, 0.05, [0.5,8],[_colour1, _intensity_dir1], [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]
drop ["cl_basic", "", "Billboard", 1, 5, _pos, _velocity_smoke_right1, 1, 0.005, 0.0042, 0.05, [0.5,8],[_colour1, _intensity_dir1], [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]
drop ["cl_basic", "", "Billboard", 1, 5, _pos, _velocity_smoke_left1 , 1, 0.005, 0.0042, 0.05, [0.5,8],[_colour1, _intensity_dir1], [0,1,0,1,0,1], 0.4, 0.4, "", "", _object]


~_delay
_lifeTick = _lifeTick - 1
_i = _i + 1
?_i < 4 : goto "loop_3"
exit

so im assuming its a case of me filling in a few blanks in terms of variables etc? i'm firing the scripts using the fire eventhandler at the moment...

cheers for the reply  :)
Proud Member of the Volunteer Commando Battalion