Jump to content
Sign in to follow this  
Kydoimos

Spawned Units and Commands

Recommended Posts

Not sure if this is a bug or not, but I can't seem to check for vehicles after they have been spawned. For example:

Varsuk_A = createVehicle ["O_MBT_02_cannon_F", (getMarkerPos "Varsuk_A"), [], 0, "NONE"];

Spawns the vehicle, but this trigger condition fails when the Varsuk is disabled: ! canMove Varsuk_A;

Also, setCaptive doesn't work on spawned vehicles - am I missing something? :)

---------- Post added at 18:17 ---------- Previous post was at 18:15 ----------

Never mind. I'm an idiot - its fine. However, new question, how does one setCaptive on a spawned UAV? I can't get that to work!

Share this post


Link to post
Share on other sites

You would have to set the UAV createUnit return value as global or use setVehicleVarName or even get/set variable, I think. Of course assuming that you are in a scripting environment :p.

Edited by JShock

Share this post


Link to post
Share on other sites

Thanks JShock - here's what's not working:

AAF_Darter_A = createVehicle ["I_UAV_01_F", (getMarkerPos "Darter_A"), [], 0, "FLY"];

AAF_Darter_A setDir -120;

createVehicleCrew AAF_Darter_A;

AAF_Darter_A doMove getMarkerPos "Darter_A_WayPoint_A";

AAF_Darter_A setCaptive true;

All the other commands, except the setCaptive work fine...?

Share this post


Link to post
Share on other sites

Maybe you need to apply the setCaptive on the crew and not the vehicle?

Share this post


Link to post
Share on other sites
Maybe you need to apply the setCaptive on the crew and not the vehicle?

Was just about to say that too. :P

Share this post


Link to post
Share on other sites

Odd, I'm sure I tried that: crew AAF_Darter_A setCaptive true; right? Still can't get it to work :p

---------- Post added at 19:39 ---------- Previous post was at 19:37 ----------

Ah, no, hang about - that doesn't look right! Maybe that's where I'm going wrong!

---------- Post added at 19:45 ---------- Previous post was at 19:39 ----------

Weird, seems to be working now with simple setCaptive - sorry guys - I'll give it another bash! Thanks as always for your responses!

Share this post


Link to post
Share on other sites

Could also try setting the vehiclevarname

Varsuk = createVehicle ["O_MBT_02_cannon_F", (getMarkerPos "Varsuk_A"), [], 0, "NONE"];
Varsuk setVehicleVarName "Varsuk_A";

Share this post


Link to post
Share on other sites
Try this:

{
_x setCaptive true;
} forEach crew AAF_Darter_A;

Yes, didn't look it up but "crew vehicle" should return an array while setCaptive expects an object as first parameter.

Share this post


Link to post
Share on other sites

Thanks guys! Got it all working, cheers! very helpful! :)

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  

×