Hello,
I have a mortar script which is run on the server in a loop for a certain amount of time, after the impact of a mortar shell I want to start a FX script (actually a function) on the client which creates nice dust from the explosion with
drop command.
I use a trigger in the editor with
Activation none repeatedlyCondition mortar_fxon activation [mortar_fx_pos] call loadFile "mortarfx.sqf"to get the function to run on all clients.
The variable
mortar_fx is initialised with false in init.sqs and set to true and publicVariable'd in the mortar script.
mortar_fx_pos is the impact position where the drop effect should be created and is publicVariable'd in the mortar script too.
I've read here in some old threads that this is a common way to create drop particle effects on all clients in MP but for some reason this setup does not work for me. Can you help me fix it (maybe it's only a silly typo or something similar)? I'm open to completely new suggestions on how to execute the FX script on all clients (Network Services addon is available on the server if this would be any help
)
For the convenience here is the mortar script which is run on the server:
; mortar.sqs - run from a trigger; call: [trigger_name] exec "mortar.sqs"
?!local server : exit
_trp = _this select 0
#loop
_dir = (random 360) call roundn
_dist = (random 250) call roundn
_x = sin(_dir) * _dist
_y = cos(_dir) * _dist
_pos = [((getPos _trp) select 0) + _x, ((getPos _trp) select 1) + _y, 0]
_shell = "Heat73" createVehicle _pos
_shell setDamage 1
mortar_fx = true
publicVariable "mortar_fx"
mortar_fx_pos = _pos
publicVariable "mortar_fx_pos"
~1
mortar_fx = false
publicVariable "mortar_fx"
deleteVehicle _shell
~30 + random (30)
; lz_safe indicates end of mortar fire, lz_safe is initialised in init.sqs and set to true in a trigger
?lz_safe : goto "exit"
goto "loop"
#exit
exit
Edit:
Got it sorted out. The problem was I tried to publicVariable an array which is not possible of course. I tried to make the position public with the Network Services addon but did not get to grips with it so I did it the old fashoined way and publicVariable'd the x- and y-coordinates of the position array seperately.
Anyway thanks for nothing