Jump to content
Sign in to follow this  
gunterlund

Determining if an object exists

Recommended Posts

Sorry if this is an old topic but Ive been digging through every forum I know and cant find a working script.

I have an invisible H that Im using to mark an IED. I want to random its existance with the probability of presence slider. Im using Jeeves IED script

If the H exists then it can detonate. If it doesnt then no detonation in the trigger.

I tried

_Object = this select 0 From his array.

?!(alive _Object) : goto exit

but it doesnt take me out. What do I do.

Share this post


Link to post
Share on other sites

When the object (invisible H) has not been created because of the probability of presence, then you have two possibilities to check this case:

In case you know the varibale name it should have (set in the mission editor in the field "name"):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(isNil "variablename") : goto "exit"

In case you only know a reference (_Object) that should point to this object:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(format["%1",_Object] == "scalar bool array string 0xe0ffffef") : goto "exit"

Share this post


Link to post
Share on other sites

Or try this small script launched from the trigger.

name the H/pad IED

in trigger call it like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Choose Ammo Type;

//_shelltype = "G_40mm_HE";

//_shelltype = "Grenade";

//_shelltype =  "G_Camel_HE";

//_shelltype =  "M_R73_AA";

//_shelltype =  "B_30mm_HE";

//_shelltype =  "B_25mm_HE";

//_shelltype =  "R_Hydra_HE";

//_shelltype =  "M_Sidewinder_AA";

//_shelltype = "Sh_105_HE";

//_shelltype =  "B_30mm_HE";

//_shelltype = "Sh_120_HE";

//_shelltype = "Sh_122_HE";

//_shelltype = "Sh_125_HE";

//_shelltype =  "R_S8T_AT"

//_shelltype =  "M_TOW_AT";

//_shelltype =  "M_AT5_AT";

//_shelltype = "Sh_120_SABOT";

//_shelltype = "bomb";

//_shelltype =  "M_Vikhr_AT";

//_shelltype =  "M_Hellfire_AT";

//_shelltype =  "M_Ch29_AT";

_shelltype = "Bo_GBU12_LGB";

IED = _this select 0;

_seek = random 10;

_xxpos = (getPos IED select 0);

_yypos = (getPos IED select 1);

_count = 0;

while{IED isKindOf "HeliHEmpty"} do

{

_count = _count + 1;

hint "It is here";

sleep 2;

//Get object position;

_exp = _shelltype createvehicle getpos IED;

_exp setPosAsl [(getPos _exp select 0),(getPos _exp select 1),(getPos _exp select 2)];

_veharray = [_xxpos,_yypos,0] nearObjects ["All", (100 + _seek)];

{_x setdammage ((getdammage _x) + 1)} forEach _veharray;

sleep 0.2;

deletevehicle IED;

if (not isnull IED) exitWith {hint "Over";};  

};

if (_count<1) exitWith {hint "Where is my IED";};

If the IED object is not present nothing happens.

EDIT; Jeeves script would'nt work with my original script so I changed it around so it will give the IED effect from within itself now.

EDIT AGAIN; I have now got it to work with Jeeves IED script so it is called the same as the trigger example above but the new script is

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">IED = _this select 0;

_count = 0;

sleep 1;

while{IED isKindOf "HeliHEmpty"} do

{

_count = _count + 1;

hint "It is here";

sleep 2;

[theCar, "Small"] exec "IED.sqs";

sleep 0.2;

deletevehicle IED;

if (not isnull IED) exitWith {hint "Over";};  

};

if (_count<1) exitWith {hint "Where is my IED";};

Both scripts work but the 1st example will only detonate from the H/pad. Hope one of them helps.

Odin

Share this post


Link to post
Share on other sites

Thanks all. Just reinforces how great this community is by how fast you all responded to my plea. Dengis solution worked for me but all the extra notes just helps everyone. You guys are the best. yay.gif

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  

×