Jump to content
Sign in to follow this  
mycatsaid

setDir with createvehicle (Spawning a radio box)

Recommended Posts

I'm trying to spawn an radio box on a marker position and then turn it to match the direction of the other ammobox that is already on the map.

I've tried it with just the standard setdir and that didn't work either.

_boxcreate = createVehicle ["ACRE_RadioBox", getMarkerPos "acreradio", [], 0, "NONE"];
_box = _boxcreate select 0;
_boxDir = getDir ammobox;
_box setDir _boxDir;

Any help would be appreciated. Thanks!

Edited by mycatsaid

Share this post


Link to post
Share on other sites
I'm trying to spawn an radio box on a marker position and then turn it to match the direction of the other ammobox that is already on the map.

I've tried it with just the standard setdir and that didn't work either.

_boxcreate = createVehicle ["ACRE_RadioBox", getMarkerPos "acreradio", [], 0, "NONE"];
_box = _boxcreate select 0;
_boxDir = getDir ammobox;
_box setDir _boxDir;

Any help would be appreciated. Thanks!

The CreateVehicle command returns the object it has created, and not an array containing this element, therefor "Select 0" on an array that isn't there won't work.

Try this:

_boxcreate = createVehicle ["ACRE_RadioBox", getMarkerPos "acreradio", [], 0, "NONE"];
_boxDir = getDir ammobox; // Assuming the box that you want to get the direction from is called "ammobox"
_boxcreate setDir _boxDir;  // Though effects of this command remain local, you can do a setPos afterwards to synchronize the direction on all machines in MP, setDir for player object doesn't require this.
_boxcreate setpos (getpos _boxcreate);

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  

×