CP Number ~ Number of Units

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
Chamboozer
Rebel Colonel
Rebel Colonel
Posts: 604
Joined: Sat Apr 16, 2005 4:57 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

CP Number ~ Number of Units

Post by Chamboozer »

Is there a way to link the number of CP's a faction has to the number of units it can spawn, while still allowing the player to spawn at will? In this case, to make each CP the CIS has allow them to spawn 30 units, so 5 cp's = 150 units?
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: CP Number ~ Number of Units

Post by AceMastermind »

You can try playing around with AISpawnWeight.
Select a CP in ZE then go to Object Instance on the right and page down to the bottom to see it.
Try it out and let us know the outcome.

Edit:
Ok nevermind this, I see what you're saying now.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: CP Number ~ Number of Units

Post by [RDH]Zerted »

Listen to the CP cpature events and keep track of how many CPs each team has (read the scripting doc).
Use SetUnitCount() to change the amount of AI allowed to spawn. Note: If you recude the amount of AI allowed ingame to a number below the currectly spawned AI, the game won't automatically kill the extra bots, but it won't let any more bots spawn on that team until the extra units die.

Some SetUnitCount examples:

Code: Select all

SetUnitCount(ambushTeam4, ambushCount4)
SetUnitCount(flag_rebel, 1)
SetUnitCount(hangar_ambush, 5)
SetUnitCount(hangar_ambush, 6)
SetUnitCount(rebels1, 8)
SetUnitCount(rebels1, 80)
SetUnitCount(rebels2, 8)
SetUnitCount(rebels2, 80)
SetUnitCount(snipers, 2)
SetUnitCount(team, side.units)
SetUnitCount(4, 4)
SetUnitCount(4, 8)
SetUnitCount(5, 4)
SetUnitCount(AMBUSH1, 6)
SetUnitCount(BODYGUARDS, 5)
SetUnitCount(BOO, 9)
SetUnitCount(BOSS, 1)
SetUnitCount(DEF, 2)
Chamboozer
Rebel Colonel
Rebel Colonel
Posts: 604
Joined: Sat Apr 16, 2005 4:57 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: CP Number ~ Number of Units

Post by Chamboozer »

AceMastermind wrote:You can try playing around with AISpawnWeight.
Select a CP in ZE then go to Object Instance on the right and page down to the bottom to see it.
Try it out and let us know the outcome.

Edit:
Ok nevermind this, I see what you're saying now.
I will get onto this after I solve the problem that came up. The game crashes after the map loads and I get this in the Bfront2.log.
Message Severity: 2
.\Memory\RedMemory.cpp(634)
Allocating -8512 bytes attempt failed - no free blocks left in Heap 5 (Runtime)

Message Severity: 3
.\Memory\RedMemory.cpp(538)
Allocating -8512 bytes failed - no free blocks left in Heap 5 (Runtime)
Is there a way to "increase" the capacity of 'Heap 5'? And what is Heap 5?

EDIT: Nvm. I accidentally told the game to spawn an infinite number of walkers. No wonder it overloaded the system. It's fixed now and I'll look into what both of you have said.

Oh, and thank you Zerted, i'll look into that too after this is fixed.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: CP Number ~ Number of Units

Post by [RDH]Zerted »

AceMastermind wrote:Edit:
Ok nevermind this, I see what you're saying now.
Just look into what I said. AceMastermind thought you were asking about something else.
Chamboozer
Rebel Colonel
Rebel Colonel
Posts: 604
Joined: Sat Apr 16, 2005 4:57 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: CP Number ~ Number of Units

Post by Chamboozer »

On a side note, do you know how to get the AI to prioritize the defense of a CP over the attack of an enemy's? Usually you'd look forward to an ATTE Spawning, but not when it means every single one of your AI teammates will run off following it while leaving your only CP, already close to being overrun, to it's fate.
Post Reply