Jump to content
Sign in to follow this  
VictorFarbau

"assignedVehicleRole" result seems permanent

Recommended Posts

One day I'm gonna tear this game a new one tounge2.gif

To finalize my latest project I need to know whether a unit is mounted in any vehicle. I thought I'd use the "assignedVehicleRole" command for that. Initially all units return a [] when queried. Once I have them mount a truck it changes to ["Cargo"] e.g. which is fine. But this status is not being reset to [] after having left the vehicle - actually it seems it's never being reset to [] after that and the unit keeps that status forever or unless assigned to a new role.

Jeez it's soo tiresome to work around all these behaviours confused_o.gif Does anybody have an idea how to query the correct "mount status" of a unit?

Thanks,

VictorFarbau

Share this post


Link to post
Share on other sites

store this into array, attach EH getout to the unit and clean the array once its triggered

Share this post


Link to post
Share on other sites

Are you trying to find out if a unit is mounted?

if (_uniit == vehicle _unit) then

{

hint format["_unit is still mounted: %1", (_uniit == vehicle _unit)];

};

--Ben

Share this post


Link to post
Share on other sites

VF, how do you unmount the soldiers?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unitName] orderGetIn false;

unAssignVehicle unitName;

or

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

unitName action ["getout",vehName];

?

In the above cases I think the array goes empty, altough not  tested. Basicly the unAssignVehicle function makes that work.

Share this post


Link to post
Share on other sites

Ok, so I understand that this command is simply not what I need.

@Sickboy: I am not controlling any player here - I am only allowed to check whether he's mounted or not. But you're right about that "unassignVehicle" command. If I use that on units from within a script then the assigned vehicle role is reset to [] indeed. A simple "disembark" command from within the game is not enough. I guess it has to do with the AI engine where units are controlled by simple "mount" and "unmount" commands (when using WP e.g.).

@benreeper: that simple (_unit == vehicle _unit) bool is working fine, I'll go for this one thumbs-up.gif

Thanks,

VictorFarbau

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  

×