Random att def teams [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
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Random att def teams [Solved]

Post by skelltor »

I tried kintos's trick from this topic forums/viewtopic.php?f=27&t=25743

this to be specific
THEWULFMAN wrote:This is a great idea. While I don't want to give away all my secrets,here is one KinetosImpetus came up with.

Random CW ATT/DEF

Code: Select all

if not ScriptCB_InMultiplayer() then
CIS = math.random(1,2)
REP = (3 - CIS)
else
REP = 1
CIS = 2
end
Random GCW ATT/DEF

Code: Select all

if not ScriptCB_InMultiplayer() then
ALL = math.random(1,2)
IMP = (3 - CIS)
else
IMP = 1
ALL = 2
end
If you have local teams (like ewoks or wookies), you need to have them reference the REP/CISALL/IMP names instead of ATT/DEF. Otherwise they may attack the wrong team..
on the death star and i get a ctd with this error
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `SetAttackingTeam' (number expected, got nil)
stack traceback:
[C]: in function `SetAttackingTeam'
(none): in function `ScriptInit'
Last edited by skelltor on Thu Mar 24, 2011 9:49 pm, edited 1 time in total.
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Random att def teams

Post by kinetosimpetus »

Post your lua?
skelltor wrote:I tried THEWULFMANS from this topic forums/viewtopic.php?f=27&t=25743

this to be specific

Code: Select all

[quote="THEWULFMAN"]This is a great idea. While I don't want to give away all my secrets,here is one [color=#40FF40]KinetosImpetus[/color] came up with.
[/quote]
on the death star and i get a ctd with this error 
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `SetAttackingTeam' (number expected, got nil)
stack traceback:
	[C]: in function `SetAttackingTeam'
	(none): in function `ScriptInit'[/quote]
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random att def teams

Post by skelltor »

My bad kintos I am sorry :oops:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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


---------------------------------------------------------------------------
-- 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()

TrashStuff();
PlayAnimExtend();
PlayAnimTakExtend();

BlockPlanningGraphArcs("compactor")
OnObjectKillName(CompactorConnectionOn, "grate01")

DisableBarriers("start_room_barrier")
DisableBarriers("dr_left")
DisableBarriers("circle_bar1")
DisableBarriers("circle_bar2")

-- -- handle reinforcment loss and defeat condition
-- OnCharacterDeathTeam(function(character, killer) AddReinforcements(1, -1) end, 1)
-- OnTicketCountChange(function(team, count) if count == 0 then MissionDefeat(team) end end)

OnObjectRespawnName(PlayAnimExtend, "Panel-Chasm");
OnObjectKillName(PlayAnimRetract, "Panel-Chasm");

OnObjectRespawnName(PlayAnimTakExtend, "Panel-Tak");
OnObjectKillName(PlayAnimTakRetract, "Panel-Tak");

EnableSPHeroRules()
KillObject("CP6")
cp1 = CommandPost:New{name = "CP1"}
cp2 = CommandPost:New{name = "CP2"}
cp3 = CommandPost:New{name = "CP3"}
cp4 = CommandPost:New{name = "CP4"}
cp5 = CommandPost:New{name = "CP5"}
--cp6 = CommandPost:New{name = "CP6"}
cp7 = CommandPost:New{name = "CP7"}

--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()

herosupport:AddSpawnCP("CP1","CP1Spawn")
herosupport:AddSpawnCP("CP2","CP2Spawn")
herosupport:AddSpawnCP("CP5","CP3Spawn")
herosupport:AddSpawnCP("CP3","CP4Spawn")
herosupport:AddSpawnCP("CP4","CP5Spawn")
herosupport:AddSpawnCP("CP6","CP6Spawn")
herosupport:AddSpawnCP("CP7","CP7Spawn")
herosupport:Start()

AddDeathRegion("DeathRegion01")
AddDeathRegion("DeathRegion02")
AddDeathRegion("DeathRegion03")
-- AddDeathRegion("DeathRegion04")
AddDeathRegion("DeathRegion05")

end

function CompactorConnectionOn()
UnblockPlanningGraphArcs ("compactor")
end
--START BRIDGEWORK!

-- OPEN
function PlayAnimExtend()
PauseAnimation("bridgeclose");
RewindAnimation("bridgeopen");
PlayAnimation("bridgeopen");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection122");
DisableBarriers("BridgeBarrier");

end
-- CLOSE
function PlayAnimRetract()
PauseAnimation("bridgeopen");
RewindAnimation("bridgeclose");
PlayAnimation("bridgeclose");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection122");
EnableBarriers("BridgeBarrier");

end

--START BRIDGEWORK TAK!!!

-- OPEN
function PlayAnimTakExtend()
PauseAnimation("TakBridgeOpen");
RewindAnimation("TakBridgeClose");
PlayAnimation("TakBridgeClose");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection128");
DisableBarriers("Barrier222");

end
-- CLOSE
function PlayAnimTakRetract()
PauseAnimation("TakBridgeClose");
RewindAnimation("TakBridgeOpen");
PlayAnimation("TakBridgeOpen");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection128");
EnableBarriers("Barrier222");

end

function TrashStuff()

trash_open = 1
trash_closed = 0

trash_timer = CreateTimer("trash_timer")
SetTimerValue(trash_timer, 7)
StartTimer(trash_timer)
trash_death = OnTimerElapse(
function(timer)
if trash_open == 1 then
AddDeathRegion("deathregion")
SetTimerValue(trash_timer, 5)
StartTimer(trash_timer)
trash_closed = 1
trash_open = 0
print("death region added")

elseif trash_closed == 1 then
RemoveRegion("deathregion")
SetTimerValue(trash_timer, 15)
StartTimer(trash_timer)
print("death region removed")
trash_closed = 0
trash_open = 1
end
end,
trash_timer
)
end


function ScriptInit()
StealArtistHeap(650*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4200000)
ReadDataFile("ingame.lvl")

SetMemoryPoolSize ("Combo",1000) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",1000) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",1000) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",1000) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",1000) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",1000) -- should be ~1x #combo
SetMemoryPoolSize ("ClothData",400)
SetMemoryPoolSize ("EntityCloth",400)
SetMemoryPoolSize ("Music", 200)


AISnipeSuitabilityDist(30)

if not ScriptCB_InMultiplayer() then
CIS = math.random(1,2)
REP = (3 - CIS)
else
REP = 1
CIS = 2
end

ReadDataFile("dc:sound\\ske.lvl;skecw")
ReadDataFile("sound\\dea.lvl;dea1cw")

ReadDataFile("SIDE\\BFSM\\aut.lvl",
"com_weap_inf_health_det",
"com_bldg_inf_psg")

ReadDataFile("SIDE\\BFSM\\rep.lvl",
"rep_inf_shock_rifleman",
"rep_inf_shock_rocketeer",
"rep_inf_shock_engineer",
"rep_inf_shock_sniper",
"rep_inf_officer",
"rep_inf_shock_jettrooper",
"rep_inf_commando",
"rep_inf_shadow",
"rep_inf_ep3_Commander_thire",
"rep_hero_plokoon")


ReadDataFile("SIDE\\BFSM\\cis.lvl",
"cis_inf_battledroid",
"cis_inf_assaultdroid",
"cis_inf_engineer",
"cis_inf_officer",
"cis_inf_sniper",
"cis_inf_ig_assassindroid",
"cis_inf_magnaguard_assassin",
"cis_inf_bx_commando",
"cis_inf_commander",
"cis_hero_ventress")

SetAttackingTeam(ATT)

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 300,
soldier = { "rep_inf_shock_rifleman", 9, 25},
assault = { "rep_inf_shock_rocketeer",1, 4},
engineer = { "rep_inf_shock_engineer",1, 4},
sniper = { "rep_inf_shock_sniper",1, 4},
officer = { "rep_inf_officer",1, 4},
special = { "rep_inf_shadow",1, 4},

},
cis = {
team = CIS,
units = 32,
reinforcements = 300,
soldier = { "cis_inf_battledroid", 9, 25},
assault = { "cis_inf_assaultdroid",1, 4},
engineer = { "cis_inf_engineer",1, 4},
sniper = { "cis_inf_sniper",1, 4},
officer = { "cis_inf_officer",1, 4},
special = { "cis_inf_magnaguard_assassin",1, 4},
}
}

AddUnitClass(REP, "rep_inf_shock_jettrooper",1,3)
AddUnitClass(REP, "rep_inf_commando",1,2)
AddUnitClass(REP, "rep_inf_ep3_Commander_thire",0,1)
AddUnitClass(CIS, "cis_inf_ig_assassindroid",1,3)
AddUnitClass(CIS, "cis_inf_bx_commando",1,2)
AddUnitClass(CIS, "cis_inf_commander",0,1)



-- Level Stats
ClearWalkers()
AddWalkerType(0, 2)
local weaponNum = 220
SetMemoryPoolSize ("Aimer", 10)
SetMemoryPoolSize ("AmmoCounter", weaponNum)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("CommandFlyer",5)
SetMemoryPoolSize ("EnergyBar", weaponNum)
SetMemoryPoolSize ("EntityFlyer", 6)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("MountedTurret", 2)
SetMemoryPoolSize ("Navigator", 45)
SetMemoryPoolSize ("Obstacle", 270)
SetMemoryPoolSize ("PathFollower", 45)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("SoldierAnimation",1024)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("TreeGridStack", 250)
SetMemoryPoolSize ("Weapon", weaponNum)
SetMemoryPoolSize("ParticleEmitterObject", 400)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 150)


-- SetMemoryPoolSize("Obstacle", 725)
SetSpawnDelay(10.0, 0.25)
ReadDataFile("dea\\dea1.lvl", "dea1_Conquest")
SetDenseEnvironment("false")

SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight(72)

-- Sound Stats

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("sound\\dea.lvl", "dea1")
OpenAudioStream("sound\\dea.lvl", "dea1")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
--OpenAudioStream("sound\\dea.lvl", "dea1_emt")

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_dea_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_dea_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2,"rep_dea_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_dea_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_dea_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2,"cis_dea_amb_end", 2,1)

SetVictoryMusic(REP, "rep_dea_amb_victory")
SetDefeatMusic (REP, "rep_dea_amb_defeat")
SetVictoryMusic(CIS, "cis_dea_amb_victory")
SetDefeatMusic (CIS, "cis_dea_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")


-- Camera Stats
--Tat 1 - Dune Sea
--Crawler
AddCameraShot(-0.404895, 0.000992, -0.514360, -0.002240, -121.539894, 62.536297, -257.699493)
--Homestead
AddCameraShot(0.040922, -0.004049, -0.994299, -0.098381, -103.729523, 55.546598, -225.360893)
--Sarlac Pit
AddCameraShot(-1.0, 0.0, -0.514360, 0.0, -55.381485, 50.450953, -96.514324)

herosupport = AIHeroSupport:New{AIATTHeroHealth = 5000, AIDEFHeroHealth = 5000, gameMode = "Conquest",minSpawnTime = 20,}
herosupport:SetHeroClass(CIS, "cis_hero_ventress")
herosupport:SetHeroClass(REP,"rep_hero_plokoon")

end
The reason why the set teams # is later in the la is because in the stock deac_con lua its like that ie
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
---------------------------------------------------------------------------
-- 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()

TrashStuff();
PlayAnimExtend();
PlayAnimTakExtend();

BlockPlanningGraphArcs("compactor")
OnObjectKillName(CompactorConnectionOn, "grate01")

DisableBarriers("start_room_barrier")
DisableBarriers("dr_left")
DisableBarriers("circle_bar1")
DisableBarriers("circle_bar2")

-- handle reinforcment loss and defeat condition
OnCharacterDeathTeam(function(character, killer) AddReinforcements(1, -1) end, 1)
OnTicketCountChange(function(team, count) if count == 0 then MissionDefeat(team) end end)

OnObjectRespawnName(PlayAnimExtend, "Panel-Chasm");
OnObjectKillName(PlayAnimRetract, "Panel-Chasm");

OnObjectRespawnName(PlayAnimTakExtend, "Panel-Tak");
OnObjectKillName(PlayAnimTakRetract, "Panel-Tak");

EnableSPHeroRules()
KillObject("CP6")
cp1 = CommandPost:New{name = "CP1"}
cp2 = CommandPost:New{name = "CP2"}
cp3 = CommandPost:New{name = "CP3"}
cp4 = CommandPost:New{name = "CP4"}
cp5 = CommandPost:New{name = "CP5"}
--cp6 = CommandPost:New{name = "CP6"}
cp7 = CommandPost:New{name = "CP7"}

--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()

AddDeathRegion("DeathRegion01")
AddDeathRegion("DeathRegion02")
AddDeathRegion("DeathRegion03")
AddDeathRegion("DeathRegion04")
AddDeathRegion("DeathRegion05")

end

function CompactorConnectionOn()
UnblockPlanningGraphArcs ("compactor")
end
--START BRIDGEWORK!

-- OPEN
function PlayAnimExtend()
PauseAnimation("bridgeclose");
RewindAnimation("bridgeopen");
PlayAnimation("bridgeopen");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection122");
DisableBarriers("BridgeBarrier");

end
-- CLOSE
function PlayAnimRetract()
PauseAnimation("bridgeopen");
RewindAnimation("bridgeclose");
PlayAnimation("bridgeclose");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection122");
EnableBarriers("BridgeBarrier");

end

--START BRIDGEWORK TAK!!!

-- OPEN
function PlayAnimTakExtend()
PauseAnimation("TakBridgeOpen");
RewindAnimation("TakBridgeClose");
PlayAnimation("TakBridgeClose");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection128");
DisableBarriers("Barrier222");

end
-- CLOSE
function PlayAnimTakRetract()
PauseAnimation("TakBridgeClose");
RewindAnimation("TakBridgeOpen");
PlayAnimation("TakBridgeOpen");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection128");
EnableBarriers("Barrier222");

end

function TrashStuff()

trash_open = 1
trash_closed = 0

trash_timer = CreateTimer("trash_timer")
SetTimerValue(trash_timer, 7)
StartTimer(trash_timer)
trash_death = OnTimerElapse(
function(timer)
if trash_open == 1 then
AddDeathRegion("deathregion")
SetTimerValue(trash_timer, 5)
StartTimer(trash_timer)
trash_closed = 1
trash_open = 0
print("death region added")

elseif trash_closed == 1 then
RemoveRegion("deathregion")
SetTimerValue(trash_timer, 15)
StartTimer(trash_timer)
print("death region removed")
trash_closed = 0
trash_open = 1
end
end,
trash_timer
)
end


function ScriptInit()
StealArtistHeap(650*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4200000)
ReadDataFile("ingame.lvl")

AISnipeSuitabilityDist(30)

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

ReadDataFile("sound\\dea.lvl;dea1cw")

ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hero_obiwan")

ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_droideka",
"cis_inf_officer")

ReadDataFile("SIDE\\imp.lvl",
"imp_hero_emperor")

SetAttackingTeam(ATT)

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 150,
soldier = { "rep_inf_ep3_rifleman", 7, 25},
assault = { "rep_inf_ep3_rocketeer",1, 4},
engineer = { "rep_inf_ep3_engineer",1, 4},
sniper = { "rep_inf_ep3_sniper",1, 4},
officer = { "rep_inf_ep3_officer",1, 4},
special = { "rep_inf_ep3_jettrooper",1, 4},

},
cis = {
team = CIS,
units = 32,
reinforcements = 150,
soldier = { "cis_inf_rifleman",7, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",1, 4},
sniper = { "cis_inf_sniper",1, 4},
officer = { "cis_inf_officer",1, 4},
special = { "cis_inf_droideka",1, 4},
}
}

SetHeroClass(REP, "rep_hero_obiwan")
SetHeroClass(CIS, "imp_hero_emperor")


-- Level Stats
ClearWalkers()
AddWalkerType(0, 2)
local weaponNum = 220
SetMemoryPoolSize ("Aimer", 10)
SetMemoryPoolSize ("AmmoCounter", weaponNum)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("EnergyBar", weaponNum)
SetMemoryPoolSize ("EntityFlyer", 6)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("MountedTurret", 2)
SetMemoryPoolSize ("Navigator", 45)
SetMemoryPoolSize ("Obstacle", 270)
SetMemoryPoolSize ("PathFollower", 45)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("TreeGridStack", 250)
SetMemoryPoolSize ("Weapon", weaponNum)


-- SetMemoryPoolSize("Obstacle", 725)
SetSpawnDelay(10.0, 0.25)
ReadDataFile("dea\\dea1.lvl", "dea1_Conquest")
SetDenseEnvironment("false")

SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight(72)

-- Sound Stats

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("sound\\dea.lvl", "dea1")
OpenAudioStream("sound\\dea.lvl", "dea1")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
--OpenAudioStream("sound\\dea.lvl", "dea1_emt")

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_dea_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_dea_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2,"rep_dea_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_dea_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_dea_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2,"cis_dea_amb_end", 2,1)

SetVictoryMusic(REP, "rep_dea_amb_victory")
SetDefeatMusic (REP, "rep_dea_amb_defeat")
SetVictoryMusic(CIS, "cis_dea_amb_victory")
SetDefeatMusic (CIS, "cis_dea_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")


-- Camera Stats
--Tat 1 - Dune Sea
--Crawler
AddCameraShot(-0.404895, 0.000992, -0.514360, -0.002240, -121.539894, 62.536297, -257.699493)
--Homestead
AddCameraShot(0.040922, -0.004049, -0.994299, -0.098381, -103.729523, 55.546598, -225.360893)
--Sarlac Pit
AddCameraShot(-1.0, 0.0, -0.514360, 0.0, -55.381485, 50.450953, -96.514324)

end
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Random att def teams

Post by AQT »

Try moving that entire function before ScriptInit(). If you still get a crash, try moving it before ScriptPostLoad().
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Random att def teams

Post by THEWULFMAN »

No no no :faint:

Here is my death star script
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("TCWrandom_normal")
ScriptCB_DoFile("AIHeroSupport")
---------------------------------------------------------------------------
-- 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()

TrashStuff();
PlayAnimExtend();
PlayAnimTakExtend();

BlockPlanningGraphArcs("compactor")
OnObjectKillName(CompactorConnectionOn, "grate01")

DisableBarriers("start_room_barrier")
DisableBarriers("dr_left")
DisableBarriers("circle_bar1")
DisableBarriers("circle_bar2")

-- handle reinforcment loss and defeat condition
OnCharacterDeathTeam(function(character, killer) AddReinforcements(1, -1) end, 1)
OnTicketCountChange(function(team, count) if count == 0 then MissionDefeat(team) end end)

OnObjectRespawnName(PlayAnimExtend, "Panel-Chasm");
OnObjectKillName(PlayAnimRetract, "Panel-Chasm");

OnObjectRespawnName(PlayAnimTakExtend, "Panel-Tak");
OnObjectKillName(PlayAnimTakRetract, "Panel-Tak");

EnableSPHeroRules()

if not ScriptCB_InMultiplayer() then
herosupport = AIHeroSupport:New{AIATTHeroHealth = 2500, AIDEFHeroHealth = 2500, gameMode = "NonConquest",}
herosupport:SetHeroClass(REP, herostrRep)
herosupport:SetHeroClass(CIS, herostrCis)
herosupport:AddSpawnCP("CP1","CP1Spawn")
herosupport:AddSpawnCP("CP2","CP2Spawn")
herosupport:AddSpawnCP("CP3","CP3Spawn")
herosupport:AddSpawnCP("CP4","CP4Spawn")
herosupport:AddSpawnCP("CP5","CP5Spawn")
herosupport:AddSpawnCP("CP7","CP7Spawn")
herosupport:Start()
else
end

KillObject("CP6")
cp1 = CommandPost:New{name = "CP1"}
cp2 = CommandPost:New{name = "CP2"}
cp3 = CommandPost:New{name = "CP3"}
cp4 = CommandPost:New{name = "CP4"}
cp5 = CommandPost:New{name = "CP5"}
--cp6 = CommandPost:New{name = "CP6"}
cp7 = CommandPost:New{name = "CP7"}

--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()

AddDeathRegion("DeathRegion01")
AddDeathRegion("DeathRegion02")
AddDeathRegion("DeathRegion03")
AddDeathRegion("DeathRegion04")
AddDeathRegion("DeathRegion05")

end

function CompactorConnectionOn()
UnblockPlanningGraphArcs ("compactor")
end
--START BRIDGEWORK!

-- OPEN
function PlayAnimExtend()
PauseAnimation("bridgeclose");
RewindAnimation("bridgeopen");
PlayAnimation("bridgeopen");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection122");
DisableBarriers("BridgeBarrier");

end
-- CLOSE
function PlayAnimRetract()
PauseAnimation("bridgeopen");
RewindAnimation("bridgeclose");
PlayAnimation("bridgeclose");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection122");
EnableBarriers("BridgeBarrier");

end

--START BRIDGEWORK TAK!!!

-- OPEN
function PlayAnimTakExtend()
PauseAnimation("TakBridgeOpen");
RewindAnimation("TakBridgeClose");
PlayAnimation("TakBridgeClose");

-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection128");
DisableBarriers("Barrier222");

end
-- CLOSE
function PlayAnimTakRetract()
PauseAnimation("TakBridgeClose");
RewindAnimation("TakBridgeOpen");
PlayAnimation("TakBridgeOpen");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection128");
EnableBarriers("Barrier222");

end

function TrashStuff()

trash_open = 1
trash_closed = 0

trash_timer = CreateTimer("trash_timer")
SetTimerValue(trash_timer, 7)
StartTimer(trash_timer)
trash_death = OnTimerElapse(
function(timer)
if trash_open == 1 then
AddDeathRegion("deathregion")
SetTimerValue(trash_timer, 5)
StartTimer(trash_timer)
trash_closed = 1
trash_open = 0
print("death region added")

elseif trash_closed == 1 then
RemoveRegion("deathregion")
SetTimerValue(trash_timer, 15)
StartTimer(trash_timer)
print("death region removed")
trash_closed = 0
trash_open = 1
end
end,
trash_timer
)
end


function ScriptInit()
StealArtistHeap(650*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4200000)

tcwera = math.random(1,4)

if tcwera < 5 then
DecideUnits(0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1)
end


ReadDataFile("dc:ingame.lvl")
ReadDataFile("ingame.lvl")
ReadDataFile("dc:ingame-stuff.lvl")

AISnipeSuitabilityDist(30)

SetMemoryPoolSize ("Music",200)

SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo

-- Republic Attacking (attacker is always #1)
ATT = 1
DEF = 2
--this never changes, ever, no really, i mean it, lol.

if not ScriptCB_InMultiplayer() then
CIS = math.random(1,2)
REP = (3 - CIS)
else
REP = 1
CIS = 2
end

ReadDataFile("sound\\dea.lvl;dea1cw")
ReadDataFile("dc:sound\\sws.lvl;swscw")
ReadDataFile("dc:sound\\tcw.lvl;tcwcw")



ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")

ReadDataFile("dc:SIDE\\7th.lvl",
hriflemanstrRep,
heavystrRep,
sniperstrRep,
engineerstrRep,
lriflemanstrRep,
sriflemanstrRep,
jettrooperstrRep,
specialstrRep,
commanderstrRep,
herostrRep)

ReadDataFile("dc:SIDE\\cisheroes.lvl",
herostrCis)

ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_droideka",
"cis_inf_officer",
"cis_inf_firedroid",
"cis_inf_airdroid",
specialunitstrCis,
"cis_inf_marine")



SetAttackingTeam(ATT)


SetupTeams{
rep = {
team = REP,
units = 26,
reinforcements = 230,
soldier = { hriflemanstrRep,7, 18},
assault = { heavystrRep,1, 4},
engineer = { engineerstrRep,1, 4},
sniper = { sniperstrRep,1, 3},
officer = { lriflemanstrRep,4, 6},
special = { sriflemanstrRep,1, 4},

},
cis = {
team = CIS,
units = 50,
reinforcements = 330,
soldier = { "cis_inf_marine",22, 55},
assault = { "cis_inf_rifleman",4, 6},
engineer = { "cis_inf_engineer",1, 3},
sniper = { "cis_inf_sniper",1, 2},
officer = { "cis_inf_airdroid",1, 2},
special = { "cis_inf_firedroid",1, 2},
}
}

AddUnitClass(REP, jettrooperstrRep,1, 3)
AddUnitClass(REP, specialstrRep,1, 2)
AddUnitClass(REP, commanderstrRep,1, 1)
AddUnitClass(CIS, "cis_inf_droideka",2, 3)
AddUnitClass(CIS, "cis_inf_officer",1, 2)
AddUnitClass(CIS, specialunitstrCis,1, 1)


-- Level Stats
ClearWalkers()
AddWalkerType(0, 2)
local weaponNum = 220
SetMemoryPoolSize ("Aimer", 10)
SetMemoryPoolSize ("AmmoCounter", weaponNum)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("EnergyBar", weaponNum)
SetMemoryPoolSize ("EntityFlyer", 6)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("SoldierAnimation", 800)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 500)
SetMemoryPoolSize("ParticleTransformer::PositionTr", 1700)
SetMemoryPoolSize("ParticleTransformer::SizeTransf", 1900)
SetMemoryPoolSize("ParticleTransformer::ColorTrans", 2800)
SetMemoryPoolSize ("MountedTurret", 2)
SetMemoryPoolSize ("Navigator", 45)
SetMemoryPoolSize ("Obstacle", 270)
SetMemoryPoolSize ("PathFollower", 45)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("TreeGridStack", 250)
SetMemoryPoolSize ("Weapon", weaponNum)


-- SetMemoryPoolSize("Obstacle", 725)
SetSpawnDelay(10.0, 0.25)
ReadDataFile("dea\\dea1.lvl", "dea1_Conquest")
SetDenseEnvironment("false")

SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight(72)

-- Sound Stats

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\\tcw.lvl", "tcwcw_music");
OpenAudioStream("dc:sound\\tcw.lvl", "tcw");
OpenAudioStream("sound\\dea.lvl", "dea1")
OpenAudioStream("sound\\dea.lvl", "dea1")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
--OpenAudioStream("sound\\dea.lvl", "dea1_emt")

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_tcw_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_tcw_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_tcw_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "rep_tcw_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "rep_tcw_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "rep_tcw_amb_end", 2,1)

SetVictoryMusic(REP, "rep_tcw_amb_victory")
SetDefeatMusic (REP, "rep_tcw_amb_victory")
SetVictoryMusic(CIS, "rep_tcw_amb_victory")
SetDefeatMusic (CIS, "rep_tcw_amb_victory")

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")


-- Camera Stats
--Tat 1 - Dune Sea
--Crawler
AddCameraShot(-0.404895, 0.000992, -0.514360, -0.002240, -121.539894, 62.536297, -257.699493)
--Homestead
AddCameraShot(0.040922, -0.004049, -0.994299, -0.098381, -103.729523, 55.546598, -225.360893)
--Sarlac Pit
AddCameraShot(-1.0, 0.0, -0.514360, 0.0, -55.381485, 50.450953, -96.514324)

end

I have found it doesnt really matter where you put it. As long as its done right.

and I do belive tis was missing
ATT = 1
DEF = 2
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random att def teams

Post by skelltor »

Ok Thanks that works :) btw gcw doesn't seam to be working for me (I changed the CIS to ALL cuz other wise i got a ctd)
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Random att def teams

Post by THEWULFMAN »

skelltor wrote:Ok Thanks that works :) btw gcw doesn't seam to be working for me (I changed the CIS to ALL cuz other wise i got a ctd)

Did you change REP to IMP?

Lets see your lua :)
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random att def teams

Post by skelltor »

nm I got it to work :D
Post Reply