Setting ally count for a CP in lua?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Setting ally count for a CP in lua?

Post 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?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Setting ally count for a CP in lua?

Post by Marth8880 »

Code: Select all

SetProperty(cpObjectName, "AllyCount", someValue)
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Setting ally count for a CP in lua?

Post 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)
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Setting ally count for a CP in lua?

Post by Marth8880 »

SkinnyODST wrote:

Code: Select all

SetProperty(cp3, "AllyCount", 20)
cp3 needs to be wrapped in quotation marks. ;)
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Setting ally count for a CP in lua?

Post 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
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Setting ally count for a CP in lua?

Post 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.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Setting ally count for a CP in lua?

Post 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:
Post Reply