Jump to content
Sign in to follow this  
wickedstigma

Missiles, IEDs and Menus

Recommended Posts

Hi again everyone! I made a radio activated trigger which enables me to create a marker with my player and then another trigger which lets me blow the IED where the created marker is. Im trying to make it as reallistic as possible so I tried, the entire day..... literally, to do the following stuff:

1. Spawn a missile or other explosive munition to simulate the IED. I found an IED pack to download that will solve this problem but for some reason the links, every link, to the pack is broken. Even though the grave looks nice for the IED placement, how can I spawn the missile or whatever without blowing myself 50+ feet in the air?

// Set IED Code 
markerstr = createMarker["markername",player]; 
markerstr setMarkerShape "ICON";  
"markername" setMarkerType "Destroy"; 
"markername" setMarkerSize [1,1];  
iedTexture = "Grave" createVehicleLocal (getMarkerPos "markername");

//Detonate IED Code 

_ied = "BO_GBU12_LGB" createVehicle (getMarkerPos "markername");deleteVehicle iedTexture; deleteMarker "markername"

2. I was able to spawn other objects on the marker but they always appeared somewhere near me, not in front of my like satchel charges do. I even tried setting the markerSize to [1,1] and it did the same thing. So how can I spawn it in the middle of the marker?

3. I tried a lot of things to add an item Menu to Set the IED. The item actually appeared in the menu but when I ran the preview and executed the action it didnt run the .sqf or .sqs. How can I make this work or is any other way around of adding this to the menu and executing code without using init.sqs or .sqf ?

//Add menu item

_action = man1 addAction ["Set IED","Set_IED.sqs"]

//I wrote the entire address of my .sqs in the real code so thats not the problem. 

//Set_IED.sqs code

markerstr = createMarker["markername",player]; 
markerstr setMarkerShape "ICON";  
"markername" setMarkerType "Destroy"; 
"markername" setMarkerSize [1,1];  
iedTexture = "Grave" createVehicleLocal (getMarkerPos "markername");

Thanks again for all the help!

Share this post


Link to post
Share on other sites

Doesn't createVehicle model to the world? In other words, it fits it in around anything already there (and if I read right, there's a grave there already?).

setPos doesn't model to the world, so right after the createVehicle command, try _ied setPos (getMarkerPos "markername") ? That'll spawn the bomb then immediately place it at exactly (getMarkerPos "markername").

(ofc, I could be talking out of my bottom and I may be completely wrong...)

Share this post


Link to post
Share on other sites
Doesn't createVehicle model to the world? In other words, it fits it in around anything already there (and if I read right, there's a grave there already?).

setPos doesn't model to the world, so right after the createVehicle command, try _ied setPos (getMarkerPos "markername") ? That'll spawn the bomb then immediately place it at exactly (getMarkerPos "markername").

(ofc, I could be talking out of my bottom and I may be completely wrong...)

Actually I am spawning the grave to simulate there is an IED buried there. The thing is that when the grave spawns it spawn around me about a meter or so behind me. First I want the object I decide to spawn as an IED appears right under me, like when you place satchel charges or C4 explosives, and second to know how to spawn a missile without blowing up, since when you spawn a missile it spawn coming down on an angle resulting in instant explosion.

Share this post


Link to post
Share on other sites

I think I'm with you.

The grave is being spawned away from you because CreateVehicle is modelling it to the world - ie, you. It won't put it inside you, instead it puts it in the first available space by the given co-ordinates... ie, next to you.

Using setpos immediately after CreateVehicle would put the grave directly where you are - but that may kill you because you'd be inside it.

Also you can't spawn the explosive yet, because as you've noticed, it'll kill you. Instead you need to create a trigger that detects units coming in and spawns a bomb on the IED's location. You could either put the bomb's creation in the on-activation field, or have the script pause until the trigger is activated.

Here's a very simple IED script I've been fiddling with:

/// **** Simple IED placement script.
///Places proximity-detonated IED at given location.
/// **** Arguments: nul = [Position, Trigger Range, Blast size] execvm "esd-ied1a.sqf";
/// **** Position: Pos Array. 
/// **** Trigger range: Radius of detection around device.
/// **** Blast size: 0: tiny, 1: Medium, 2: big, 3: huge.

_iedPos = _this select 0;
_iedRange = _this select 1;
_iedBl = _this select 2;

_OrdChoice = ["B_30mm_HE", "Bo_Mk82", "ARTY_Sh_122_HE", "Bo_GBU12_LGB"];
_iedOrd = _OrdChoice select _iedBl;

///hint "Ord selected";

/// **** Create trigger:

_trg=createTrigger["EmptyDetector",_iedPos];
_trg setTriggerArea[_iedRange,_iedRange,0,false];
_trg setTriggerActivation["WEST","PRESENT",true];
_trg setTriggerStatements["this", " ", " "];
_trg1=createTrigger["EmptyDetector",_iedPos];
_trg1 setTriggerArea[_iedRange,_iedRange,0,false];
_trg1 setTriggerActivation["EAST","PRESENT",true];
_trg1 setTriggerStatements["this", " ", " "];


///hint "Trigger created";
waituntil {((triggeractivated _trg) or (triggeractivated _trg1))};

sleep random 3;

_bomb = _iedOrd createvehicle _iedPos;
deleteVehicle _trg;
deletevehicle _trg1;

///hint "complete";

It only detects BLUFOR and OPFOR, and there's no IED object involved - just a location. So it can't be de-activated by the object being destroyed, nor does it put any markers on the map. It just marks an area as an IED and any BLUFOR or OPFOR that go within the trigger range set off a nice explosion.

I did try using an "any" trigger, but it seemed to be set off by the car I was putting it on, so instead I created a separate trigger for each team and then had the script wait until either trigger was activated - then it spawns the bomb and deletes the triggers.

Share this post


Link to post
Share on other sites

I tested the ied setPos (getMarkerPos "markername") and it worked, it puts the grave in underneath me. I tried to put the grave in front of me with getPosASL but it only works in one way, since Ill have to write more code just to detect the the direction the player is looking at to then determine if its going to use a positive or negative value.

Share this post


Link to post
Share on other sites

So you want something to spawn it just in front of the player, say, a meter away?

_StartingPos = getPos player;
_StartingDir = getdir player;
_DistanceFromCent = 1;

_theNewPos = [(_StartingPos select 0)+(sin _StartingDir)*_DistanceFromCent,(_StartingPos select 1)+(cos _StartingDir)*_DistanceFromCent,0];

If you want it closer or further than a meter, just change the value for _DistanceFromCent. _theNewPos is a position 1m in front of the player.

That what you were after?

Share this post


Link to post
Share on other sites
So you want something to spawn it just in front of the player, say, a meter away?

_StartingPos = getPos player;
_StartingDir = getdir player;
_DistanceFromCent = 1;

_theNewPos = [(_StartingPos select 0)+(sin _StartingDir)*_DistanceFromCent,(_StartingPos select 1)+(cos _StartingDir)*_DistanceFromCent,0];

If you want it closer or further than a meter, just change the value for _DistanceFromCent. _theNewPos is a position 1m in front of the player.

That what you were after?

Thanks. Ill try this tomorrow.

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  

×