Jump to content
Sign in to follow this  
dimdic

scriping command to make units get in a vehicle

Recommended Posts

Which is the scripting command to make units get in a vehicle ?? (I found the command that make units get out of a vehicle (commandGetOut) but i can't find the one which makes them get in the vehicle ). Thank you.

Share this post


Link to post
Share on other sites

I used the commands allowGetIn and orderGetIn before writting this post but unfortunately they don't work !! the moveIn command works but it gets the units inside the vehilcle immediately without any animation so i don't like it. :S

First, assign them:

http://community.bistudio.com/wiki/assignAsDriver

Instant teleport inside:

http://community.bistudio.com/wiki/moveInDriver

I guess you could use this to have them run to the car and get inside, I've never tested it:

http://community.bistudio.com/wiki/orderGetIn

Make sure that you look under the "See also:" tab.

Share this post


Link to post
Share on other sites

unit action ["getInDriver", targetVehicle];

hur dur.

Share this post


Link to post
Share on other sites
unit action ["getInDriver", targetVehicle];

hur dur.

thank you a lot my friend. But "getInDriver" moves the unit instantly (with no animation) near the vehicle and then he boards. The units doesn't walk or run to the vehicle so it's far away from reality :S . I saw the command --> action ["MoveToCargo", vehicle player, 2] <-- but it doesn't work :S !!!!

Share this post


Link to post
Share on other sites

What cuel said

First, assign them:

http://community.bistudio.com/wiki/assignAsDriver

Instant teleport inside:

http://community.bistudio.com/wiki/moveInDriver

I guess you could use this to have them run to the car and get inside, I've never tested it:

http://community.bistudio.com/wiki/orderGetIn

Make sure that you look under the "See also:" tab.

man1 assignasdriver car1; [man1] orderGetIn true

Share this post


Link to post
Share on other sites
What cuel said

man1 assignasdriver car1; [man1] orderGetIn true

I just found out why these commands doesn't work to me. Because i am the leader of the units that i want them to get in a vehicle through a scripting command. If the leader of these units is not a player then the orderGetIn works fine.

Share this post


Link to post
Share on other sites

I have a similar problem where I have an ai named "s2" that respawns and is then teleported to "s1" leaders position. This works fine, but I have another script that checks if the leader is in a vehicle and if so - teleports the ai into the leaders vehicle, but as soon as the vehicle comes to a stop, the ai gets out and just stand there like duh. I want the ai to stay in the vehicle. I tried to assignAsCargo and orderGetIn "true", but the problem comes in that the vehicle could be any number of different vehicles - and most of the vehicles don't have names. So I need to check to find out what "vehicle s1" is, but I don't know how. It would be great if there was a "getVehicle s1" command, but there's not, and I don't know what the correct way would be move and ai into the cargo of what ever vehicle s1 is currently in.

s2 assignAsCargo (vehicle s1???);

[s2] orderGetIn true;

How would I script this to work correctly?

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites
but the problem comes in that the vehicle could be any number of different vehicles - and most of the vehicles don't have names. So I need to check to find out what "vehicle s1" is, but I don't know how. It would be great if there was a "getVehicle s1" command, but there's not,

There is a command, it's called vehicle

What is the code you're using now to move "s2" into the leaders vehicle?

Are you then joining "s2" into the leaders group?

What I'm getting at, is that you already know the vehicle, because you are teleporting "s2" into it. So by seeing the code you are already using, we can see if something else is missing/not correct...

Depending on the code already in use, one way is like this:

_grp = group player; //or whomever you're looking for

_veh = vehicle (leader _grp); //so if the leader is mounted, _veh is the vehicle he/she is in...

---------- Post added at 13:07 ---------- Previous post was at 12:56 ----------

Dimdic, here are a couple of older posts dealing with what you asked:

orderGetin-does-not-work-for-AI-in-player-group

Possible solution to your issues:

assignAsTurret-moveInTurret-workaround

Otherwise, if they are under your control as group leader, why not just use your command menu?

Edited by panther42

Share this post


Link to post
Share on other sites

I was a little confused before about assigning the ai to a vehicle. My problem isn't assigning the ai to the vehicle and gettting him in, my problem was keeping him in the vehicle. It's like he isn't assigned to it at all, even though I just assigned him to it and orderGetIn. He just gets out. I think he might stay in if I assigned him differently. I don't think he likes the un-named vehicle, or something. Maybe he's on drugs. Obviously when you move a human into a cargo seat, you don't have to worry about them getting out against your orders, but ai are a pain in the ass.

Humans use a teleport flag at the current spawn area, but the ai need a little help. The spawn area also moves around alot as each new checkpoint area is capped.

When the ai dies and respawns it sets aiRespawned=true as a publicVariable and then I have a repeating trigger that checks to see if that variable is true and also checks to see if a bunch of other conditions are met and then activates 1 of 2 triggers. 1 trigger teleports the ai to the player if the player is on foot at the same direction, height etc. The 2nd trigger will teleport the ai into the cargo of whatever vehicle the player is driving. Humans teleport from the flag into the gunner, commander etc, but I limit the ai to just cargo position:

Here's just the teleport to vehicle part that the ai uses:

cond:

(aiRespawned) and (alive s2) and (s2 !=player) and (alive s1) and (vehicle s1 != s1) and (s2 distance rallyFlag <20)

act:

 
s2 assignAsCargo (vehicle s1);
[s2] orderGetIn true;
s2 moveInCargo (vehicle s1);
aiRespawned=false;
publicVariable "aiRespawned";

The ai is suddenly sitting next to me in the vehicle that I am driving, but as soon as I stop, he hops out and runs away and then stops and stands around looking dumb. I want him to stay in the vehicle until I tell him to get out, because he's my bitch, lol. I'll try a setFormation and see if that helps. Shrug.

Edited by A-SUICIDAL

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  

×