Problems with setting up locals! [Solved]

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
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Problems with setting up locals! [Solved]

Post by JazzMaster »

I am setting up a local team via allypaths, but when i try it out in game, the map crashes while loading.

I get this error saying I've set up my AddUnitClass function wrong:
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `RetailAddUnitClass' (number expected, got nil)
stack traceback:
[C]: in function `RetailAddUnitClass'
(none): in function `AddUnitClass'
(none): in function `ScriptInit'
But I'm not sure what I did wrong. Here is my CNDg_cmn:
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")


SetMemoryPoolSize ("SoldierAnimation", 1600)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",30) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo


ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

locals= 3;

function SetupUnits()
ReadDataFile("dc:SIDE\\tie.lvl",
"rep_fly_arc170fighter_sc",
"imp_fly_tiefighter_sc",
"imp_fly_tiefighter_auto",
"imp_fly_tie_x1_sc",
"tie_fly_z95_heavy",
"all_fly_ywing_auto",
"all_fly_ywing_sc",
"all_fly_xwing_sc",
"rep_fly_command",
"tie_fly_r41",
"tie_fly_r41_auto",
"tie_fly_heavy95_auto")
ReadDataFile("dc:SIDE\\sep.lvl",
"all_inf_rifleman",
"all_inf_guardsman",
"all_inf_marine",
"all_inf_sniper",
"sep_inf_officer",
"all_inf_engineer")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_melee_commando",
"all_hero_kota",
"imp_inf_royalguard",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\emp.lvl",
"imp_inf_pilot",
"imp_fly_trooptrans",
"imp_inf_marine",
"imp_inf_rifleman",
"imp_inf_sniper",
"imp_inf_stormtrooper",
"imp_inf_navytrooper",
"imp_inf_engineer",
"imp_inf_officer",
"imp_walk_atst",
"imp_hero_darthvader")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
)
end

myTeamConfig = {
all = {
team = ALL,
units = 43,
reinforcements = 1200,
soldier = { "all_inf_rifleman",1, 10},
assault = { "all_inf_guardsman",1, 8},
pilot = { "all_inf_pilot",1, 4},
sniper = { "all_inf_sniper",1, 2},
marine = { "all_inf_marine",1, 8},
engineer = { "all_inf_engineer",1, 4},
officer = { "sep_inf_officer",1, 4},
special = { "all_hero_kota",1, 1},
melee = { "all_inf_melee_commando",1, 3},
},

imp = {
team = IMP,
units = 48,
reinforcements = 1200,
soldier = { "imp_inf_navytrooper",1, 5},
assault = { "imp_inf_marine",1, 8},
pilot = { "imp_inf_pilot",1, 3},
engineer = { "imp_inf_engineer",1, 5},
sniper = { "imp_inf_sniper",1, 2},
marine = { "imp_inf_rifleman",1, 10},
officer = { "imp_inf_officer",1, 4},
special = { "imp_hero_darthvader",1, 1},
melee = { "imp_inf_royalguard",1, 3},

}
}


-- Local Stats
SetTeamName(3, "locals")
AddUnitClass(locals, "imp_inf_stormtrooper", 10)

SetUnitCount(3, 10)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,3)

SetTeamAsFriend(DEF,3)
[/code]
and my CNDg_Diet Dr. Pepper:
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Clone Wars Template Assault File
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("CNDc_cmn") --rename ABC to your modID


---- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")


-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;

myGameMode = "CND_CW-Assault"

function myScriptInit()
SetMemoryPoolSize("CommandFlyer", 4)
SetMemoryPoolSize("Music", 100)
end


function ScriptPostLoad()

AddAIGoal(REP, "Deathmatch", 100)
AddAIGoal(CIS, "Deathmatch", 100)
SetAIDifficulty(0, 1, "hard")


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "rep-cp1"}
cp2 = CommandPost:New{name = "cp1"}
cp3 = CommandPost:New{name = "cp2"}
cp4 = CommandPost:New{name = "cp3"}
cp5 = CommandPost:New{name = "cp4"}
cp6 = CommandPost:New{name = "cp5"}
cp7 = CommandPost:New{name = "cp6"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)



conquest:Start()


SetUberMode(1);[/code]
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Problems with setting up locals!

Post by AnthonyBF2 »

-- Local Stats
SetTeamName(3, "locals")
AddUnitClass(locals, "imp_inf_stormtrooper", 10)

I think, this should be
AddUnitClass(3, "im_inf_stormtrooper", 10)

3 means team, not "locals" -- locals is the name of the team.
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Re: Problems with setting up locals!

Post by JazzMaster »

Okay so I made that change and the map doesn't crash anymore, but the local units do not spawn.

I get this weird error that I don't understand:
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\HUDObjectiveList.cpp(158)
Objective already added to the list! Make sure there are no duplicate objective texts (and double check that all multiplayer objectives have unique textATT and textDEF)!

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\HUDObjectiveList.cpp(158)
Objective already added to the list! Make sure there are no duplicate objective texts (and double check that all multiplayer objectives have unique textATT and textDEF)!
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Problems with setting up locals!

Post by AQT »

Looks like you didn't give this third team a goal.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Problems with setting up locals!

Post by AnthonyBF2 »

I would try to remove

"locals=3;"

And just look at the stock tat3 scripts. In Jabba's Palace, all they did was put a command post for team 3, a linked spawn path to the cp.

The only code needed to set up Gamorreans was;
Hidden/Spoiler:
ReadDataFile("SIDE\\gam.lvl",
"gam_inf_gamorreanguard")
SetTeamName(3, "locals")
AddUnitClass(3, "gam_inf_gamorreanguard",3)
SetUnitCount(3, 2)
SetTeamAsEnemy(3, ATT)
SetTeamAsEnemy(3, DEF)
SetTeamAsEnemy(ATT, 3)
SetTeamAsEnemy(DEF, 3)
AddAIGoal(3,"Deathmatch",100)
In tat3 levels, they didn't add any fancy coding at the top of the file like "3=locals"

I would try to do what tat3 levels do:
Ensure your map has 1 CP with Team value on 3, with a spawn path linked.
In the code just paste the above Gamorrean code but just change the character string.
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Re: Problems with setting up locals!

Post by JazzMaster »

AQT wrote:Looks like you didn't give this third team a goal.
I added an AI goal in my cmn.lua and it didn't work:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")


SetMemoryPoolSize ("SoldierAnimation", 1600)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",30) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo


ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

locals= 3;

function SetupUnits()
ReadDataFile("dc:SIDE\\tie.lvl",
"rep_fly_arc170fighter_sc",
"imp_fly_tiefighter_sc",
"imp_fly_tiefighter_auto",
"imp_fly_tie_x1_sc",
"tie_fly_z95_heavy",
"all_fly_ywing_auto",
"all_fly_ywing_sc",
"all_fly_xwing_sc",
"rep_fly_command",
"tie_fly_r41",
"tie_fly_r41_auto",
"tie_fly_heavy95_auto")
ReadDataFile("dc:SIDE\\sep.lvl",
"all_inf_rifleman",
"all_inf_guardsman",
"all_inf_marine",
"all_inf_sniper",
"sep_inf_officer",
"all_inf_engineer")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_melee_commando",
"all_hero_kota",
"imp_inf_royalguard",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\emp.lvl",
"imp_inf_pilot",
"imp_fly_trooptrans",
"imp_inf_marine",
"imp_inf_rifleman",
"imp_inf_sniper",
"imp_inf_stormtrooper",
"imp_inf_navytrooper",
"imp_inf_engineer",
"imp_inf_officer",
"imp_walk_atst",
"imp_hero_darthvader")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
)
end

myTeamConfig = {
all = {
team = ALL,
units = 43,
reinforcements = 1200,
soldier = { "all_inf_rifleman",1, 10},
assault = { "all_inf_guardsman",1, 8},
pilot = { "all_inf_pilot",1, 4},
sniper = { "all_inf_sniper",1, 2},
marine = { "all_inf_marine",1, 8},
engineer = { "all_inf_engineer",1, 4},
officer = { "sep_inf_officer",1, 4},
special = { "all_hero_kota",1, 1},
melee = { "all_inf_melee_commando",1, 3},
},

imp = {
team = IMP,
units = 48,
reinforcements = 1200,
soldier = { "imp_inf_navytrooper",1, 5},
assault = { "imp_inf_marine",1, 8},
pilot = { "imp_inf_pilot",1, 3},
engineer = { "imp_inf_engineer",1, 5},
sniper = { "imp_inf_sniper",1, 2},
marine = { "imp_inf_rifleman",1, 10},
officer = { "imp_inf_officer",1, 4},
special = { "imp_hero_darthvader",1, 1},
melee = { "imp_inf_royalguard",1, 3},

}
}


-- Local Stats
SetTeamName(3, "locals")
AddUnitClass(3, "imp_inf_stormtrooper", 10)

SetUnitCount(3, 10)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,3)

SetTeamAsFriend(DEF,3)
So I tried it in the Assault mission lua:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Galactic Civil War Template Assault File
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("CNDg_cmn") --rename ABC to your modID


---- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")


-- REP Attacking (attacker is always #1)
ALL = 1;
IMP = 2;
-- These variables do not change
ATT = ALL;
DEF = IMP;

locals= 3;

myGameMode = "CND_GCW-Assault"

function myScriptInit()
SetMemoryPoolSize("CommandFlyer", 4)
end


function ScriptPostLoad()

AddAIGoal(ALL, "Deathmatch", 100)
AddAIGoal(IMP, "Deathmatch", 100)
AddAIGoal(3, "Deathmatch", 100)
SetAIDifficulty(0, 1, "hard")



--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "all-cp1"}
cp2 = CommandPost:New{name = "cp1"}
cp3 = CommandPost:New{name = "cp2"}
cp4 = CommandPost:New{name = "cp3"}
cp5 = CommandPost:New{name = "cp4"}
cp6 = CommandPost:New{name = "cp5"}
cp7 = CommandPost:New{name = "cp6"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)



conquest:Start()


SetUberMode(1);
But that didn't change anything either. And I would much rather stick to the Kashyyyk-style "allypath" method since this map is pretty big and i would rather have the spawning at the defending teams CP's instead of having one of there own
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Problems with setting up locals!

Post by AnthonyBF2 »

I had a dumb moment and didn't see you were making a space level... :?

I have had this issue too - I do not think locals can be added in space maps.
I tried my hardest to make it work but it didn't.
Hidden/Spoiler:
I really wanted to make a 4 sided space map, where in GCW, the CW is locals and in CW, The GCW teams are local. But It just didn't work, despite doing everything right.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Problems with setting up locals!

Post by AQT »

anthonybf2 wrote:I do not think locals can be added in space maps.
Space maps are just really large ground maps without any terrain. Plus, the lua files JazzMaster posted are actually for a Conquest mode.

@JazzMaster: Hmm, your lua files seem to look fine. I would just keep the team 3 AI goal in your assault mission lua for now. I suggest double-checking whether the path names match up with the ones you specified for AllyPath. And the other thing I suggest you try doing is removing the ALL and IMP Deathmatch goals, which might be causing some kind of interference; those two teams should already have Conquest goals from the ObjectiveConquest.lua.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Problems with setting up locals!

Post by Anakin »

1. Have you set up your allypath??
2. AddUnitClass(locals, "imp_inf_stormtrooper", 10) is fine, but you defined locals as "3;" and not as "3". As far as i know you needn't add ; at the end of each line.
3. You never set att and def as enemy or you haven't post it ;)
4. In the latest lua you posted you added ; behind ATT and DEF, too. Please remove this again.

When i'm back at home i can have a look at my luas and look for differences

==edit==

Not sure about your scripting concept, but you have a function in the cmn file called scriptinit and in your other lua you have a function called myscriptinit. Maybe there is something wrong with the function names, because i don't see the part were you callscriptinit or myscriptinit
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Re: Problems with setting up locals!

Post by JazzMaster »

So here are my current LUAs in there entireties.

cmn.lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")


SetMemoryPoolSize ("SoldierAnimation", 1600)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",30) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo


ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

locals= 3

function SetupUnits()
ReadDataFile("dc:SIDE\\tie.lvl",
"rep_fly_arc170fighter_sc",
"imp_fly_tiefighter_sc",
"imp_fly_tiefighter_auto",
"imp_fly_tie_x1_sc",
"tie_fly_z95_heavy",
"all_fly_ywing_auto",
"all_fly_ywing_sc",
"all_fly_xwing_sc",
"rep_fly_command",
"tie_fly_r41",
"tie_fly_r41_auto",
"tie_fly_heavy95_auto")
ReadDataFile("dc:SIDE\\sep.lvl",
"all_inf_rifleman",
"all_inf_guardsman",
"all_inf_marine",
"all_inf_sniper",
"sep_inf_officer",
"all_inf_engineer")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_melee_commando",
"all_hero_kota",
"imp_inf_royalguard",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\emp.lvl",
"imp_inf_pilot",
"imp_fly_trooptrans",
"imp_inf_marine",
"imp_inf_rifleman",
"imp_inf_sniper",
"imp_inf_stormtrooper",
"imp_inf_navytrooper",
"imp_inf_engineer",
"imp_inf_officer",
"imp_walk_atst",
"imp_hero_darthvader")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
)
end

myTeamConfig = {
all = {
team = ALL,
units = 43,
reinforcements = 1200,
soldier = { "all_inf_rifleman",1, 10},
assault = { "all_inf_guardsman",1, 8},
pilot = { "all_inf_pilot",1, 4},
sniper = { "all_inf_sniper",1, 2},
marine = { "all_inf_marine",1, 8},
engineer = { "all_inf_engineer",1, 4},
officer = { "sep_inf_officer",1, 4},
special = { "all_hero_kota",1, 1},
melee = { "all_inf_melee_commando",1, 3},
},

imp = {
team = IMP,
units = 48,
reinforcements = 1200,
soldier = { "imp_inf_navytrooper",1, 5},
assault = { "imp_inf_marine",1, 8},
pilot = { "imp_inf_pilot",1, 3},
engineer = { "imp_inf_engineer",1, 5},
sniper = { "imp_inf_sniper",1, 2},
marine = { "imp_inf_rifleman",1, 10},
officer = { "imp_inf_officer",1, 4},
special = { "imp_hero_darthvader",1, 1},
melee = { "imp_inf_royalguard",1, 3},

}
}


-- Local Stats
SetTeamName(3, "locals")
AddUnitClass(3, "imp_inf_stormtrooper", 10)

SetUnitCount(3, 10)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,3)

SetTeamAsFriend(DEF,3)

ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", IMP )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", IMP )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp-defense",
turrets = {"imp_turr_1", "imp_turr_2", "imp_turr_3", "imp_turr_4", "imp_turr_5", "imp_turr_6"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
end

SetMinFlyHeight(-1800)
SetMaxFlyHeight(7000)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(7000)
SetAIVehicleNotifyRadius(100)




ReadDataFile("sound\\spa.lvl;spa1gcw")
ReadDataFile("dc:sound\\abc.lvl;abcgcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 8) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(1, 2) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 1) -- 3x2 (3 pairs of legs)
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 1200)
SetMemoryPoolSize("AmmoCounter", 1200)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("CommandFlyer", 4)
SetMemoryPoolSize("EnergyBar", 1600)
SetMemoryPoolSize("EntityHover", 8)
SetMemoryPoolSize("EntityCloth", 2)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 99)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 200)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", 500)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", 300)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 999)
SetMemoryPoolSize("UnitAgent", 200) -- guyCnt*2
SetMemoryPoolSize("UnitController", 300)
SetMemoryPoolSize("Weapon", 999)



SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end


ReadDataFile("dc:CND\\CND.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(IMP, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start", 0,1)
SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(IMP, "imp_spa_amb_victory")
SetDefeatMusic (IMP, "imp_spa_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
-- SetSoundEffect("BirdScatter", "birdsFlySeq1")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")

-- Camera Stats
SetAttackingTeam(IMP)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(0.998795, -0.041143, -0.026739, -0.001101, -720.435303, 809.024963, 2779.057129);
--Flag shot
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion")


end
mission lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Galactic Civil War Template Assault File
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("CNDg_cmn") --rename ABC to your modID


---- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")


-- REP Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = ALL
DEF = IMP

locals= 3

myGameMode = "CND_GCW-Assault"



function ScriptPostLoad()

AddAIGoal(3, "Deathmatch", 100)
SetAIDifficulty(0, 1, "hard")



--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "all-cp1"}
cp2 = CommandPost:New{name = "cp1"}
cp3 = CommandPost:New{name = "cp2"}
cp4 = CommandPost:New{name = "cp3"}
cp5 = CommandPost:New{name = "cp4"}
cp6 = CommandPost:New{name = "cp5"}
cp7 = CommandPost:New{name = "cp6"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)



conquest:Start()


SetUberMode(1);

local counted_points = 0

conquest:Start()

EnableSPHeroRules()

onvehenter = OnCharacterEnterVehicle(
function(player, vehicle)
if IsCharacterHuman(player) and GetEntityClass(vehicle) == GetEntityClassPtr("all_fly_xwing_sc") then
if counted_points < 8 then
ExitVehicle(player)
end
end
end)

onvehkill = OnObjectKill(
function(object, killer)
if IsCharacterHuman(killer) and GetEntityClass(object) == GetEntityClassPtr("imp_fly_tiefighter_sc") or GetEntityClass(object) == GetEntityClassPtr("imp_fly_tiefighter_auto") then
counted_points = counted_points + 1
end
end)

end
My spawn paths for the allypath values are definitely set up right. I've check dozens of times to make sure i'm not hallucinating :shock:

I got rid of the ATT and DEF deathmatch goals.

Took the ";" out of ATT=1 DEF= 2 etc.

Also got rid of the "myscriptinit" from the mission lua because it was pointless. Just added that single memorypool to the cmn file.

But the locals still dont spawn :|
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Problems with setting up locals!

Post by Anakin »

Do the other troopers spawn?? You are using realy curious scripts. (You have a lot of functions defined in a function. Or you give a function a function definition as parameter. :? I never know that this is possible.)


I'd try to put the locals under the team setup (actually where you are calling the function, not where you define it). I think that at the position you add the unit, it isn't known for SWBFII, because the function is started at the very end when you call "SetupUnits()". Is there a reason why you made a new function for reading in all lvl files, and call this later in the lua??
Add an space between "locals" and "="



here is my geonosis lua file. It's the map with the most locals i ever used, and they are all working. So i cannot see any difference but the once i told you above. But maybe someone else see some.
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")

ReadDataFile("dc:common.lvl")
ReadDataFile("common.lvl")

-- REP Attacking (attacker is always #1)
REP = 1
CIS = 2
GEONO = 3
CLONEDEA = 4
JEDI = 5
CLONECON = 6
-- These variables do not change
ATT = 1
DEF = 2
---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------

function ScriptPostLoad()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp6 = CommandPost:New{name = "cp6"}
cp7 = CommandPost:New{name = "cp7"}
cp8 = CommandPost:New{name = "cp8"}

--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.geo1.objectives.conquest", multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)
conquest:AddCommandPost(cp8)

conquest:Start()
SetUberMode(1)
EnableSPHeroRules()

AddDeathRegion("deathregion")
AddDeathRegion("deathregion2")
AddDeathRegion("deathregion3")
AddDeathRegion("deathregion4")
AddDeathRegion("deathregion5")

SetProperty("cp1", "AllyPath", "cp1_spawn")
SetProperty("cp2", "AllyPath", "cp2_spawn")
SetProperty("cp3", "AllyPath", "cp3_spawn")
SetProperty("cp4", "AllyPath", "cp4_spawn")
SetProperty("cp6", "AllyPath", "cp6_spawn")
SetProperty("cp7", "AllyPath", "cp7_spawn")
SetProperty("cp8", "AllyPath", "cp8_spawn")

end

function ScriptInit()
ReadDataFile("dc:Load\\RCM_Load.lvl")

StealArtistHeap(800*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(3500000)

SetMemoryPoolSize("ParticleTransformer::SizeTransf", 2500)
SetMemoryPoolSize("ParticleTransformer::ColorTrans", 3000)
SetMemoryPoolSize("ParticleTransformer::PositionTr", 2500)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",30) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo

local screenWidth, screenHeight = ScriptCB_GetScreenInfo()
local aspectRatio = screenWidth / screenHeight

ReadDataFile("dc:SIDE\\fpanimset.lvl")

if aspectRatio <= 1.4 then
print("RCM_loading: Aspect Ratio 4:3 detected")
ReadDataFile("dc:HUD\\hud43.lvl")
ReadDataFile("ingame.lvl")
ReadDataFile("dc:HUD\\hudBmpKill.lvl")
elseif aspectRatio <= 1.63 and aspectRatio >= 1.5 then
print("RCM_loading: Aspect Ratio 16:10 detected")
ReadDataFile("dc:HUD\\hud1610.lvl")
ReadDataFile("ingame.lvl")
ReadDataFile("dc:HUD\\hudBmpKill.lvl")
elseif aspectRatio <= 1.9 and aspectRatio >= 1.63 then
print("RCM_loading: Aspect Ratio 16:9 detected")
ReadDataFile("dc:HUD\\hud169.lvl")
ReadDataFile("ingame.lvl")
ReadDataFile("dc:HUD\\hudBmpKill.lvl")
else
print("RCM_loading: Aspect Ratio unkown. Loading stock HUD.")
ReadDataFile("dc:HUD\\hudUnknown.lvl")
ReadDataFile("ingame.lvl")
end



SetTeamAggressiveness(CIS, 1.0)
SetTeamAggressiveness(REP, 0.5)

SetMemoryPoolSize("Music", 40)
ReadDataFile("dc:sound\\rcm.lvl;comSnd")
ReadDataFile("dc:sound\\rcm.lvl")
ReadDataFile("sound\\geo.lvl;geo1cw")

ReadDataFile("SIDE\\jed.lvl",
"jed_knight_01",
"jed_knight_02",
"jed_knight_03",
"jed_master_01",
"jed_master_02")

ReadDataFile("SIDE\\cis.lvl",
"cis_fly_droidfighter_dome",
--"cis_fly_geofighter",
"cis_tread_hailfire",
"cis_hover_stap",
"cis_walk_spider")

ReadDataFile("SIDE\\rep.lvl",
"rep_fly_assault_dome",
"rep_fly_gunship_dome",
"rep_hover_fightertank",
--"rep_fly_gunship",
--"rep_bldg_forwardcenter",
"rep_fly_jedifighter_dome",
"rep_walk_atte")

ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_commando_01_rifleman",
"rep_inf_commando_02_roketeer",
"rep_inf_commando_03_sniper",
"rep_inf_commando_04_engineer",
"rep_inf_commando_05_electronic",
"rep_inf_commando_06_sergeant",
"rep_inf_commando_07_havoc",
"rep_inf_commando_08_elite")

ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_b1_rifleman",
"cis_inf_b1_rocketeer",
"cis_inf_b1_sniper",
"cis_inf_sbd",
"cis_inf_magnaguard",
"cis_inf_droideka")

ReadDataFile("dc:SIDE\\geo.lvl",
"geo_inf_geonosian",
"geo_inf_geonosian_elite")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_geoturret")

ReadDataFile("dc:SIDE\\rrl.lvl",
"rrl_inf_ep2_rifleman",
"rrl_inf_ep2_commander",
"rrl_inf_ep2_jettrooper")

-- GEOS ---------------------------
SetTeamName(3, "locals")
AddUnitClass(3, "geo_inf_geonosian", 7)
AddUnitClass(3, "geo_inf_geonosian_elite", 7)
SetUnitCount(3, 7)
AddAIGoal(GEONO, "Deathmatch", 100)
-----------------------------------

-- Jedi ---------------------------
SetTeamName (5, "jedi")
AddUnitClass(5, "jed_knight_01",4)
AddUnitClass(5, "jed_knight_02",4)
AddUnitClass(5, "jed_knight_03",4)
AddUnitClass(5, "jed_master_01",2)
AddUnitClass(5, "jed_master_02",2)
SetUnitCount (5, 10)
AddAIGoal(JEDI, "Deathmatch", 100)
-----------------------------------

-- Clones -------------------------
SetTeamName (4, "clone")
AddUnitClass (4, "rrl_inf_ep2_rifleman", 15)
AddUnitClass (4, "rrl_inf_ep2_jettrooper", 5)
AddUnitClass(4, "rrl_inf_ep2_commander",3)
SetUnitCount (4, 8)
AddAIGoal(CLONEDEA, "Deathmatch", 100)
-----------------------------------

-- Clones -------------------------
SetTeamName (6, "clone")
AddUnitClass (6, "rrl_inf_ep2_rifleman", 15)
AddUnitClass (6, "rrl_inf_ep2_jettrooper", 5)
AddUnitClass(6, "rrl_inf_ep2_commander",3)
SetUnitCount (6, 7)
AddAIGoal(CLONECON, "Conquest", 100)
-----------------------------------

-- Friends ------------------------
SetTeamAsFriend(REP,JEDI)
SetTeamAsFriend(JEDI,REP)

SetTeamAsFriend(REP,CLONECON)
SetTeamAsFriend(CLONECON,REP)

SetTeamAsFriend(REP,CLONEDEA)
SetTeamAsFriend(CLONEDEA,REP)

SetTeamAsFriend(JEDI,CLONECON)
SetTeamAsFriend(CLONECON,JEDI)

SetTeamAsFriend(JEDI,CLONEDEA)
SetTeamAsFriend(CLONEDEA,JEDI)

SetTeamAsFriend(CLONECON,CLONEDEA)
SetTeamAsFriend(CLONEDEA,CLONECON)

SetTeamAsFriend(CIS,GEONO)
SetTeamAsFriend(GEONO,CIS)
-----------------------------------

-- Enemys -------------------------
SetTeamAsEnemy(REP,GEONO)
SetTeamAsEnemy(GEONO,REP)

SetTeamAsEnemy(GEONO,JEDI)
SetTeamAsEnemy(JEDI,GEONO)

SetTeamAsEnemy(GEONO,CLONECON)
SetTeamAsEnemy(CLONECON,GEONO)

SetTeamAsEnemy(GEONO,CLONEDEA)
SetTeamAsEnemy(CLONEDEA,GEONO)

SetTeamAsEnemy(CIS,JEDI)
SetTeamAsEnemy(JEDI,CIS)

SetTeamAsEnemy(CIS,CLONECON)
SetTeamAsEnemy(CLONECON,CIS)

SetTeamAsEnemy(CIS,CLONEDEA)
SetTeamAsEnemy(CLONEDEA,CIS)
-----------------------------------

-- Level Stats

ClearWalkers()
SetMemoryPoolSize("EntityWalker", -1)
AddWalkerType(0, 3) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(2, 3) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
local weaponcnt = 300
SetMemoryPoolSize("Aimer", 100)
SetMemoryPoolSize("AmmoCounter", weaponcnt)
SetMemoryPoolSize("BaseHint", 100)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("EnergyBar", weaponcnt)
SetMemoryPoolSize("EntityFlyer", 6)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 50)
SetMemoryPoolSize("EntityCloth", 50)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("MountedTurret", 10)
SetMemoryPoolSize("Navigator", 70)
SetMemoryPoolSize("Obstacle", 450)
SetMemoryPoolSize("PathFollower", 70)
SetMemoryPoolSize("PathNode", 100)
SetMemoryPoolSize("TreeGridStack", 300)
SetMemoryPoolSize("UnitAgent", 70)
SetMemoryPoolSize("UnitController", 70)
SetMemoryPoolSize("Weapon", weaponcnt)
SetMemoryPoolSize("SoldierAnimation", 580)

SetSpawnDelay(10.0, 0.25)

SetupTeams{
rep = {
team = REP,
units = 16,
reinforcements = 150,
soldier = { "rep_inf_commando_01_rifleman",9, 25},
assault = { "rep_inf_commando_02_roketeer",1,4},
sniper = { "rep_inf_commando_03_sniper",1,4},
engineer= { "rep_inf_commando_04_engineer",1,4},
officer = { "rep_inf_commando_05_electronic",1,4},
special = { "rep_inf_commando_06_sergeant",1,4},
commander={ "rep_inf_commando_07_havoc", 1, 4},
general = { "rep_inf_commando_08_elite", 1, 2}
},
cis = {
team = CIS,
units = 32,
reinforcements = 300,
soldier = {"cis_inf_b1_rifleman",10, 30},
assault = {"cis_inf_b1_rocketeer",1, 4},
sniper = {"cis_inf_b1_sniper",1, 4},
engineer= {"geo_inf_geonosian",1, 6},
officer = {"cis_inf_sbd",1, 2},
special = {"geo_inf_geonosian_elite", 1, 2},
commander={"cis_inf_droideka", 1, 2},
general = {"cis_inf_magnaguard", 1, 2},
}
}




-- Attacker Stats

--teamATT = ConquestTeam:New{team = ATT}
--teamATT:AddBleedThreshold(21, 0.75)
--teamATT:AddBleedThreshold(11, 2.25)
--teamATT:AddBleedThreshold(1, 3.0)
--teamATT:Init()

-- Defender Stats

--teamDEF = ConquestTeam:New{team = DEF}
--teamDEF:AddBleedThreshold(21, 0.75)
--teamDEF:AddBleedThreshold(11, 2.25)
--teamDEF:AddBleedThreshold(1, 3.0)
--teamDEF:Init()

-- Local Stats

--SetTeamName(4, "locals")
--AddUnitClass(4, "rep_inf_jedimale",1)
--AddUnitClass(4, "rep_inf_jedimaleb",1)
--AddUnitClass(4, "rep_inf_jedimaley",1)
--SetUnitCount(4, 3)
--SetTeamAsFriend(4, ATT)

ReadDataFile("GEO\\geo1.lvl", "geo1_conquest")

SetDenseEnvironment("false")
SetMinFlyHeight(-65)
SetMaxFlyHeight(50)
SetMaxPlayerFlyHeight(50)



-- Birdies
--SetNumBirdTypes(1)
--SetBirdType(0.0,10.0,"dragon")
--SetBirdFlockMinHeight(90.0)

-- Sound

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
OpenAudioStream("dc:sound\\rcm.lvl", "rcm_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")

SetAmbientMusic(REP, 1.0, "rep_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_amb_end", 2,1)

SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")


--ActivateBonus(CIS, "SNEAK_ATTACK")
--ActivateBonus(REP, "SNEAK_ATTACK")

SetAttackingTeam(ATT)

--Opening Satalite Shot
--Geo
--Mountain
AddCameraShot(0.996091, 0.085528, -0.022005, 0.001889, -6.942698, -59.197201, 26.136919)
--Wrecked Ship
AddCameraShot(0.906778, 0.081875, -0.411906, 0.037192, 26.373968, -59.937874, 122.553581)
--War Room
--AddCameraShot(0.994219, 0.074374, 0.077228, -0.005777, 90.939568, -49.293945, -69.571136)



if aspectRatio <= 1.4 then
ReadDataFile("dc:SIDE\\43.lvl")
ReadDataFile("dc:HUD\\hudTxtKill.lvl")
elseif aspectRatio <= 1.63 and aspectRatio >= 1.5 then
ReadDataFile("dc:SIDE\\1610.lvl")
ReadDataFile("dc:HUD\\hudTxtKill.lvl")
elseif aspectRatio <= 1.9 and aspectRatio >= 1.63 then
ReadDataFile("dc:SIDE\\169.lvl")
ReadDataFile("dc:HUD\\hudTxtKill.lvl")
else
ReadDataFile("dc:SIDE\\unkown.lvl")
end


end

[/code]
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Re: Problems with setting up locals!

Post by JazzMaster »

Wow thanks Anakin! They spawn now.
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")


SetMemoryPoolSize ("SoldierAnimation", 1600)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",30) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo


ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

locals= 3

function SetupUnits()
ReadDataFile("dc:SIDE\\tie.lvl",
"rep_fly_arc170fighter_sc",
"imp_fly_tiefighter_sc",
"imp_fly_tiefighter_auto",
"imp_fly_tie_x1_sc",
"tie_fly_z95_heavy",
"all_fly_ywing_auto",
"all_fly_ywing_sc",
"all_fly_xwing_sc",
"rep_fly_command",
"tie_fly_r41",
"tie_fly_r41_auto",
"tie_fly_heavy95_auto")
ReadDataFile("dc:SIDE\\sep.lvl",
"all_inf_rifleman",
"all_inf_guardsman",
"all_inf_marine",
"all_inf_sniper",
"sep_inf_officer",
"all_inf_engineer")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_melee_commando",
"all_hero_kota",
"imp_inf_royalguard",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\emp.lvl",
"imp_inf_pilot",
"imp_fly_trooptrans",
"imp_inf_marine",
"imp_inf_rifleman",
"imp_inf_sniper",
"imp_inf_stormtrooper",
"imp_inf_navytrooper",
"imp_inf_engineer",
"imp_inf_officer",
"imp_walk_atst",
"imp_hero_darthvader")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
)

-- Local Stats
SetTeamName(3, "locals")
AddUnitClass(3, "imp_inf_stormtrooper", 10)

SetUnitCount(3, 10)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,3)

SetTeamAsFriend(DEF,3)
end

myTeamConfig = {
all = {
team = ALL,
units = 43,
reinforcements = 1200,
soldier = { "all_inf_rifleman",1, 10},
assault = { "all_inf_guardsman",1, 8},
pilot = { "all_inf_pilot",1, 4},
sniper = { "all_inf_sniper",1, 2},
marine = { "all_inf_marine",1, 8},
engineer = { "all_inf_engineer",1, 4},
officer = { "sep_inf_officer",1, 4},
special = { "all_hero_kota",1, 1},
melee = { "all_inf_melee_commando",1, 3},
},

imp = {
team = IMP,
units = 48,
reinforcements = 1200,
soldier = { "imp_inf_navytrooper",1, 5},
assault = { "imp_inf_marine",1, 8},
pilot = { "imp_inf_pilot",1, 3},
engineer = { "imp_inf_engineer",1, 5},
sniper = { "imp_inf_sniper",1, 2},
marine = { "imp_inf_rifleman",1, 10},
officer = { "imp_inf_officer",1, 4},
special = { "imp_hero_darthvader",1, 1},
melee = { "imp_inf_royalguard",1, 3},

}
}




ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", IMP )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", IMP )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp-defense",
turrets = {"imp_turr_1", "imp_turr_2", "imp_turr_3", "imp_turr_4", "imp_turr_5", "imp_turr_6"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
end

SetMinFlyHeight(-1800)
SetMaxFlyHeight(7000)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(7000)
SetAIVehicleNotifyRadius(100)




ReadDataFile("sound\\spa.lvl;spa1gcw")
ReadDataFile("dc:sound\\abc.lvl;abcgcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 8) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(1, 2) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 1) -- 3x2 (3 pairs of legs)
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 1200)
SetMemoryPoolSize("AmmoCounter", 1200)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("CommandFlyer", 4)
SetMemoryPoolSize("EnergyBar", 1600)
SetMemoryPoolSize("EntityHover", 8)
SetMemoryPoolSize("EntityCloth", 2)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 99)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 200)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", 500)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", 300)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 999)
SetMemoryPoolSize("UnitAgent", 200) -- guyCnt*2
SetMemoryPoolSize("UnitController", 300)
SetMemoryPoolSize("Weapon", 999)



SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end


ReadDataFile("dc:CND\\CND.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(IMP, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start", 0,1)
SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(IMP, "imp_spa_amb_victory")
SetDefeatMusic (IMP, "imp_spa_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
-- SetSoundEffect("BirdScatter", "birdsFlySeq1")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")

-- Camera Stats
SetAttackingTeam(IMP)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(0.998795, -0.041143, -0.026739, -0.001101, -720.435303, 809.024963, 2779.057129);
--Flag shot
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion")


end
[/code]
These scripts are just the stock space assault scripts converted to conquest scripts by following this tutorial. The functions in the cmn.lua are set up pretty much the same as a stock space cmn.lua but with the memorypools for adding jedi and now the local sides. the CNDg_Diet Dr. Pepper.lua was changed to be a conquest mission script instead of an assault mission script.

Thanks a bunch Anakin, AQT and Anthony!
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Problems with setting up locals! [Solved]

Post by Anakin »

I just know these stock ground map luas and they have skriptinit and skriptpostinit in one file ;)
Post Reply