OnCharacterEnterVehicle(
function (player, vehicle)
if GetEntityClass(GetCharacterUnit(player)) == GetEntityClassPtr("NameOfInfantryClassYouWANTinVehicle") and GetEntityClass(vehicle)== GetEntityPtr("NameOfAVehicleClass") then
else
SetProperty(vehicle, "DisableTime", 0.25)
end
end
)
Last edited by xwingguy on Wed Jul 12, 2006 12:48 pm, edited 2 times in total.
Thats a nice bit of code there xwing, I hope people put this on every space map, to stop those pesky marines piloting ships. I'm not exactly sure how to read this, but correct me if I'm wrong: If the player that enters the vehicle is not of the correct class, then the vehicle is disabled. Therefore, if a non correct class player continueously tries to enter the vehicle, the correct class cannot either within the disabled timeframe (which, from the looks of it, is a quarter of a second)..?
Are we going to see some hero ships at BOE then? _____________________________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
You're exactly right pinioncorp on how the system works. And yes I'm going to put some hero ships in BOE. (Probably an enhanced x-wing for Wedge since I doubt I'm going to get a Millinium Falcon. Don't know about the Empire yet.)
oh and if you don't want this code to affect human players use this:
OnCharacterEnterVehicle(
function (player, vehicle)
if not IsCharacterHuman(player) then
if GetEntityClass(GetCharacterUnit(player)) == GetEntityPtr("NameOfInfantryClassYouWantInVehicle") and GetEntityClass(vehicle)== GetEntityPtr("NameOfAVehicleClass") then
else
SetProperty(vehicle, "DisableTime", 0.25)
end
end
end
)
EDIT: There's one little flaw in how this works although it only applies to the TIE bomber and the Y wing. Because these ships are 2 seaters, if a pilot is in the pilot seat and then a marine decides to jump into the second seat BOTH are kicked out of the ship.
Last edited by xwingguy on Wed Jul 12, 2006 12:50 pm, edited 2 times in total.
Alternatively, you could just add "NoEnterVehicles = 1" to the ODF of the unit you don't want to be able to pilot them. Unless, of course, you want the player to be able to use it, but not the bots. In that case, this could come in handy.
Yay, so now we get classes who are specialized for special vehicles. Tie-fighter Pilot, Tie-Bomber Pilot, Kamikaze pilot...euh...did I just say that?
I like the idea that you need to be a special class for a special fighter. Also, you could have a special class wich specializes in the enemy vehicles. Or something like that...
Schizo wrote:Alternatively, you could just add "NoEnterVehicles = 1" to the ODF of the unit you don't want to be able to pilot them. Unless, of course, you want the player to be able to use it, but not the bots. In that case, this could come in handy.
Good point. But I'm thinking he was setting this up as such that x class could get in some ships, but not others. That way nobody can steal someone's rightfully earned (by high score) Millenium Falcon or whatever.
I've got a system now that should keep any non-pilots out of the 1-manned starfighters. Keep in mind that this will only work for the Galactic Civil War.
OnCharacterEnterVehicle(
function(player, vehicle)
if (GetEntityClass(GetCharacterUnit(player)) == GetEntityClassPtr("all_inf_pilot")) then --Pilot is the 1st on the list
elseif (GetEntityClass(GetCharacterUnit(player)) == GetEntityClassPtr("imp_inf_pilot")) then
elseif (GetEntityClass(vehicle) == GetEntityClassPtr("all_fly_gunship_sc")) then
elseif (GetEntityClass(vehicle) == GetEntityClassPtr("all_fly_ywing_sc")) then
elseif (GetEntityClass(vehicle) == GetEntityClassPtr("imp_fly_trooptrans")) then
elseif (GetEntityClass(vehicle) == GetEntityClassPtr("imp_fly_tiebomber_sc")) then
else
SetProperty(vehicle,"DisableTime", 0.25)
end
end
)
Last edited by xwingguy on Wed Jul 12, 2006 12:52 pm, edited 2 times in total.
Hmm, what if you made it so that only pilots could PILOT vehicles, but other soldiers could jump in as passengers and gunners? That'd be the most useful for me.
There's one little flaw in how this works although it only applies to the TIE bomber and the Y wing. Because these ships are 2 seaters, if a pilot is in the pilot seat and then a marine decides to jump into the second seat BOTH are kicked out of the ship.