diehardfc 41 Posted April 24, 2021 Greetings! I'm trying to find some help figuring out what I'm doing wrong with some code I assembled. My unit has been trying to create a kind of CBRN type attack via scripting. We tested other mods and scripts (assaultboy, jshok, etc.), but they weren't a good fit, so I tried to put something together using scripts written by AliasCartoons. I've run his fog script with his radiation script and gotten exactly the results my unit was looking for. To set the attack off, though, I'd like to have it delivered by a phony mortar attack. Basically some sound effects and a particle-based smoke cloud over a crater. So, I've placed an object (invisible helipad) with a global variable name (from the object attributes), and that's where the "mortar blast" will go off. Everything works fine when I test it on my home PC in single player, but when I move it to our unit's dedicated server, it starts to veer off course. If I execute the script LOCAL or SERVER, I can hear the mortar whistle, hear the explosion noise, see the smoke burst, and observe the crater being created. However, none of the other players hear the whistle or see the smoke. If I execute GLOBAL, everyone sees everything, but I'm terrified of doing that because I don't want to execute these scripts on 40 machines. One causes damage over time and the other creates particles which will crash the server, I think. Looking at the code below, can anyone figure out what's going wrong? //FROM THE FILE GASATTACK.SQF playSound3D ["a3\sounds_f\weapons\falling_bomb\fall_01.wss", my_radioactive_obj, false, getPosASL my_radioactive_obj, 4, 1, 0, 0]; //PLAYS MORTAR WHISTLE sleep 5; //DELAYS THE START OF ALIAS SCRIPTS UNTIL AFTER SOUND PLAYS null = [my_radioactive_obj,200,0.06,"Mask_M50","MineDetector",true,1,true] execvm "AL_radiation\radioactive_object.sqf"; //EXECUTES RADIATION SCRIPT (CBRN DAMAGE EFFECT) [my_radioactive_obj,"low"] execvm "AL_localfog\local_fog.sqf"; //EXECUTES FOG SCRIPT (CBRN GAS EFFECT) _gasAttack = "Crater" createVehicle position my_radioactive_obj; //CREATES CRATER ON GROUND playSound3D [ "A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_01.wss", my_radioactive_obj]; //PLAYS EXPLOSION SOUND //REMAINING CODE SPAWNS SMOKE CLOUD FROM FAKE MORTAR h = [] spawn { _emitters = []; for "_i" from 0 to 360 step 45 do { _pos = getPos my_radioactive_obj; _source1 = "#particlesource" createVehicle _pos; _source1 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 10, [0, 0, 0], [0, 0, 0.5], 0, 1.277, 1, 0.025, [0.5, 8, 12, 15], [[1, 1, 1, 0.7],[1, 1, 1, 0.5], [1, 1, 1, 0.25], [1, 1, 1, 0]], [0.2], 1, 0.04, "", "", _this]; _source1 setParticleRandom [2, [0.3, 0.3, 0.3], [1.5, 1.5, 1], 20, 0.2, [0, 0, 0, 0.1], 0, 0, 360]; _source1 setDropInterval 0.2; _source2 = "#particlesource" createVehicle _pos; _source2 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 7, 0], "", "Billboard", 1, 5, [0, 0, 0], [0, 0, 0.5], 0, 1.277, 1, 0.025, [0.5, 8, 12, 15], [[1, 1, 1, 1],[1, 1, 1, 1], [1, 1, 1, 0.5], [1, 1, 1, 0]], [0.2], 1, 0.04, "", "", _this]; _source2 setParticleRandom [2, [0.3, 0.3, 0.3], [1.5, 1.5, 1], 20, 0.2, [0, 0, 0, 0.1], 0, 0, 360]; _source2 setDropInterval 0.15; _emitters append[ _source1, _source2 ]; }; uiSleep 10; { deleteVehicle _x; }forEach _emitters; }; Why does this work flawlessly on a local machine? And why, on a dedicated server, does the crater always show up and the explosion always go off but the whistle and smoke won't? Alternatively, can anyone say if these were executed Globally, would there be 40 instances of the script running? 1 Share this post Link to post Share on other sites
pierremgi 4905 Posted April 24, 2021 4 hours ago, diehardfc said: If I execute GLOBAL, everyone sees everything, but I'm terrified of doing that because I don't want to execute these scripts on 40 machines. One causes damage over time and the other creates particles which will crash the server, I think. As already said, an sqf is a bunch of multiple commands with own behavior for Arguments and Effects. playSound3D is AG EG ,so must NOT be run everywhere. Play it from server.createVehicle is EG play it from server... but for emitters, use createVehicleLocal (see below). setParticleParams is AG EL so, needs to be run locally, everywhere. .... all sqfs inside sqf... are undetermined for the same reason: a bunch of commands! So, as first rule, run the code locally (everywhere). There is no broadcast, remote execution. Especially useful for particle emitters. As you can see in multiple examples, the emitters are often (always) created with createVehicleLocal and all commands about emitters are EL. That's because you don't create an object but a source of "pictures" evolving in time. Broadcasting that is a non-sense. Such code must run locally, never mind if all players don't see exactly the same effects. As 2nd rule, don't run everywhere the AG EG commands. You multiply the Effects! Just: if (isServer) then {playSound3D...}; As 3rd rule, if you want to execute a "foreign" sqf, try it on server only first (2nd rule). If the result is not OK, then... you must analyze it... or write your own code. More here for MP scripting. 2 Share this post Link to post Share on other sites
diehardfc 41 Posted April 29, 2021 @pierremgi, thank you so much for your comments and your insight. I'm always in awe of the breadth of knowledge of the Arma community and its willingness to share it. I sincerely appreciate your help! 1 Share this post Link to post Share on other sites