Jump to content
Sign in to follow this  
alleycat

Simplest way to create ambient explosions?

Recommended Posts

What is the most simple way to spawn any type of artillery munition and have it explode on the spot? Not looking for complex scripts that have any user control, just trying to create some ambient explosions.

Share this post


Link to post
Share on other sites
bomb = "Sh_125_HE" createVehicle (getmarkerpos "markername");

that will create a 125HE shell at specified marker.

Share this post


Link to post
Share on other sites

Just to expand on that a bit.

_loc = getMarkerPos "markername";
		_dir = random 360;
		_dist = random 150;
		_posX = (_loc select 0) + sin (_dir) * _dist;
		_posY = (_loc select 1) + cos (_dir) * _dist;
	_spawnPos = [_posX, _posY, 50];
// optional sleep
sleep (random 10);
bomb = "Sh_125_HE" createVehicle _spawnPos;

This will/should select a location 50m in the air, at a random location within 150m from the specified location. It will also wait a random amount of time up to 10 seconds to spawn.

Obviously, this is for a situation where you don't need it EXACTLY on the spot. :)

Share this post


Link to post
Share on other sites

i've gave this a shot but i am not very proficient in scripting matters;

i have a trigger with blufor detected by opfor, in activation i have:

this exec "mortar.sqf"

I have this as mortar.sqf:

_loc = getMarkerPos "mortar";

_dir = random 360;

_dist = random 150;

_posX = (_loc select 0) + sin (_dir) * _dist;

_posY = (_loc select 1) + cos (_dir) * _dist;

_spawnPos = [_posX, _posY, 50];

// optional sleep

sleep (random 5);

bomb = "Sh_125_HE" createVehicle _spawnPos;

and when i put a blufor soldier right infront of the opfor.. nothing.

Share this post


Link to post
Share on other sites

To test it, you may want to have the presence of blufor/opfor in the trigger.

Also, did you place the marker near the trigger, and named it "mortar" (without the quotes)? :)

Share this post


Link to post
Share on other sites

excellent, turns out i had the trigger set up wrong. what about the script looping?

Share this post


Link to post
Share on other sites

How many times do you want to loop it? Or do you want it to keep looping as long as the player is in a certain location?

Share this post


Link to post
Share on other sites

i want it to continue looping until they leave the trigger area, i tried putting the trigger on repeatedly and tried countdown but that doesent seem to work

Share this post


Link to post
Share on other sites

Ah, ok. I believe there are different ways to do this, but I haven't actually done it. :) I would look at something like a while/do loop.

In your mortar.sqf:

_tlist = list _triggerOne;   // where _triggerOne is the name of your trigger
while {(count _tlist) > 0} do
{
// put the body of your mortar.sqf here

sleep (random 5);   // sleeps a short period of time up to 5 seconds
_tlist = list _triggerOne;   // where _triggerOne is the name of your trigger
};

What this does (I would think) is keep track of how many units are activating the list. If there are none, the script stops, which should stop the mortars.

Hope this helps.

Share this post


Link to post
Share on other sites

farside, could you show me what you put in the mortar.sqf and in the trigger?

I have done everything you say but still can't get it to work, i know i'm doing something wrong because i'm a idiot when it comes to scripting please someone help me out here! :)

Regards astast

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  

×