Page 1 of 1

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Sat Oct 20, 2007 2:26 am
by Frisbeetarian
Though I haven't worked with this issue, I'v read plenty about it, and it seems like many have tried to tackle this issue in the past and failed. Though it seems like you have stummbled upon something, I think the results you get from the error log is just the modtools' way of saying it can't be done. I would just like to quote the docs, though I'm sure that this community has done things the docs say they shouldn't:
Units can only be spawned from fixed positions, meaning units cannot spawn inside vehicles so some type of fixed object is required

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Sat Oct 20, 2007 7:19 am
by Ace_Azzameen_5
I'm pretty sure I have the ability right now to force people into multi-person vehicles that have driven through a region. I should probably try that just to prove that EnterVehicle works. Further evidence is that in his Operation Ferret out the Master, Archer01 used ExitVehicle, a similar function. I know this because IIRC the player character alone is forced out of an ATTE at one point, and setobjectteam doesn't work like that. However he likely set that up using the OnEnterRegion with a Character method.

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Mon Oct 22, 2007 4:50 am
by [RDH]Zerted
Argh, why does this subject keep popping up? Wasn't it solved a while ago? If someone can find the links to the original topics about it (the new forum broke all my reference links :cry: ), I should be able post the code you need to make it work.

Ace_Azzameen_5, something is wrong with your code/docs. Is it EnterVehicle(player, vehicle) or EnterVehicle(vehicle, player)?

Characters can only be spawned at certain, fixed locations. They can be teleported to more places than spawned. However with teleporting there is an extra problem: if the object/unit/vehicle is not orientated straight, the things being teleported will also not be straight. This causes some weird effects when teleporting a unit to a fighter in the air. Its good for movies, you can do dives into the ground or fall up...

The first error is saying entity 0 does not exist. Entity 0 is normally a player unit, meaning that that player is dead and has yet to respawn.
The second error is saying the given entity is not an EntityFlyer, Hover, or Walker when it should be one of those types.

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Mon Oct 22, 2007 5:12 pm
by Ace_Azzameen_5
Yeah, thanks, good luck looking. My searches were pretty nil. Maybe some threads are gone. I knew what the errors meant, but I goofed in posting the player 'name'. What I think I need is knowledge of the likely similar vehicle 'name' system. Like Flyer0 or something....hey, maybe I should try just guessing.

Its just, as I said, I can't get bf2_modtools to print a vehicle name variable, like It will player numbers.

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Mon Oct 22, 2007 11:34 pm
by [RDH]Zerted
I thought I remember reading somewhere that to access the vehicles, you use its vehicle spawn node.

Re: "W.I.P." Forcing Characters into Vehicles

Posted: Wed Nov 07, 2007 6:53 pm
by Ace_Azzameen_5
It works!
I don't know why, I guess its either a delayed reaction to a recent syntax change or the intricacies of my campaign mode, but it wasn't working, until mid-game, this code

Code: Select all

OnCharacterSpawn(
function(player)
if IsCharacterHuman then
EnterVehicle(player, "vulturespawn1")

end
end
)

slammed me inside a vulture droid.

Re: Forcing Characters into Vehicles!

Posted: Wed Nov 07, 2007 6:56 pm
by Maveritchell
Neat! What's weird is, I've tried that same code, and got nil in terms of results. Guess I must've done something wrong.

Re: Forcing Characters into Vehicles!

Posted: Wed Nov 07, 2007 7:12 pm
by Ace_Azzameen_5
I'm going to try and find out why (if its not just a syntax issue), later though, I've got life things to do.

UPDATE
Here is some code that will spawn characters right into a flyer.
OnCharacterSpawn(
function(unit)
if GetObjectTeam(GetCharacterUnit(unit)) == 1 then
print("Characters are on team 1")
if VehspawnNum == 1 then
print("Vulture 1 chosen")
EnterVehicle(unit, "Vehspawn1")
elseif VehspawnNum == 2 then
EnterVehicle(unit, "Vehspawn2")
elseif VehspawnNum == 3 then
EnterVehicle(unit, "Vehspawn3")
end
VehspawnNum = VehspawnNum + 1
end
end