OnCharacterExitVehicle?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

OnCharacterExitVehicle?

Post by RepSharpshooter »

I tried using this function but it came up as a "null value" meaning it doesn't exist.

Code: Select all

mudkip = OnCharacterExitVehicle(
		function(player, vehicle)
			print(">>>OnExitVehicle<<<")
		end
	)

Is there any way to know when a character exits a vehicle? I'm currently working a hackish work-around with regions, but if there was a better way to grab the event as it happens that would be great.

EDIT: or is there at least a way to tell if the player is in a vehicle?
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: OnCharacterExitVehicle?

Post by Frisbeetarian »

GetCharacterVehicle should deliver a null result if the character is not in a vehicle.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: OnCharacterExitVehicle?

Post by [RDH]Zerted »

The best we can do is set a repeating timer to check to see if all the players are still in their vehicles.

You shouldn't just guess new functions. All the possible functions (yes, event callbacks are just functions, look at their format...) are accessible from Lua's global variables. The FakeConsole's Print Nested Globals (named something like that) will dump out all that info into the debug log. Look through that if you want to see if a function exists.
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: OnCharacterExitVehicle?

Post by RepSharpshooter »

[RDH]Zerted wrote:You shouldn't just guess new functions. All the possible functions (yes, event callbacks are just functions, look at their format...) are accessible from Lua's global variables. The FakeConsole's Print Nested Globals (named something like that) will dump out all that info into the debug log. Look through that if you want to see if a function exists.
I usually don't just guess functions. Coding random code never leads to anything. It just seemed so obvious that if there was an EnterVehicle() and an ExitVehicle() and there was an OnEnterVehicle() that there would be an OnExitVehicle(). Obviously they just didn't get around to that one.

EDIT: In any case, I've decided to just use a work around. At first I was going to use the repeating timer to check if they were still in it, but in the end I just went with a button for simplicity.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: OnCharacterExitVehicle?

Post by [RDH]Zerted »

A button? How is that supposed to work?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: OnCharacterExitVehicle?

Post by Maveritchell »

[RDH]Zerted wrote:A button? How is that supposed to work?
I'm sure it's not a literal button, but something manual the user does ingame (like shooting a modeled button).
Post Reply