Page 1 of 1
Turning Off local sides mid match
Posted: Wed Mar 04, 2015 12:23 am
by ZoomV
So I'm trying to get it to where certain local side teams cease to spawn after the reinforcement count gets so low.
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)
end
Unfortunately its not working.
here is the full script.
Re: Turning Off local sides mid match
Posted: Wed Mar 04, 2015 1:00 am
by Marth8880
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
)
Replace "CIS" with the ID of the team whose tickets you want to be monitored.
Re: Turning Off local sides mid match
Posted: Thu Mar 05, 2015 12:12 am
by ZoomV
Marth8880 wrote: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
)
Replace "CIS" with the ID of the team whose tickets you want to be monitored.
I have
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
)
And its definitely not working.
Re: Turning Off local sides mid match
Posted: Thu Mar 05, 2015 12:44 am
by Marth8880
Try putting it in the ObjectiveConquest:Start() function of ObjectiveConquest.lua.
Re: Turning Off local sides mid match
Posted: Thu Mar 05, 2015 1:00 am
by ZoomV
Marth8880 wrote:Try putting it in the ObjectiveConquest:Start() function of ObjectiveConquest.lua.
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.
Re: Turning Off local sides mid match
Posted: Thu Mar 05, 2015 3:01 am
by Marth8880
Is there any particular reason why you have more than one or two Conquest scripts?
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.
Re: Turning Off local sides mid match
Posted: Thu Mar 05, 2015 12:12 pm
by ZoomV
Marth8880 wrote:Is there any particular reason why you have more than one or two Conquest scripts?

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:
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.
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.
If I'm going to put this in the ObjectiveConquest LUA I need a highly adaptive way of doing it.