Well,
your script has this in its beginning:
_c = _this select 0
#LOOP
_dammage = (getdammage _c)
@(getdammage _c > _dammage)
In another topic
http://www.ofpec.com/forum/index.php?topic=22956.30i found these lines for the damage/getdammage command:
damage object works on (non)local object, rounding error on nonlocal object
I think it is possible that your script will lead to different results on different computers, the information "getdammage _c" seems not to have a high priority in a multiplayer mission. Let's go with "hit" eventhandlers...
1. We initialize variables fx_0,fx_1,fx_2,... for every unit, and apply indexed "hit" and "killed" eventhandlers.
; *****************************************************
; ** FX_Init
; *****************************************************
; an array containing all units that will carry the fx eventhandler
_u_ar=[s1,s2,s3,s4]
; the minimum distance that will make the fx appear
_d=2000
; the script that gets executed (client only) from every hit
_s="bloodthingy.sqs"
; a unit on the field that will bury dead corpses
_g=gd
; the minimum delay before body deletion in seconds
_min=60
; the maximum delay
_max=120
_client=local player
_script="FX_Check.sqs"
_str_1 = "fx_%1=false"
_str_2 = "_u addEventHandler [{hit},{fx_%1=true; publicvariable {fx_%1}}]"
_str_3 = "_u addEventHandler [{killed},{_this exec {FX_Delete.sqs}}]"
_str_ar = [_str_1,_str_2,_str_3]
fx_gravedigger = _g
fx_del_min = _min
fx_del_max = _max
_i=0
_c=count _u_ar
while {_i < _c} do {_u=_u_ar select _i; {call format [_x,_i]} foreach _str_ar; if _client then {[_u,_i,_d,_s] exec _script}; _i=_i+1}
exit
2. A client script for every single unit will check the corresponding variable and execute "bloodthingy.sqs" in case of a hit. If the unit dies, we end its "FX_Check.sqs" and save performance.
; *****************************************************
; ** FX_Check
; *****************************************************
_u=_this select 0
_i=_this select 1
_d=_this select 2
_s=_this select 3
_str1=format ["fx_%1",_i]
_str2="=false"
# FX
@ (call _str1) or (not alive _u)
if ((vehicle _u) distance (vehicle player) < _d) then {_this exec _s}
if (alive _u) then {call (_str1+_str2); goto "FX"}
exit
3. The death of an enemy does not only lead to body deletion, we bury him before, that looks much cooler. The timing is random, and can be choosen by the mission maker. This here runs from the "killed" eventhandler.
; *****************************************************
; ** FX_Delete
; *****************************************************
_body=_this select 0
~1
_del=fx_del_min+random (fx_del_max-fx_del_min)
~_del
fx_gravedigger action ["hidebody",_body]
~15
deleteVehicle _body
exit
4. I changed "bloodthingy.sqs" a bit.
; Put [this] exec "bloodthingy.sqs" in the init line of the victim.
; modified by dr. seltsam
_c = _this select 0
;#LOOP
;_dammage = (getdammage _c)
;@(getdammage _c > _dammage)
_types = ["cl_water"]
_ctypes = count _types
;"koulesvetlo"
;"obrysove svetlo"
;"cl_fire"
;"cl_water"
;"cl_basic"
_user = _c
_count = 0
_pos = [(getpos _user select 0),(getpos _user select 1),(getpos _user select 2)+1]
_i = 0
_maxspd = 20
_mass = 100
_vol = -10
_rubb = 0
_size = [2,0.5,0.75,1]
_numdrops = 10
; _angbase=(getdir _c)+45+(random 30)-15
_angbase=(random 359)
#explosion
_maxspd = (random 6)
_mass = (random 300)
_vol = (0-(random 10))
_rubb = 0
_size = [(random 1),(random 0.2),(random 0.6),(random 1)]
_count = (_count + 1)
_ang = (random (random (random 359))) + _angbase
_rad = random _maxspd
_vel = [sin(_ang)*_rad, cos(_ang)*_rad, random _maxspd]
_rand = random _ctypes
_typen = (_rand - (_rand mod 1))
_type = _types select _typen
drop [_type, "", "Billboard", 1, (random 3), _pos, _vel, 0.5, _mass, _vol, _rubb, _size, [[(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),(random 1),(random 1),0]], [0,0,0], 0, 0, "", "", ""]
_rad = random _maxspd
_vel = [sin(_ang)*_rad, cos(_ang)*_rad, random _maxspd]
_rand = random _ctypes
_typen = (_rand - (_rand mod 1))
_type = _types select _typen
drop [_type, "", "Billboard", 1, (random 3), _pos, _vel, 0.5, _mass, _vol, _rubb, _size, [[(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),0,0,(random 1)], [(random 1),(random 1),(random 1),0]], [0,0,0], 0, 0, "", "", ""]
_i = _i + 1
; ~0.005
_pos = [(getpos _user select 0),(getpos _user select 1),(getpos _user select 2)+1]
? (_count < (random 100)) : goto "explosion"
;? (alive _c) : goto "LOOP"
;_direc=(getdir _c)+225+(random 30)-15
;_c setdir _direc
;_c switchmove "CombatRunBDyingVer2"
;~((random 5)+15)
;deletevehicle _c
For the final animation i have no idea at the moment. Does a body that is in "switchmove" on the client computers, but deleted on the server, lead to problems? Anybody knows?
I hope this script set here will help your project. All is packed together in a little sample mission on desert island.