Jump to content
Sign in to follow this  
farside

Bomb Effects

Recommended Posts

I've recently started a new project and part of it is a bomb.

I have the bomb in game, configed etc however I would like a script to run as soon as the bomb has hit the ground but I really don't know where to start.

looking for something like

_bomb1 setdamage 1

_bomb1 execVM "script.sqf"

or

_bomb1 getpos = 0

_bomb1 execVM "script.sqf"

how would i go around scripting this and implementing this into the addon so that the user would not have to use scripts in their mission?

Thanks guys.

(searched already though event handlers, bullet effects and various napalm scripts [these seems to spawn bombs below the plane, not really what I'm after])

Share this post


Link to post
Share on other sites

The only way I know (I'm poor with config stuff) is to add in the config of the weapon, that would fire the bomb (a bomb launcher;inside its cfgEventHandlers), "fired" eventhandler. Inside it put a code, that will track bomb's (a fired projectile) position until bomb is gone. Then you have last known position of the bomb, means point of explosion, and time of explosion (moment, when bomb is gone). With such data you probably could then to script anything you want at bomb's explosion.

Share this post


Link to post
Share on other sites

Ok so,

after much work and swearing i have kinda rigged together a script, now my scripting knowledge is less than average and now one of the scripts doesnt seem to want to execute, the damage script to be precise. so far I have:

//gooncorp

//2013

debug = true;

plane = (_this select 0);

// 190 138 256 // 130 198 245

ved = velocity plane;

_tracker = true;

_bullet = _this select 6;

_dir=getdir _bullet;

_planedir = getdir plane;

_oldpos = [];

//////

bombtype = "Bax_B53";// change this for different bomb

//////

if ((_this select 4) != bombtype) exitwith {};

if (debug) then {

player globalchat format ["%1", (_this select 0)];

};

publicvariable "plane";

if (debug) then {

player globalchat format ["%1 is bombtype", bombtype];

};

if (debug) then {

player globalchat "about to run";

};

//if (bombcount != 1 && bombcount != 2 && bombcount != 3 && bombcount != 4 || isnil bombcount) then {

//bombcount = 0;

//};

if (isnil ("bombcount")) then {bombcount=0;} ;

bombcount = bombcount + 1;

if (bombcount >= 5) then {

bombcount = 1;

};

if (debug) then {

player globalchat format ["bombcount is %1", bombcount];

};

if (bombcount == 1) exitwith {

while {not (isnull _bullet)} do { _oldpos = getposASL _bullet; sleep .01;};

"dynamicBlur" ppEffectEnable true;

"dynamicBlur" ppEffectAdjust [0.5];

"dynamicBlur" ppEffectCommit 1;

if (debug) then {

player globalchat "hit";};

globalpos = _oldpos;

glibilpos = _oldpos;

ylobalpos = _oldpos;

xlobalpos = _oldpos;

publicvariable "globalpos";

publicvariable "glibilpos";

publicvariable "ylobalpos";

publicvariable "xlobalpos";

publicvariable "ved";

dontrun = false;

sleep 0.05;

if (debug) then {

player globalchat format ["bombcount is %1", bombcount];};

[-2, {

[] spawn {

_pos = globalpos;

p = ved select 0;

z = ved select 1;

p = p / 5;

z = z / 5;

_velocity = [1, 1, 1];

_color = [.5, .2, 0];

_alpha = 1;

slight6 = "#lightpoint" createVehicleLocal [ _pos select 0, _pos select 1, 500];

slight6 setlightBrightness 100000.00;

slight6 setlightAmbient[1500, 1200, 1000];

slight6 setlightColor[1500, 1200, 1000];

_color = [1, 1, 1];

if (!isnull ps1) then { deletevehicle ps1;};

if (!isnull ps2) then { deletevehicle ps2;};

if (!isnull ps3) then { deletevehicle ps3;};

if (!isnull ps4) then { deletevehicle ps4;};

if (!isnull ps5) then { deletevehicle ps5;};

if (!isnull ps6) then { deletevehicle ps6;};

if (!isnull ps7) then { deletevehicle ps7;};

if (!isnull ps8) then { deletevehicle ps8;};

[] exec "damage.sqs";

//cone

ps1 = "#particlesource" createVehicleLocal _pos;

ps1 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 10, [0, 0, 0],

[0, 0, 0], 0, 1.275, 1, 0, [40,80], [[0.25, 0.25, 0.25, 0], [0.25, 0.25, 0.25, 0.5],

[0.25, 0.25, 0.25, 0.5], [0.25, 0.25, 0.25, 0.05], [0.25, 0.25, 0.25, 0]], [0.25], 0.1, 1, "", "", _obj];

ps1 setParticleRandom [2, [1, 1, 30], [1, 1, 30], 0, 0, [0, 0, 0, 0.1], 0, 0];

ps1 setParticleCircle [10, [-10, -10, 20]];

ps1 setDropInterval 0.005;

//_color = [.9, .2, 0];

//top

ps7 = "#particlesource" createVehicleLocal _pos;

ps7 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 112, 0], "", "Billboard", 1, 20, [0, 0, 100],

[0, 0, 25], 0, 1.7, 1, 0, [100,80,100], [[1, 1, 1, 0.5],[1, 1, 1, 0]], [0.07], 1, 1, "", "", _obj];

ps7 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];

ps7 setDropInterval .001;

//smoke

ps8 = "#particlesource" createVehicleLocal _pos;

ps8 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0],

[0, 0, 60], 0, 1.7, 1, 0, [40,15,120],

[[1, 1, 1, 0.4],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0]], [0.5, 0.1], 1, 1, "", "", _obj];

ps8 setParticleRandom [0, [10, 10, 15], [15, 15, 7], 0, 0, [0, 0, 0, 0], 0, 0, 360];

ps8 setDropInterval 0.002;

//wave

//_color = [.5, .2, 0];

gs3 = "#particlesource" createVehicleLocal _pos;

gs3 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 20, [0, 0, 0],

[0, 0, 0], 0, 1.5, 1, 0, [50, 100], [[0.1, 0.1, 0.1, 0.5],

[0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0.3], [1, 1, 1, 0]], [1,0.5], 0.1, 1, "", "", _obj];

gs3 setParticleRandom [2, [20, 20, 20], [5, 5, 0], 0, 0, [0, 0, 0, 0.1], 0, 0];

gs3 setParticleCircle [50, [-80, -80, 2.5]];

gs3 setDropInterval 0.0002;

//_color = [.3, .1, 0];

"colorCorrections" ppEffectEnable true;

"colorCorrections" ppEffectAdjust [0.8, 15, 0, [0.5, 0.5, 0.5, 0], [0.0, 0.0, 0.6, 2],[0.3, 0.3, 0.3, 0.1]];"colorCorrections" ppEffectCommit 0.4;

"dynamicBlur" ppEffectAdjust [0.5];

"dynamicBlur" ppEffectCommit 3;

0 setOvercast 0;

sleep 0.1;

_xHandle = []spawn

{

Sleep 4;

"colorCorrections" ppEffectAdjust [1.0, 0.5, 0, [0.5, 0.5, 0.5, 0], [1.0, 1.0, 0.8, 0.4],[0.3, 0.3, 0.3, 0.1]];

"colorCorrections" ppEffectCommit 7;

};

//*****

sleep 1.5;

"dynamicBlur" ppEffectAdjust [0.5];

"dynamicBlur" ppEffectCommit 1;

gs3 setDropInterval 0.001;

deletevehicle ps7;

sleep 5;

tp2 = "#particlesource" createVehicleLocal getpos _pos;

tp2 setParticleParams [["\Ca\Data\ParticleEffects\Universal \Universal", 16, 3, 48, 0], "", "Billboard", 1, 32, [0, 0, 420],

[0, 0, 50], 0, 1.7, 1, 0, [80,90,120], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];

tp2 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];

tp2 setDropInterval 0.002;

sleep 5;

deleteVehicle tp2;

sleep 2;

tp3 = "#particlesource" createVehicleLocal getpos _pos;

tp3 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 32, [0, 0, 700],

[0, 0, 42], 0, 1.7, 1, 0, [100,120,150], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];

tp3 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];

tp3 setDropInterval 0.001;

sleep 10;

deleteVehicle tp3;

sleep 20;

deleteVehicle ps8;

//*****

_i = 0;

while {_i < 100} do

{

slight6 setLightBrightness 100.0 - _i;

_i = _i + 1;

sleep 0.1;

};

deleteVehicle slight6;

"colorCorrections" ppEffectAdjust [1, 1, 0, [0.5, 0.5, 0.5, 0], [1.0, 1.0, 0.8, 0.4],[0.3, 0.3, 0.3, 0.1]];"colorCorrections" ppEffectCommit 1; "colorCorrections" ppEffectEnable TRUE;

"dynamicBlur" ppEffectAdjust [0];

"dynamicBlur" ppEffectCommit 1;

sleep 2;

deletevehicle ps1;

deletevehicle ps7;

deletevehicle ps8;

deletevehicle gs3;

};

}] call CBA_fnc_globalExecute;

};

As my initiation which links to:

Hint "executed"

_array = _pos nearObjects ["All", 250]

{_x setdammage ((getdammage _x) + 1.0)} forEach _array

_array = (nearestObjects [_pos,[], 100]) - ((getPos _pos) nearObjects 500)

{DeleteCollection _x} forEach _array

~5

_array = (nearestObjects [_pos,[], 200]) - ((getPos _pos) nearObjects 800)

{_x setdammage ((getdammage _x) + 1.0)} forEach _array

_array = _pos nearObjects ["All", 500]

{_x setdammage ((getdammage _x) + 0.3)} forEach _array

~5

_array = _pos nearObjects ["Man", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Land", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Ship", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Motorcycle", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Car", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Air", 700]

{_x setdammage ((getdammage _x) + 0.5)} forEach _array

_array = _pos nearObjects ["Tank", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Thing", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Static", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["Strategic", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

_array = _pos nearObjects ["NonStrategic", 700]

{_x setdammage ((getdammage _x) + 0.4)} forEach _array

radarea = "HeliHEmpty" createVehicle (position _pos);

[] exec "radzone.sqs"

exit

No-one dies or is even slightly injured. I put a hint "executed" at the start of the damage sqf and i receive that message but still no injuries.

Any help will be greatly appreciated.

(yes the scripts are pre-made by other authors, permissions and all credits will go to them on release.)

Edited by farside

Share this post


Link to post
Share on other sites

Solved it, added a

_destroy = createvehicle "HeliHEmpty" getpos _pos

[]= exec damage.sqs

then in damage.sqs changed all the names from _pos to _destroy.

the damage.sqs was trying to call on the _pos, i made it a fixed position so that the damage.sqs could start there.

Cheers anyway folks!

Mods can close this thread.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×