Custom Vehicle Spawns

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
iamastupid
Second Lance Corporal
Second Lance Corporal
Posts: 106
Joined: Sat Feb 13, 2016 2:54 pm
Projects :: Not Battlefront III Legacy
Games I'm Playing :: Minecraft
xbox live or psn: d_Bro
Location: A Dark Bedroom in the UK
Contact:

Custom Vehicle Spawns

Post by iamastupid »

Basically, I've been trying to get ships from a custom era to spawn in my maps and change team ship depending on who owns a certain CP (Operating like normal vehicles)
I just want to now if it can be done and how.
The era in question is the KotOR era from: viewtopic.php?f=39&t=15622

So far I've got the ships to spawn if the team holds a command post, however I've had no luck in getting them to change once the other team has captured the cp.

Tbh if I spent enough time playing around I'd probably find some rudimentary way of getting it to work.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: Custom Vehicle Spawns

Post by Lorul1 »

so I think what your saying is something similar to this

you have two teams, maybe for this example REPUBLIC and DROIDS, and you have a third team which consist of flying ships.
When the DROID team takes the command post the ships go on their team, but when the REPUBLIC control the command post the ships change to there team.

To make this possible we have to put some code in your games lua file

for this example REPUBLIC will be team 1
and DROIDS will be team 2

the team abbreviation (which should also be specified in the lua) for the republic (aka team 1) will be REP
and for the droids (aka team 2) will be CIS
the ship team (team 3) will be SHP

Ok so step 1 is go into your games lua

Step 2 is to find the line that says :

"function ScriptPostLoad()" and the line that says "function ScriptInit()"
because the code I'm about to give you goes anywhere between those two lines

Now paste the following code BUT make sure you switch out the parts I have colored in
here is the code:




CaptureThenTeamChangeToGood = OnFinishCapture(
function(post, holding)
if GetCommandPostTeam("CP") == 1 then
SetTeamAsFriend(SHP, REP)
SetTeamAsFriend(REP, SHP)
SetTeamAsEnemy(SHP, CIS)
SetTeamAsEnemy(CIS, SHP)
end
end
)

CaptureThenTeamChangeToBad = OnFinishCapture(
function(post, holding)
if GetCommandPostTeam("CP") == 2 then
SetTeamAsFriend(SHP, CIS)
SetTeamAsFriend(CIS, SHP)
SetTeamAsEnemy(SHP, REP)
SetTeamAsEnemy(REP, SHP)
end
end
)




The blue text that says "CP" needs to be switched out to the name of the command post that the two teams are fighting over.
The red text that is either a 1 or a 2 should be the number of the team taking over the command post.

Test it out and tell me if it works !!
Post Reply