Page 1 of 1

Setting ally count for a CP in lua?

Posted: Thu Jun 07, 2018 10:57 pm
by SkinnyODST
I`m pretty sure "AllyCount" in the map editor is where I`d specify the number of units that spawn from a CP, however my map has a layer problem (which some may remember) and won`t update any of the layers except the Base layer, so this won`t work for me (I`ve tried cleaning, it just breaks the map), so as a work-around, is there a way I can set a limit to the number of units that can spawn from a CP..through the lua script?

Re: Setting ally count for a CP in lua?

Posted: Mon Jun 11, 2018 5:44 pm
by Marth8880

Code: Select all

SetProperty(cpObjectName, "AllyCount", someValue)

Re: Setting ally count for a CP in lua?

Posted: Tue Jun 12, 2018 12:16 am
by SkinnyODST
Marth8880 wrote:

Code: Select all

SetProperty(cpObjectName, "AllyCount", someValue)

Code: Select all

function ScriptPostLoad()

SetProperty(cp3, "AllyCount", 20)
This doens`t seem to work as it causes any code after it to not be read (no units spawn, just like that topic of mine about setting a spawn delay)

Re: Setting ally count for a CP in lua?

Posted: Tue Jun 12, 2018 1:23 am
by Marth8880
SkinnyODST wrote:

Code: Select all

SetProperty(cp3, "AllyCount", 20)
cp3 needs to be wrapped in quotation marks. ;)

Re: Setting ally count for a CP in lua?

Posted: Tue Jun 12, 2018 3:12 am
by SkinnyODST
Yayy it doesn`t mess up the map now :D
But (there`s always a but when it comes to me and .lua) it doesn`t seem to have any affect on how many units spawn from the cp. I even set it to 1 and it still spawns heaps of units like all the other cps. Am I misunderstanding what allycount does or is this just another common case of
Hidden/Spoiler:
Image

Re: Setting ally count for a CP in lua?

Posted: Tue Jun 12, 2018 2:17 pm
by Marth8880
I'm not entirely sure what AllyCount is for. Either way, AISpawnWeight is the parameter you're looking for, it has a default value of 10 for every CP.

Re: Setting ally count for a CP in lua?

Posted: Wed Jun 13, 2018 12:02 am
by SkinnyODST
Marth8880 wrote:I'm not entirely sure what AllyCount is for. Either way, AISpawnWeight is the parameter you're looking for, it has a default value of 10 for every CP.
Omg it works YES THIS IS GREAT
ThAnk yoU MaRth :bowdown: