mokeyii 10 Posted May 29, 2015 (edited) Hey guys... So I'm in a predicament. I'm trying to attach a Flare to a smoke grenade to create an incendiary grenade... This is what I have so far. We got the damage to work, but can't get the flare to attach to. I've just removed it for now. We've tried attachto to attempt to get the flare to work and I seem to be doing it wrong. Can Anyone help? private ["_damageRadius"]; burnDamage = { switch (true) do // Check if condition is met { case(_damageRadius < 2): // 2.5m {player setDamage (damage player + 0.15); // 15 damage per tick sleep 0.5; // 0.5s Timer damage is assigned "seconds" }; case(_damageRadius < 4): {player setDamage (damage player + 0.10); // 10 damage per tick sleep 1; // 1s Timer damage is assigned "seconds" }; case(_damageRadius < 8): {player setDamage (damage player + 0.05); // 5 damage per tick sleep 2; // 2s Timer damage is assigned "seconds" }; }; }; player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); }; }]; While{true} do{ waituntil{ _smokeShell = nearestObject [getPosATL player, "SmokeShellOrange"]; _curPlayerInvulnState = player getVariable ["isAdminInvulnerable", false]; _damageRadius = (_smokeShell distance player); _damageRadius < 8 && velocity _smokeShell isEqualTo [ 0, 0, 0 ] && !_curPlayerInvulnState }; call burnDamage; }; This isn't all my work, CreamPie from A3W has helped me tremendously. Edited May 29, 2015 by MokeyII Share this post Link to post Share on other sites
austin_medic 109 Posted May 29, 2015 Hey guys... So I'm in a predicament. I'm trying to attach a Flare to a smoke grenade to create an incendiary grenade... This is what I have so far. We got the damage to work, but can't get the flare to attach to. I've just removed it for now.We've tried attachto to attempt to get the flare to work and I seem to be doing it wrong. Can Anyone help? private ["_damageRadius"]; burnDamage = { switch (true) do // Check if condition is met { case(_damageRadius < 2): // 2.5m {player setDamage (damage player + 0.15); // 15 damage per tick sleep 0.5; // 0.5s Timer damage is assigned "seconds" }; case(_damageRadius < 4): {player setDamage (damage player + 0.10); // 10 damage per tick sleep 1; // 1s Timer damage is assigned "seconds" }; case(_damageRadius < 8): {player setDamage (damage player + 0.05); // 5 damage per tick sleep 2; // 2s Timer damage is assigned "seconds" }; }; }; player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); }; }]; While{true} do{ waituntil{ _smokeShell = nearestObject [getPosATL player, "SmokeShellOrange"]; _curPlayerInvulnState = player getVariable ["isAdminInvulnerable", false]; _damageRadius = (_smokeShell distance player); _damageRadius < 8 && velocity _smokeShell isEqualTo [ 0, 0, 0 ] && !_curPlayerInvulnState }; call burnDamage; }; This isn't all my work, CreamPie from A3W has helped me tremendously. I've struggled greatly trying to attach things to flares, or the other way around, but it just doesn't seem to be possible as it never bothers attaching it.... You could alternatively spawn a #lightpoint then attach it to the smoke grenade, and it would have a similar effect if you made a simple loop that changes the brightness randomly. Share this post Link to post Share on other sites
mokeyii 10 Posted May 29, 2015 UPDATE! This is what I have now: private ["_damageRadius", "_smokeShell", "_grenadeObj", "_flare1"]; burnDamage = { switch (true) do // Check if condition is met { case(_damageRadius < 2): // 2.5m {player setDamage (damage player + 0.15); // 15 damage per tick sleep 0.5; // 0.5s Timer damage is assigned "seconds" }; case(_damageRadius < 4): {player setDamage (damage player + 0.10); // 10 damage per tick sleep 1; // 1s Timer damage is assigned "seconds" }; case(_damageRadius < 8): {player setDamage (damage player + 0.05); // 5 damage per tick sleep 2; // 2s Timer damage is assigned "seconds" }; }; }; player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); _flare1= "F_40mm_White" createVehicle getPos _grenadeObj; _flare1 attachTo [_grenadeObj,[0,0,0]]; }; }]; While{true} do{ waituntil{ _smokeShell = nearestObject [getPosATL player, "SmokeShellOrange"]; _curPlayerInvulnState = player getVariable ["isAdminInvulnerable", false]; _damageRadius = (_smokeShell distance player); _damageRadius < 8 && velocity _smokeShell isEqualTo [ 0, 0, 0 ] && !_curPlayerInvulnState }; call burnDamage; }; Soo with this, the flare does create, however it floats in the air upon release of grenade and is unlit. ---------- Post added at 10:04 ---------- Previous post was at 09:43 ---------- @austin_medic How exactly do I incorporate that into it. ---------- Post added at 10:52 ---------- Previous post was at 10:04 ---------- private ["_damageRadius", "_smokeShell", "_grenadeObj", "_flare1"]; burnDamage = { switch (true) do // Check if condition is met { case(_damageRadius < 2): // 2.5m {player setDamage (damage player + 0.15); // 15 damage per tick sleep 0.5; // 0.5s Timer damage is assigned "seconds" }; case(_damageRadius < 4): {player setDamage (damage player + 0.10); // 10 damage per tick sleep 1; // 1s Timer damage is assigned "seconds" }; case(_damageRadius < 8): {player setDamage (damage player + 0.05); // 5 damage per tick sleep 2; // 2s Timer damage is assigned "seconds" }; }; }; player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); _flare1= createVehicle ["F_40mm_White" ,_getPosGrenade select 0,_getPosGrenade select 1,_getPosGrenade select 2,[],0,"FLY"]; _flare1 attachTo _grenadeObj; }; }]; While{true} do{ waituntil{ _smokeShell = nearestObject [getPosATL player, "SmokeShellOrange"]; _curPlayerInvulnState = player getVariable ["isAdminInvulnerable", false]; _damageRadius = (_smokeShell distance player); _damageRadius < 8 && velocity _smokeShell isEqualTo [ 0, 0, 0 ] && !_curPlayerInvulnState }; call burnDamage; }; OK I've litterally tried everything I can think of. I got a light point to work... however it just lights up my screen when the grenade is released and never returns. So the light point doesn't attach to the grenade. Any other Ideas? Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted May 29, 2015 As far as I know you can't attach anything to bullets or fired ammunition. Share this post Link to post Share on other sites
austin_medic 109 Posted May 29, 2015 As far as I know you can't attach anything to bullets or fired ammunition. DreadedEntity I believe was able to attach bunnies and cars to bullets, those aren't a problem, but flares are, possibly because of a physX bug with them (when they hit the ground the Z vector goes crazy and flucuates between like 2 billion and negative 2 billion until it burns out and gets deleted, visually you just see it 'bouncing' in the same spot). Share this post Link to post Share on other sites
bull_a 44 Posted May 29, 2015 (edited) I believe that when you are creating the flare using the createVehicle command, you have the wrong syntax (reference the position parameter), it needs to be wrapped in brackets as you are passing and extra 2 arguments to the command. Correct me if im wrong but local variable _getPosGrenade has not been defined anywhere. This is how I think it should be: _flare1= createVehicle ["F_40mm_White" ,(getPos _grenadeObj),[],0,"FLY"]; Try the above change first, and if that still does not work, try the code below. try doing something like this // For if you can attach objects directly to projectiles player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); _flare1= createVehicle ["F_40mm_White" ,(getpos _grenadeObj),[],0,"FLY"]; _flare1 attachTo [_grenadeObj]; }; }]; // For if you cannot attach objects directly to projectiles player addEventHandler ["Fired", { _grenadeObj = objNull; _projectileLogic = objNull; _flare1 = objNull; if ((_this select 4) isEqualTo "SmokeShellOrange") then { _grenadeObj = (_this select 6); _flare1= createVehicle ["F_40mm_White" ,(getpos _grenadeObj),[],0,"FLY"]; _projectileLogic = (createGroup sideLogic) createUnit ["Logic",(getpos _grenadeObj),[],0,"NONE"]; _flare1 attachTo [_projectileLogic]; }; // Creates position update loop while {!(isNull _grenadeObj)} do { _position = getposVisual _grenadeObj; _projectileLogic setPos _position; sleep 0.01; }; // Deletes the flare and logic if !(isNull _flare1) then {deleteVehicle _flare1}; if !(isNull _projectileLogic) then {deleteVehicle _projectileLogic}; }]; hope this helps Edited May 29, 2015 by Bull_A Share this post Link to post Share on other sites
Larrow 2822 Posted May 30, 2015 (edited) Do you want it just for the light? Can you not just add the light to the grenade? player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _firedObj = (_this select 6); _light = "#lightpoint" createVehicle ( getPosATL _firedObj ) ; _light setLightBrightness 1.0; _light setLightAmbient [1.0, 0, 0]; _light setLightUseFlare true; _light setLightFlareSize 2; _light setLightFlareMaxDistance 60; _light setLightColor [1, 0, 0]; _light lightAttachObject [_firedObj, [ 0, 0, 0 ]]; }; }]; Maybe need to play with the values. Throw loads of other shit in there just for the hell of it :/ couldnt find the big fire i know theres one there somewhere player addEventHandler ["Fired", { if ((_this select 4) isEqualTo "SmokeShellOrange") then { _firedObj = (_this select 6); _light = "#lightpoint" createVehicle ( getPosATL _firedObj ) ; _bright = 1; _light setLightBrightness 1.0; _light setLightAmbient [1.0, 0, 0]; _light setLightUseFlare true; _light setLightFlareSize 2; _light setLightFlareMaxDistance 60; _light setLightColor [1, 0, 0]; _light lightAttachObject [_firedObj, [ 0, 0, 0 ]]; _thread = [ _light, _bright, _firedObj ] spawn { _light = _this select 0; _bright = _this select 1; _obj = _this select 2; _effects = _obj spawn { waitUntil { vectorMagnitude ( velocity _this ) < 0.2 }; _emitter1 = "#particlesource" createVehicleLocal ( getPosATL _this ); _emitter1 setParticleClass "ObjectDestructionFire1"; _emitter2 = "#particlesource" createVehicleLocal ( getPosATL _this ); _emitter2 setParticleClass "ExploAmmoFlash"; _this setVariable [ "emitters", [ _emitter1, _emitter2 ] ]; }; waitUntil { sleep 0.1; _bright = ( _bright + (( random 0.4 ) - 0.2 ) ) max 0.5 ; _light setLightBrightness ( _bright ) ; _light setLightColor [ _bright, _bright min 0.5, 0 ]; _light setLightAmbient [ _bright, _bright min 0.2, 0]; isNull _Obj }; for "_i" from _bright to 0 step -0.05 do { _light setLightBrightness _i; sleep 0.1; }; deleteVehicle _light; { deleteVehicle _x; }forEach ( _obj getVariable "emitters" ) ; }; }; }]; Edited May 30, 2015 by Larrow 1 Share this post Link to post Share on other sites
mokeyii 10 Posted May 31, 2015 I'm coming to realization that this is impossible. I've tried everything from above and nothing happens.... grrr I guess this is another project tossed in the trash :( Share this post Link to post Share on other sites