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

Major
User avatar
Posts: 525
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Setting ally count for a CP in lua?

Postby SkinnyODST » Thu Jun 07, 2018 10:57 pm

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?

Resistance Leader
User avatar
Posts: 5187
Joined: Tue Feb 09, 2010 8:43 pm
Location: Edinburgh, UK
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Hollow Knight
xbox live or psn: Marth8880

Re: Setting ally count for a CP in lua?

Postby Marth8880 » Mon Jun 11, 2018 5:44 pm

Code: Select all
SetProperty(cpObjectName, "AllyCount", someValue)

Major
User avatar
Posts: 525
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Re: Setting ally count for a CP in lua?

Postby SkinnyODST » Tue Jun 12, 2018 12:16 am

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)

Resistance Leader
User avatar
Posts: 5187
Joined: Tue Feb 09, 2010 8:43 pm
Location: Edinburgh, UK
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Hollow Knight
xbox live or psn: Marth8880

Re: Setting ally count for a CP in lua?

Postby Marth8880 » Tue Jun 12, 2018 1:23 am

SkinnyODST wrote:
Code: Select all
SetProperty(cp3, "AllyCount", 20)

cp3 needs to be wrapped in quotation marks. ;)

Major
User avatar
Posts: 525
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Re: Setting ally count for a CP in lua?

Postby SkinnyODST » Tue Jun 12, 2018 3:12 am

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

Resistance Leader
User avatar
Posts: 5187
Joined: Tue Feb 09, 2010 8:43 pm
Location: Edinburgh, UK
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Hollow Knight
xbox live or psn: Marth8880

Re: Setting ally count for a CP in lua?

Postby Marth8880 » Tue Jun 12, 2018 2:17 pm

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.

Major
User avatar
Posts: 525
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Re: Setting ally count for a CP in lua?

Postby SkinnyODST » Wed Jun 13, 2018 12:02 am

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:

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 2 guests