Squad System code

Releasing the source files for your mod or map? Post em' here. (Applies to both SWBF1 & SWBF2)

Moderator: Moderators

Post Reply
MileHighGuy
Jedi
Jedi
Posts: 1194
Joined: Fri Dec 19, 2008 7:58 pm

Squad System code

Post by MileHighGuy »

https://www.moddb.com/games/star-wars-b ... -system-v1


This allows you to toggle a button to determine if you want to spawn on a "squad leader" unit instead of a command post.
Currently, it doesn't work in multiplayer.
This is the first release and I might add on to it in the future. If you can read LUA, I tried to comment it so you can understand what happens.


1. Put the SquadSystem.lua in your project's data_XYZ/Common/scripts folder (where XYZ is your map's name)

2. Add SquadSystem.lua to the mission.req in data_XYZ/Common under "scripts", so it is included in the .lvl file

3. Add ScriptCB_DoFile("SquadSetup") to you map's mission lua (XYZc_con for example) at the top, so it is loaded in the specific mission

3. Initialize the "Squad System" mode. Add, as an example:

squadSetup = SquadSetup:New()
squadSetup:addTeam(ATT, 20 , 3)
squadSetup:addTeam(DEF, 20, 3)

to your mission lua, under where it sets up the conquest mode in ScriptPostLoad().
ATT/DEF is the team, 20 is the number of units on the side, 3 in the number of squad leaders you want.

4. Add the squad putton, put a call to

overrideSpawnScreen()

under ReadDataFile("ingame.lvl"). This will let us add a new button needed for the system.

That should be all you have to do. Enjoy
User avatar
giftheck
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2218
Joined: Mon Jan 19, 2009 5:58 pm
Projects :: Star Wars Battlefront Legacy

Re: Squad System code

Post by giftheck »

Nice work on this!
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: Squad System code

Post by Lorul1 »

Amazing !
MileHighGuy
Jedi
Jedi
Posts: 1194
Joined: Fri Dec 19, 2008 7:58 pm

Re: Squad System code

Post by MileHighGuy »

I have released an updated version
https://www.moddb.com/games/star-wars-b ... -system-v2
In this one you can choose which squad to spawn on. You can also set a percent of AI that will spawn on a squad leader. Please note, the install instructions have changed slightly.

I wasnt sure how to just add a new version in the same moddb page (and bump the post to the top) , so I just uploaded it as a new file.
Post Reply