I'm new to scripting but this is what I have tried in ScriptPostLoad
Code: Select all
if GetReinforcementCount(DEF) < 40 then
SetUnitCount(WarDroidTeam, 0)
SetUnitCount(SithTeam, 0)
endhere is the full script.
Hidden/Spoiler:
Moderator: Moderators

Code: Select all
if GetReinforcementCount(DEF) < 40 then
SetUnitCount(WarDroidTeam, 0)
SetUnitCount(SithTeam, 0)
endCode: Select all
-- spawn block for Husks --
OnTicketCountChange(
function (team, count)
if team == CIS and count <= 20 then
print("ME5_ObjectiveConquest: Blocking HuskTeam spawn")
AllowAISpawn(3, false)
else end
end
)
I haveMarth8880 wrote:Replace "CIS" with the ID of the team whose tickets you want to be monitored.Code: Select all
-- spawn block for Husks -- OnTicketCountChange( function (team, count) if team == CIS and count <= 20 then print("ME5_ObjectiveConquest: Blocking HuskTeam spawn") AllowAISpawn(3, false) else end end )
Code: Select all
OnTicketCountChange(
function (team, count)
if team == IMP and count <= 40 then
AllowAISpawn(3, false)
--AllowAISpawn(4, false)
else end
if team == REP and count <= 40 then
AllowAISpawn(6, false)
else end
end
)

That's a bit problematic because I have several conquest scripts for several maps in that one mission.lvl. And not all of them have local sides and the ones that do don't have matching side numbers.Marth8880 wrote:Try putting it in the ObjectiveConquest:Start() function of ObjectiveConquest.lua.

I mean I have multiple maps in the same directory, so they naturally all are in the same mission.lvl. So if I modify the ObjectiveConquest LUA it affects all of the maps, which is problematic since the local sides are not even remotely standardized.Marth8880 wrote:Is there any particular reason why you have more than one or two Conquest scripts?
What about maps with multiple local sides that need blocking but those local sides are blocked based on different criteria? For instance ACW has two local sides that both have to be blocked when the DEF team's reinforcements get low. BVS has 4 local sides of which 2 need blocking but the first needs to be blocked when the ATT team's reinforcements get low and the other needs to be blocked when the DEF team's reinforcements get low.Marth8880 wrote: Regardless, that's a relatively easy fix. In each map, create a variable called mapHasLocalTeams (or something) and set its value to true or false depending on whether or not the map has local teams. Additionally, in each map with local teams, create a variable called localTeamToBlock (or something) and assign it the local team ID whose spawn should be blocked in that map. Then, change the first argument for the AllowAISpawn() function to the variable name. Finally, put the entire OnTicketCountChange() function into an if...then statement that checks if mapHasLocalTeams is true and if so, runs the function.