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