Spawning Vehicles in a .LUA?

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
User avatar
Broadus
Second Lance Corporal
Second Lance Corporal
Posts: 110
Joined: Thu Sep 21, 2006 1:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Spawning Vehicles in a .LUA?

Post by Broadus »

I'm modding on the PSP, and my only means of modifying it are by making my own mission.lvl, or hex editing anything else.
Knowing this, I was wondering, is it possible to add vehicles into a map just by scripting them in via the .LUA file for a level? Assuming I somehow knew the coordinates of where I wanted to place it.
I know vehicles are supposed to spawn depending on what team owns what control point, but I wouldn't mind if I could get a vehicle to spawn in one place indefinitely.
Like, I want to add an LAAT to Geonosis, somewhere in the big, open area around where the Republic's AT-TE is. Would that be at all possible in the .LUA?

I dunno' if AI flying LAATs use path nodes to navigate, but if they do, it'd mean that the AI wouldn't be able to fly it, as I'm sure there'd be no path nodes on Geonosis. Not that the AI could fly a gunship even if there were path nodes telling it the right places to go.
Last edited by Broadus on Mon Jan 15, 2007 5:29 am, edited 2 times in total.
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Ace_Azzameen_5 »

You might be able to create a lua script that will alter a vehicle spawn' objects' properties, so that after a time goes off, the atte point gives you a laat instead. OR, simply make it so that when rep gets say the hangar, they get an atte. I don't know the fine details, only that this is possible in the pc version.

Can you create a mission lua like we all can for pc?
]
User avatar
Broadus
Second Lance Corporal
Second Lance Corporal
Posts: 110
Joined: Thu Sep 21, 2006 1:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Broadus »

Yes, I can create a mission .LUA that is perfectly identical to the PC, except that it's compatible with the PSP.
Your suggestion makes a crapload of sense. Here's an idea I had: The Republic gets three hover tanks, but in the .LUA they're just commented out of the "read" section so that they don't appear (they appear in CTF when the AT-TE is taken out). I hex edited the geo1.lvl and replaced all occurences of the hover tank with the gunship. This made gunships spawn instead of tanks. I'm not using Geonosis CTF on the PSP, so it's not like I "lost" the tanks, since they don't appear in Conquest (they give the Republic too much power).
Two LAATs spawn a little too close to eachother, so one blows up if the other takes off. Oh, well.
Anyway, thanks for the idea! Problem solved!

I'm just wondering, is there a gunship (one that came with the game by default) that moves slower? Or, differently? The normal gunships fly fast and don't turn too well.
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:

Post by [RDH]Zerted »

You can use the SetProperty methods and change unit/object/entity stats. Use this to set the speeds to a lower value and change the turn rate.
User avatar
Broadus
Second Lance Corporal
Second Lance Corporal
Posts: 110
Joined: Thu Sep 21, 2006 1:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Broadus »

Cool idea. I tried it out, but I couldn't really change anything. The speed wouldn't change, and I'm trying to change the health of the gunships but that isn't working either. The only thing I could pull off was making an unrideable uta_fly_ride_gunship have a different takeoff height.
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:

Post by [RDH]Zerted »

There are a few set properties (SetClass, SetObject, SetEntity, etc...) functions. Make sure you are using the right one and what is your code?
User avatar
Broadus
Second Lance Corporal
Second Lance Corporal
Posts: 110
Joined: Thu Sep 21, 2006 1:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Broadus »

Well, I don't know which SetProperties are the ones that work, but I've seen MaxHealth and CurHealth used all of the time to make stuff indestructable, and it's not working for me.
Post Reply