Jump to content
Sign in to follow this  
Gloopy

createvehicle custom crate

Recommended Posts

Hi Guys,

sure this is pretty simple but can't get it going.

I'm using <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">javelin = "SpecialBoxWest" createVehicle (getpos javspawn) to spawn an ammo crate, then i have a custom crate script I want to run on the spawned object.

I tried adding "javelin exec "crate1.sqs"" after the spawn code but it's giving me a select error.

Crate Script:

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

; Custom crate script for Armed Assault

; Created with ArmA Edit - Version 1.2.8500

; HELP: Run this script from the INITIALIZATION box of the crate.

; CODE: [this] exec "crate1.sqs"

; ****************************************************************

; Get the crate parameter given

_crate = javelin select 1

; Remove the stock items from the crate

clearMagazineCargo _crate

clearWeaponCargo _crate

; Add the items to the crate

_crate addMagazineCargo ["JAVELIN", 2]

Exit

Also if anyone happens to know, the countdown timer on the trigger doesn't work, it spawns instantly.

Thanks

-Gloopy biggrin_o.gif

Share this post


Link to post
Share on other sites

You could do this two ways. First, to use your separate script do the following:

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

javelin = "SpecialBoxWest" createVehicle (getpos javspawn);

javelin setVehicleInit "[this] exec ""crate1.sqs""";

processInitCommands;

And fix your crate script to read as follows:

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

; ****************************************************************

; Custom crate script for Armed Assault

; Created with ArmA Edit - Version 1.2.9500

; HELP: Run this script from the INITIALIZATION box of the crate.

; CODE: [this] exec "crate1.sqs"

; ****************************************************************

; 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 ["JAVELIN", 2]

Exit

OR you could just do it all inline, without the extra script:

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

javelin = "SpecialBoxWest" createVehicle (getpos javspawn);

clearMagazineCargo javelin;

clearWeaponCargo javelin;

javelin addMagazineCargo ["JAVELIN", 2];

As for the countdown timer, how exactly is this trigger triggered? If it's a say, BLUFOR present the timer will work, but radio commands are instant, even if set to a time out.

To get around this, add in a delay to your script:

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

sleep 5; // wait 5 seconds after triggering radio trigger.

javelin = "SpecialBoxWest" createVehicle (getpos javspawn);

javelin setVehicleInit "[this] exec ""crate1.sqs""";

processInitCommands;

Share this post


Link to post
Share on other sites

Awsome, thanks very much I will try it out!

-Gloopy

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  

×