Jump to content
Sign in to follow this  
Killy_McMurder

Objects spawned from a crate

Recommended Posts

I'm trying to put together a simple script that creates a given object from a crate placed in a mission. I've added an action to a crate that calls the specific script but after choosing the action nothing happens. The script i've put together looks like:

_crate = this;
_pos = position _crate;

_camo1 = "LAND_CAMONET_NATO" createVehicle [(_pos select 0),(_pos select 1),(_pos select 2)];
_camo1 setPosATL [((_pos select 0) 1),((_pos select 1) 1),(0)];
hint "DEBUG - I'M WORKING";

I added the hint at the end just as confirmation but i don't even get that, and needless to say nothing spawns!

I'm just learning scripting at the minute so i'm not even sure if i'm going in the right direction.

Anyone have any ideas what i should be doing here?

-Killy

Share this post


Link to post
Share on other sites

try this

_crate = _this;
_pos = position _crate;

_camo1 = "LAND_CAMONET_NATO" createVehicle [(_pos select 0),(_pos select 1),(_pos select 2)];
_camo1 setPosATL [((_pos select 0) 1),((_pos select 1) 1),(0)];
hint "DEBUG - I'M WORKING";

Share this post


Link to post
Share on other sites

Put this in the init crate field:

act = this addAction ["Act_Name","Script_Name.sqf"];

Script_Name.sqf:

_crate = _this select 0;
_pos_crate = getpos _crate;
_camo1 = "LAND_CAMONET_NATO" createVehicle [(_pos_crate select 0),(_pos_crate select 1),(_pos_crate select 2)];

Share this post


Link to post
Share on other sites
Put this in the init crate field:

act = this addAction ["Act_Name","Script_Name.sqf"];

Script_Name.sqf:

_crate = _this select 0;
_pos_crate = getpos _crate;
_camo1 = "LAND_CAMONET_NATO" createVehicle [(_pos_crate select 0),(_pos_crate select 1),(_pos_crate select 2)];

Thanks guys, got it working!

Now i just need to setDir the object i'm spawning and remove the action so it doesn't spawn more than 1...

tried this but i know its got to be a bit more complicated:

_crate = _this select 0;
_pos_crate = getpos _crate;


_camo1 = "LAND_CAMONET_NATO" createVehicle [(_pos_crate select 0),(_pos_crate select 1),(_pos_crate select 2)];
_camo1 setPosATL [((_pos_crate select 0) 0),((_pos_crate select 1) 0),(0)];
_camo1 setDir [getDir _crate select 0, getDir _crate select 1];
_crate removeAction "Unpack Camo Net";

Or i'm probably just missing something blindingly obvious and simple again!

Learning's fun!

Edited by Killy_McMurder
I'm stupid

Share this post


Link to post
Share on other sites

removeaction can only be the id number given to that action

_host = _this select 0;
_caller = _this select 1;
_id = _this select 2;

so in your addaction script _this select 2 is the id.

Share this post


Link to post
Share on other sites
removeaction can only be the id number given to that action

_host = _this select 0;
_caller = _this select 1;
_id = _this select 2;

so in your addaction script _this select 2 is the id.

Yes!:)

_crate removeAction _id;

And setDir is a number value, but only one, not two ;)

_camo1 setDir (getDir _crate);

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  

×