Jump to content
Sign in to follow this  
kremator

How to turn an array element into a location?

Recommended Posts

Hi guys,

 

Need a little help here, as I initially thought this would be easy for me to figure out ... but wasn't!  Here is my issue.

 

I have a medic in my team and I send all my group to a location using a doMove command.  I then extract WHERE the team were going using expectedDestination.  Now, one of my team gets hit and needs a medic, so I then give the medic a doMove to the injured, and the injured resumes his route again - all is fine.

 

However here is the problem.  When I now try to grab the original medic move order via a setVariable/getVariable combo it isnt happy.  What is wrong with my code ?

 

_medicdest =expectedtDestination _medic;

_medic setVariable ["medicdest", _medicdest select 0, true];

 

blah blah - medic given a doMove

 

_medic setDestination [medicdest, "LEADER PLANNED", TRUE];

 

However this gives me Error position: Type Array, expected Object,Location

 

QUESTION - how can I convert medicdest into a location that will be accepted into a doMove or a setDestination please?

Share this post


Link to post
Share on other sites

setDestination expects location as the first parameter, but you're giving it the _medicdest  array. ( [Position, planningMode, forceReplan] )

So either use:

_medic setDestination _medicdest;

or

_medic setDestination [_medicdest select 0, "LEADER PLANNED", TRUE];

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  

×