Here is a shortcut from using format, which can be a bit fiddly:
hint str [_a_variable_you_need_to_check, _othervalue, andAnother];
Yeah, sorry, when you accept code fragments, you have to assume I can't type properly and I haven't tested it ;P There were several other problems with the script though, which is why it still won't work; I was just pushing you in the right direction, not doing it all for you.
However, something I did double-check is that the speed of a grenade doesn't always go below 0.1mps, so 0.5mps seems like a better minimum speed:
waitUntil { ((velocity _shell) distance [0, 0, 0]) < 0.5 };
EDIT: OK, I relented!
// Run this from init.sqf with:
// [] execVM "smoke_init.sqf"
if (isServer && (isNull player)) exitWith {}; // Don't run anything on dedicated server
// Precompile functions.
glt_smoker = compile preprocessFileLineNumbers "smoker.sqf";
glt_smoker_updater = compile preprocessFileLineNumbers "smoker_updater.sqf";
// Wait until dedicated clients have spawned the player object.
waitUntil { alive player };
// Do something every time the local player fires.
player addEventHandler ["FIRED", glt_smoker];
// Be informed every time a non-local player throws smoke.
"glt_smoker_position" addPublicVariableEventHandler
{
(_this select 1) spawn glt_smoker_updater;
};
_unit = _this select 0;
_ammoClass = _this select 4;
if (_ammoClass == "SmokeShell") then
{
_shell = nearestObject [_unit, _ammoClass];
[_shell] spawn
{
_shell = _this select 0;
// Wait until the grenade comes to a standstill.
waitUntil { ((velocity _shell) distance [0, 0, 0]) < 0.5 };
// Tell all other machines to show smoke.
glt_smoker_position = [getPos _shell];
publicVariable "glt_smoker_position";
// Show smoke on the local machine.
glt_smoker_position spawn glt_smoker_updater;
deleteVehicle _shell;
};
};
Not sure what smoke effect you were trying to achieve, but there were several problems with the stuff you were trying to do. At least here you can move from something that does work:
_pos = _this select 0;
_particleSource = "#ParticleSource" createVehicleLocal _pos;
_particleSource setParticleRandom [0, [1, 1, 0], [0.54, 0.54, 0], 0, 0.25, [0, 0, 0, 0.2], 0, 0];
_logic = "Logic" createVehicleLocal _pos;
_logic setPos _pos;
_particleSource setParticleParams [
["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 8],
"", "Billboard", 1000, 15, [0, 0, 0], [0, 0, 0], 1, 12.75, 10, 2, [2, 4, 7],
[[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.8, 0.8, 0.8, 0.1]],
[0.5, 0.5, 0.5], 0, 0, "", "", _logic];
_particleSource setDropInterval 0.08;
// Keep the particles flowing for a while, but stop them after 60 seconds.
sleep 60;
deleteVehicle _particleSource;
deleteVehicle _logic;
NOTE: Tested in SP only, since I'm not currently using a PC that could run 2 clients without falling in a heap ;P Reasonably sure it would be fine in MP though (but I could be wrong).
EDIT: [] should have been ()...sorry