Page 1 of 1

Squad System code

Posted: Mon Nov 16, 2020 12:18 am
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

Re: Squad System code

Posted: Tue Nov 17, 2020 4:09 am
by giftheck
Nice work on this!

Re: Squad System code

Posted: Wed Dec 02, 2020 1:26 pm
by Lorul1
Amazing !

Re: Squad System code

Posted: Tue Dec 22, 2020 11:23 pm
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.