Jump to content
Sign in to follow this  
GunnDawg09

Spawn some ammo on a trigger

Recommended Posts

So I want to spawn some ammo and a few vehicles after a trigger has been activated. I know how to make the vehicles spawn with "createVehicle" but how would I go about creating an ammo crate as well?

Also an example code would be nice. Thanks :)

Share this post


Link to post
Share on other sites

ammo = "USBasicAmmunitionBox" createVehicle (position player);

If you wanted to change the ammo IN the box, say only have flares available for some reason, something like this:

ammo = "USBasicAmmunitionBox" createVehicle (position player); null = [ammo] execVM "ammo.sqf";

and ammo.sqf would be:

// Get the crate parameter given
_crate = _this select 0;

// Remove the stock items from the crate
clearMagazineCargo _crate;
clearWeaponCargo _crate;

// Add the items to the crate
_crate addMagazineCargo ["FlareGreen_M203", 25];
_crate addMagazineCargo ["FlareRed_M203", 25];
_crate addMagazineCargo ["FlareWhite_M203", 25];
_crate addMagazineCargo ["FlareYellow_M203", 25];

Edited by kylania

Share this post


Link to post
Share on other sites

You're welcome, check the edit too, I added how to change what's in the box.

Share this post


Link to post
Share on other sites

Ah very good,

---------- Post added at 10:06 PM ---------- Previous post was at 10:04 PM ----------

You're welcome, check the edit too, I added how to change what's in the box.

Lets say I didnt want it to spawn on the player, yet at a marker I made. Would this work:

_ammo = "USBasicAmmunitionBox" createVehicle (getMarkerPos "ammoDrop1");

ammoDrop1 being the marker I made.

Share this post


Link to post
Share on other sites

Again kylania thank you so much :) I am really starting to get the hang of this!

Share this post


Link to post
Share on other sites
Again kylania thank you so much :) I am really starting to get the hang of this!

To be honest, i believe in your mission will be nothing inside created/scripted by yourself. All is copy&paste from here by someone with much more patience ;).

Share this post


Link to post
Share on other sites
To be honest, i believe in your mission will be nothing inside created/scripted by yourself. All is copy&paste from here by someone with much more patience ;).

Actually that is pretty much 100% untrue, As I have revamped all of my own scripts by my self. But thanks anyways.

Share this post


Link to post
Share on other sites

Gunn's come a long way :) I'm eagerly awaiting to see what mission he's making. Some of the features he's asking about sound neat.

Share this post


Link to post
Share on other sites

Kylania, its near complete. Here is a run down of how this mission plays out.

You spawn as a group of insurgents a bit north of a USMC occupied airbase. The ultimate goal is to seize control of Gorka from the USMC. However, you will need more advanced weapons and equipment to do this. So the first objective is to take the airbase from the USMC which will then spawn USMC ammo crates, vehicles, and air vehicles.

So once the airbase is captured you have then gained access to more advanced equipment, to aide you in the assault on Gorka. Once gorka is seized then you win the mission. But the battle for Gorka is going to be a tricky one, hence why you need more advanced equipment and weapons than your standard insurgent AK-47's :)

All I have left to do is set up the USMC positions in gorka and figure out what I want in there, and how that is going to be laid out. But so far the airbase objective is done and works 100% :)

Share this post


Link to post
Share on other sites
works 100% :)

So you can test things by yourself... whatd'ya know...

Share this post


Link to post
Share on other sites
So you can test things by yourself... whatd'ya know...

Didnt realise he actually said that, you must be trying to read between the lines... :rolleyes:

Give people credit for christ sake will ya?

Well done Gunn, looking forward to playing mission once its finished mate, sounds like ALOT of work has gone into it.

Share this post


Link to post
Share on other sites

I was merely surprised that is all. And I doubt I'm the only one ;)

Share this post


Link to post
Share on other sites

What about adding things like binoculars? How do you do that?

Edited by Merad

Share this post


Link to post
Share on other sites
To be honest, i believe in your mission will be nothing inside created/scripted by yourself. All is copy&paste from here by someone with much more patience ;).

I am guilty of this :(

BUT, to my defense I am getting to understand how everything is working, I just don't know the syntax for the script 99% of the time.

Kylania has been instrumental in this and has my thanks again :)

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  

×