Jump to content
Sign in to follow this  
beedee

Scripted seat switching in CAR-class vehicles

Recommended Posts

I made my >car-class< BTR-80 APC swim via canFloat=1;, but AI car-drivers seem to be exceptionally hydrophobic. At first they enter the water without problems, but somewhen refuse to go either back or forth (sometimes just 30 meters off the shore).

This behaviour might be optimized to some degree by different config settings, but that does not hit the core problem:  

As changing seats is not implemented for car-class vehicles by default, I had to take care that the player as a gunner or cargo can never get stuck in the open sea as a sitting duck. Imagine: you can't switch to the driver position, you can't get out as you can't swim (and most frustrating of all, you can't even make that denier feel really, really sorry except by [F2]-[4]-[1] tounge_o.gif)...

My solution was to script and code the missing seat-switching actions for car-class vehicles. It works, but it is not 100% "waterproof" (nice wordplay!? smile_o.gif).

I defined these UserActions in the cfgVehicles-section:

Quote[/b] ] class UserActions

{

class SwitchDriver

{

displayName = $STR_ACTION_TO_DRIVER;

position = "pos cargo";

radius = 10;

condition = "player in this and !((player == driver this) or (speed this > 3))";

statement = "[this,1] exec {\BDE_btr80\BDE_btr80_action-switchposition.sqs}";

};

class SwitchCommander

{

displayName = $STR_ACTION_TO_COMMANDER;

position = "pos cargo";

radius = 10;

condition = "player in this and !((player == commander this) or (speed this > 25) or ((player == driver this) and (speed this > 3)))";

statement = "[this,2] exec {\BDE_btr80\BDE_btr80_action-switchposition.sqs}";

};

class SwitchGunner

{

displayName = $STR_ACTION_TO_GUNNER;

position = "pos cargo";

radius = 10;

condition = "player in this and !((player == gunner this) or (speed this > 25) or ((player == driver this) and (speed this > 3)))";

statement = "[this,3] exec {\BDE_btr80\BDE_btr80_action-switchposition.sqs}";

};

class SwitchCargo

{

displayName = $STR_ACTION_TO_CARGO;

position = "pos cargo";

radius = 10;

condition = "player in this and (speed this < 30) and (((player == driver this) and (speed this < 3)) or (player == commander this) or (player == gunner this))";

statement = "[this,4] exec {\BDE_btr80\BDE_btr80_action-switchposition.sqs}";

};

};

and BDE_btr80_action-switchposition.sqs:

Quote[/b] ]_btr = _this select 0

_to = _this select 1

?(player in _btr):_from = 4

?(player == driver _btr):_from = 1

?(player == commander _btr):_from = 2

?(player == gunner _btr):_from = 3

player action ["getout",_btr]

unassignVehicle player

?(_to == 1):_ai = driver _btr;_ai action ["getout",_btr];unassignVehicle _ai;player moveInDriver _btr;player assignAsDriver _btr;goto "aiback"

?(_to == 2):_ai = commander _btr;_ai action ["getout",_btr];unassignVehicle _ai;player moveInCommander _btr;player assignAsCommander _btr;goto "aiback"

?(_to == 3):_ai = gunner _btr;_ai action ["getout",_btr];unassignVehicle _ai;player moveInGunner _btr;player assignAsGunner _btr;goto "aiback"

?(_to == 4):player moveInCargo _btr;player assignAsCargo _btr

#aiback

?(_from == 1):_ai moveInDriver _btr;_ai assignAsDriver _btr;exit

?(_from == 2):_ai moveInCommander _btr;_ai assignAsCommander _btr;exit

?(_from == 3):_ai moveInGunner _btr;_ai assignAsGunner _btr;exit

?(_from == 4):_ai moveInCargo _btr;_ai assignAsCargo _btr;exit

exit

And here's my problem:

These actions should only be accessible by the player himself.

But under some circumstances you can even order AI soldiers in other BTRs from your group to perform these UserActions via 6-x-x . But the results are unpredictable then; seems as if "my" BTR and the second one get mixed up anywhere in the script or the config-conditions.

Second question, how could I modify the config-conditions so that a player with lower ranks can not switch to a seat occupied by a >human< player with higher ranks in a MP game?

Perhaps someone could find and fix the bugs here? (Be assured I've tried alot, but unsuccessful). Thank you!

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  

×