Jump to content
Sign in to follow this  
nullrick

Cannot enter a vehicles while in a team.

Recommended Posts

While being in a group (placed down by groups > blu/opfor > fireteam/weapons squad/etc.) and not being the squad/team leader, you cannot enter any vehicle/static weapon. How do I fix this without disbanding the group?

Or is this a natural and basic feature that all scenario creators factor in and have to work with?

Edited by Nullrick

Share this post


Link to post
Share on other sites

If you are not the team leader, you cannot enter a vehicle unless you are ordered to. To get round this there are several commands that can be used in the player's init or in a trigger, such as Assignasdriver or Moveincargo

Share this post


Link to post
Share on other sites

AFAIK, if you are not squad leader, then you do not get the option to enter a vehicle unless you are ordered to by the Ai squad leader.

I just wrote this so try pasting this code in the init of the unit you want to play as:

0 = this spawn {
waitUntil {
	if (vehicle _this isEqualTo _this) then {
		if not (isNull cursorTarget) then {
			call {
				if (cursorTarget emptyPositions "Driver" > 0) exitWith {
					_this assignAsDriver cursorTarget
				};
				if (cursorTarget emptyPositions "Gunner" > 0) exitWith {
					_this assignAsGunner cursorTarget
				};
			};
		};
	};
	sleep 3;
	false
};
};

There might be a better way to do it but this does at least work on all vehicles on the map automatically.

Share this post


Link to post
Share on other sites
If you are not the team leader, you cannot enter a vehicle unless you are ordered to.

I thought as much. Just needed to confirm. Thanks a lot. Are those the only scripts that came to mind? If anyone else has any other scripts for a unit's init field to simply override this it'd be quite helpful.

But thanks a ton, alky.

---------- Post added at 01:03 ---------- Previous post was at 01:01 ----------

@Attorney

I didn't see your post until after I replied to alky. Trying now.

Share this post


Link to post
Share on other sites

Actually, do this instead:

put a "Game Logic" on the map. Call it MrLogic

Then put this code in the "INITIALIZATION" field of MrLogic:

0 = [] spawn {
waitUntil {
	if (vehicle player isEqualTo player) then {
		if not (isNull cursorTarget) then {
			call {
				if (cursorTarget emptyPositions "Driver" > 0) exitWith {
					player assignAsDriver cursorTarget
				};
				if (cursorTarget emptyPositions "Gunner" > 0) exitWith {
					player assignAsGunner cursorTarget
				};
			};
		};
	};
	sleep 3;
	false
};
};

Then it doesn't matter which units you set to playable

Share this post


Link to post
Share on other sites

Works great! Thank you so much! I'm going to mess around with it a bit more. See if I can't let it let a unit get into a passenger seat as well.

Share this post


Link to post
Share on other sites

Cool, glad you're getting some use out of it :)

It's not really set up to do passengers as well. We could add another outcome to assign the player as a cargo unit, but the way it is written, it would prioritise the driver or gunner positions over cargo. So in effect, unless the vehicle you are looking at has a full contingent of drivers and gunners, then you can never get in as cargo. I think it will work if you get in as the driver and then teamswitch to another unit and it will let you in as cargo.

Here is the code updated with a check for cargo. (But as mentioned above, if you need to get in as cargo, then make sure there is driver (and gunner if applicable as well).

0 = [] spawn {
waitUntil {
	if (vehicle player isEqualTo player) then {
		if not (isNull cursorTarget) then {
			call {
				if (cursorTarget emptyPositions "Driver" > 0) exitWith {
					player assignAsDriver cursorTarget
				};
				if (cursorTarget emptyPositions "Gunner" > 0) exitWith {
					player assignAsGunner cursorTarget
				};
				if (cursorTarget emptyPositions "Cargo" > 0) exitWith {
					player assignAsCargo cursorTarget
				};
			};
		};
	};
	sleep 3;
	false
};
};

Do you want absolute freedom to get in where you want (regardless of who is in the vehicle at the moment)? If so, maybe a different approach would be needed. I'm in an altruistic mood tonight so let me know what you need for your mission/system and I'll help if I can.

Also, just to give you a little bit of background on using Logics in missions; they're really good as you can have lots of different logics (each running different bits of code). If you need to disable some code running on a logic for testing purposes etc, then set it's "probability of presence" to 0%. You could always set the code in the init.sqf file (if you have one in your mission) but it's a nice alternative to using script files. They need a bit of setting up properly, but are also excellent for MP (they are JIP proof as they exist on all connected computers).

Share this post


Link to post
Share on other sites

At least I know I was on the right track with the change I made to your first version of that code! That put me in a good mood as well! Your's just worked better.

I'd very much appreciate any help I could get tonight, when I find a new problem. But as far as I can see, this is the one big hurtle I've come across. About to try your new version of that code. But yes, I already see a lot of help that Logics can provide. But if this version works and lets any unit in a group get in or out of any given position in any given vehicle then I think I'll be good to go. Working on my first ever scenario which will be an adversarial. Hopefully it'll be done tonight with what help you've provided.

---------- Post added at 02:27 ---------- Previous post was at 02:03 ----------

And that code does work! But like you said, yes, the code does prioritize the driver and passenger (back) seats before any other seats can be taken like the FFV (passenger) seats and gunner seats. But as for singular static weapons, any unit can get in those at will. Which is great for my makeshift mortar technical I made with attachTo.

Also I'm just now realizing how the front passenger seats in A3 are called (back) seats. While the seats in an offroad truck BED are called passenger seats.

(Context options on an FIA Offroad)

"Get In Offroad Ride In Back" = front passenger seat

"Get In Offroad As Passenger [Right Seat 1]" = first seat in the bed

Edited by Nullrick

Share this post


Link to post
Share on other sites

Hmm strange it prioritises certain passenger positions over the gunner position.

I've rewrote part of it to look for turrets instead of gunner position so it should take care of the FFV positions as well.

The order should be:

  1. Driver
  2. Vehicle Turrets
  3. Passenger Turrets
  4. Cargo

0 = [] spawn {
waitUntil {
	if (vehicle player isEqualTo player) then {
		if not (isNull cursorTarget) then {
			call {
				if (cursorTarget emptyPositions "Driver" > 0) exitWith {
					player assignAsDriver cursorTarget
				};
				_found = false;
				{
					if isNull (cursorTarget turretUnit _x) exitWith {
						_found = true;
						player assignAsTurret [cursorTarget,_x]
					};
					true
				} count allTurrets [cursorTarget, true];
				if (
					not _found
					and {cursorTarget emptyPositions "Cargo" > 0}
				) exitWith {
					player assignAsCargo cursorTarget
				};
			};
		};
	};
	sleep 3;
	false
};
};

Does that work a bit better for you?

Share this post


Link to post
Share on other sites

My man! This is much better! Just more for me to learn from. Thanks once again. Sorry for the wait, was fiddling with other script that I managed to work out to my liking. But that works perfectly, 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  

×