Random sides crashing [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
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Random sides crashing [Solved]

Post by Dreadnot9 »

I have a random side selection setup using the following scripts:
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")
--ScriptCB_DoFile("RandomHeroREP")
--ScriptCB_DoFile("RandomHeroCIS")
ScriptCB_DoFile("RandomSetupCIS")
ScriptCB_DoFile("RandomSetupREP")
---------------------------------------------------------------------------
-- 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.
---------------------------------------------------------------------------
-- Republic Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2

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

TroopSpawnerWeapon = "rep_weap_inf_reinforcements_ord"

OnCharacterDispenseControllableTeam(
function(character,controlled)
if GetEntityClass(controlled) == GetEntityClassPtr(TroopSpawnerWeapon) then
local SupportTeam = 3 --Team the new spawned character is in (change this)
local teamSize = GetTeamSize(SupportTeam)
for i = 0, teamSize-1 do
local characterIndex = GetTeamMember(SupportTeam, i)
local charUnit = GetCharacterUnit(characterIndex)
if not charUnit then
local destination = GetEntityMatrix(GetCharacterUnit(character))
SpawnCharacter(characterIndex,destination)
AddAIGoal(3, "Follow", 80, 0 )
AddAIGoal(3, "Deathmatch", 20 )
end
end
end
end,
REP --User team (change this)
)

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

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were added!

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

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

ReadDataFile("sound\\dea.lvl;dea1cw")
ReadDataFile("dc:sound\\bx_sound.lvl")
ReadDataFile("dc:sound\\ric.lvl;riccw")
ReadDataFile("dc:SIDE\\her.lvl",
"rep_hero_obiwan",
"cis_hero_durge")
ReadDataFile("dc:SIDE\\modrep.lvl",
"rep_inf_rifleman",
"rep_inf_sniper",
"rep_inf_blank",
"rep_inf_support",
"rep_inf_engineer",
"rep_inf_flametrooper",
"rep_inf_rocketeer",
"rep_inf_gunner",
"rep_inf_commander",
"rep_inf_arc",
"rep_inf_heavy",
"rep_inf_captain",
"rep_inf_barc",
"rep_inf_shadow",
"rep_inf_jettrooper",
"rep_hero_boss")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bdroid",
"cis_inf_sniper",
"cis_inf_ig",
"cis_inf_slaver",
"cis_inf_merc",
"cis_inf_sbd",
"cis_inf_ubd",
"cis_inf_magnaguard",
"cis_inf_rocketeer",
"cis_inf_droideka",
"cis_inf_engineer",
"cis_inf_airdroid",
"cis_inf_sarge",
"cis_inf_shadow",
"cis_inf_geonosian",
"cis_inf_OOM")

SetClassProperty("cis_inf_bdroid", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_sniper", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_engineer", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_rocketeer", "OverrideTexture", "cis_inf_battledroid_blue")



--rep = {
-- team = REP,
-- units = 32,
-- reinforcements = 200,
-- soldier = { "rep_inf_rifleman",8, 24},
-- assault = { "rep_inf_rocketeer",2, 6},
-- sniper = { "rep_inf_sniper",2, 6},
-- officer = { "rep_inf_engineer",2, 4},
-- marine = { "rep_inf_gunner",2, 4},
-- special = {"rep_inf_heavy",2, 4},
-- extra1 = { "rep_inf_shadow",2, 2},
-- extra2 = { "rep_inf_arc",1, 1},

--},
RandomSetupREP()

SetupTeams{
CIS = {
team = CIS,
units = 32,
reinforcements = 200,
soldier = { "cis_inf_bdroid",8, 24},
assault = { "cis_inf_rocketeer",2, 6},
sniper = { "cis_inf_sniper",2, 6},
officer = {"cis_inf_engineer",2, 4},
marine = {"cis_inf_sarge",2, 4},
special = { "cis_inf_slaver",2, 4},
extra1 = { "cis_inf_magnaguard",2, 4},
extra2 = { "cis_inf_merc",1, 2},
},
}

SetAttackingTeam(ATT)

SetTeamName(3, "jawas")
SetUnitCount (3, 4)
AddUnitClass (3, "rep_inf_rifleman", 2, 4)
--first number is numteam, second is numunits
SetTeamAsFriend(REP,3)
SetTeamAsFriend(3,REP)
SetTeamAsEnemy(CIS,3)
SetTeamAsEnemy(3,CIS)

--AIHeroSupport
herosupport = AIHeroSupport:New{AIATTHeroHealth = 3000, AIDEFHeroHealth = 3000, gameMode = "Conquest",}
herosupport:SetHeroClass(REP, "rep_hero_boss")
herosupport:SetHeroClass(CIS, "cis_inf_ubd")

-- 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
Hidden/Spoiler:
--
-- Random Sides Script for Star Wars Battlefront II Copyright (c) 2007 A.A.5. Productionzorz, All rights reserved.
-- Side Setup Script, Star Wars Battlefront II and Zero Engine Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
function RandomSetupREP()
if unexpected_condition then error() end
RandomSetupREP = math.random(1,10) --Pic a number between 1 and 10

if RandomSetupREP <4 then --if math.random results in 2 or three (and maybe 1)

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
},
}
end


if RandomSetupREP >3 and RandomSetupREP <6 then --if math.random results in 4 or 5

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
},
}
end

if RandomSetupREP >5 and RandomSetupREP <8 then --if math.random results in 6 or 7

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
},
}
end

if RandomSetupREP >7 and RandomSetupREP <11 then --if math.random results in 8 or 10

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
},
}
end
end
Hidden/Spoiler:
ucft
{
REQN
{
"config"
"ingame_movies"
}

REQN
{
"script"
"setup_teams"
"gametype_conquest"
"gametype_capture"
"Objective"
"MultiObjectiveContainer"
"ObjectiveCTF"
"ObjectiveAssault"
"ObjectiveSpaceAssault"
"ObjectiveConquest"
"ObjectiveTDM"
"ObjectiveDM"
"ObjectiveOneFlagCTF"
"ObjectiveVIP"
"SoundEvent_ctf"
"ObjectiveGoto"
"LinkedShields"
"LinkedDestroyables"
"LinkedTurrets"
"Ambush"
"PlayMovieWithTransition"
"AIHeroSupport"
"RandomSetupCIS"
"RandomSetupREP"
}

REQN
{
"lvl"
"cor1w_con"
"cor1w_ins"
"cor1w_siege"
"cor1w_tdm"
"dag1w_con"
"DANw_con"
"DANw_hunt"
"DANw_ins"
"DANw_surv"
"DANw_tdm"
"DANw_uber"
"dea1w_con"
"dea1w_wav"
"fel1w_con"
"fel1w_tdm"
"fel1w_uber"
"geo1w_con"
"geo1w_uber"
"kam1w_con"
"kam1w_tdm"
"kas2w_con"
"kas2w_hunt"
"kas2w_tdm"
"kas2w_uber"
"mus1w_con"
"mus1w_tdm"
"myg1w_con"
"myg1w_tdm"
"myg1w_uber"
"nab2w_con"
"nab2w_tdm"
"pol1w_con"
"pol1w_tdm"
"spa3w_Diet Dr. Pepper"
"spa6w_Diet Dr. Pepper"
"spa7w_Diet Dr. Pepper"
"tan1w_con"
"tan1w_ins"
"tan1w_tdm"
"tat2w_con"
"tat2w_hunt"
"tat2w_tdm"
"tat3w_con"
"uta1w_con"
"uta1w_tdm"
"WHOw_con"
"WHOw_1flag"
"WHOw_hunt"
"WHOw_tdm"
"yav1w_con"
"yav1w_tdm"
"yav2w_1flag"
"yav2w_con"
"yav2w_tdm"
"yav2w_dm"
"yav2w_wav"
}
}
All units work when not trying to load them through the random sides script, and I get this error of interest from the Bfront.log
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `SetTeamName' (number expected, got nil)
stack traceback:
[C]: in function `SetTeamName'
(none): in function `SetupTeams'
(none): in function `RandomSetupREP'
(none): in function `ScriptInit'
Any help would be appreciated, thanks.
Last edited by Dreadnot9 on Mon Jul 08, 2013 1:24 am, edited 1 time in total.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Random sides crashing

Post by AQT »

Not sure if this will work, but try the following:

Replace the following section:
Hidden/Spoiler:
[code]RandomSetupREP()

SetupTeams{
CIS = {
team = CIS,
units = 32,
reinforcements = 200,
soldier = { "cis_inf_bdroid",8, 24},
assault = { "cis_inf_rocketeer",2, 6},
sniper = { "cis_inf_sniper",2, 6},
officer = {"cis_inf_engineer",2, 4},
marine = {"cis_inf_sarge",2, 4},
special = { "cis_inf_slaver",2, 4},
extra1 = { "cis_inf_magnaguard",2, 4},
extra2 = { "cis_inf_merc",1, 2},
},
}[/code]
with:
Hidden/Spoiler:
[code] SetupTeams{
rep = REPUBLICTEAM,
cis = {
team = CIS,
units = 32,
reinforcements = 200,
soldier = { "cis_inf_bdroid",8, 24},
assault = { "cis_inf_rocketeer",2, 6},
sniper = { "cis_inf_sniper",2, 6},
officer = {"cis_inf_engineer",2, 4},
marine = {"cis_inf_sarge",2, 4},
special = { "cis_inf_slaver",2, 4},
extra1 = { "cis_inf_magnaguard",2, 4},
extra2 = { "cis_inf_merc",1, 2},
}
}[/code]
And use this new randomizing code instead:
Hidden/Spoiler:
[code]RandomSetupREP = math.random(1,10) --Pic a number between 1 and 10

if RandomSetupREP <4 then --if math.random results in 2 or three (and maybe 1)

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
end

if RandomSetupREP >3 and RandomSetupREP <6 then --if math.random results in 4 or 5

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
end

if RandomSetupREP >5 and RandomSetupREP <8 then --if math.random results in 6 or 7

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
end

if RandomSetupREP >7 and RandomSetupREP <11 then --if math.random results in 8 or 10

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
end[/code]
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Re: Random sides crashing

Post by Dreadnot9 »

Getting a ctd with the changed scripts:
Hidden/Spoiler:
--
-- Random Sides Script for Star Wars Battlefront II Copyright (c) 2007 A.A.5. Productionzorz, All rights reserved.
-- Side Setup Script, Star Wars Battlefront II and Zero Engine Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
function RandomSetupREP()
if unexpected_condition then error() end
RandomSetupREP = math.random(1,10) --Pic a number between 1 and 10

if RandomSetupREP <4 then --if math.random results in 2 or three (and maybe 1)

--SetupTeams{
RepublicTeam = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
--}
end


if RandomSetupREP >3 and RandomSetupREP <6 then --if math.random results in 4 or 5

--SetupTeams{
RepublicTeam = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
--}
end

if RandomSetupREP >5 and RandomSetupREP <8 then --if math.random results in 6 or 7

--SetupTeams{
RepublicTeam = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
--}
end

if RandomSetupREP >7 and RandomSetupREP <11 then --if math.random results in 8 or 10

--SetupTeams{
RepublicTeam = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
--}
end
end
And here's dea1w_con:
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")
--ScriptCB_DoFile("RandomHeroREP")
--ScriptCB_DoFile("RandomHeroCIS")
ScriptCB_DoFile("RandomSetupCIS")
ScriptCB_DoFile("RandomSetupREP")
---------------------------------------------------------------------------
-- 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.
---------------------------------------------------------------------------
-- Republic Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2

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

TroopSpawnerWeapon = "rep_weap_inf_reinforcements_ord"

OnCharacterDispenseControllableTeam(
function(character,controlled)
if GetEntityClass(controlled) == GetEntityClassPtr(TroopSpawnerWeapon) then
local SupportTeam = 3 --Team the new spawned character is in (change this)
local teamSize = GetTeamSize(SupportTeam)
for i = 0, teamSize-1 do
local characterIndex = GetTeamMember(SupportTeam, i)
local charUnit = GetCharacterUnit(characterIndex)
if not charUnit then
local destination = GetEntityMatrix(GetCharacterUnit(character))
SpawnCharacter(characterIndex,destination)
AddAIGoal(3, "Follow", 80, 0 )
AddAIGoal(3, "Deathmatch", 20 )
end
end
end
end,
REP --User team (change this)
)

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

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were added!

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

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

ReadDataFile("sound\\dea.lvl;dea1cw")
ReadDataFile("dc:sound\\bx_sound.lvl")
ReadDataFile("dc:sound\\ric.lvl;riccw")
ReadDataFile("dc:SIDE\\her.lvl",
"rep_hero_obiwan",
"cis_hero_durge")
ReadDataFile("dc:SIDE\\modrep.lvl",
"rep_inf_rifleman",
"rep_inf_sniper",
"rep_inf_blank",
"rep_inf_support",
"rep_inf_engineer",
"rep_inf_flametrooper",
"rep_inf_rocketeer",
"rep_inf_gunner",
"rep_inf_commander",
"rep_inf_arc",
"rep_inf_heavy",
"rep_inf_captain",
"rep_inf_barc",
"rep_inf_shadow",
"rep_inf_jettrooper",
"rep_hero_boss")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bdroid",
"cis_inf_sniper",
"cis_inf_ig",
"cis_inf_slaver",
"cis_inf_merc",
"cis_inf_sbd",
"cis_inf_ubd",
"cis_inf_magnaguard",
"cis_inf_rocketeer",
"cis_inf_droideka",
"cis_inf_engineer",
"cis_inf_airdroid",
"cis_inf_sarge",
"cis_inf_shadow",
"cis_inf_geonosian",
"cis_inf_OOM")

SetClassProperty("cis_inf_bdroid", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_sniper", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_engineer", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_rocketeer", "OverrideTexture", "cis_inf_battledroid_blue")



--rep = {
-- team = REP,
-- units = 32,
-- reinforcements = 200,
-- soldier = { "rep_inf_rifleman",8, 24},
-- assault = { "rep_inf_rocketeer",2, 6},
-- sniper = { "rep_inf_sniper",2, 6},
-- officer = { "rep_inf_engineer",2, 4},
-- marine = { "rep_inf_gunner",2, 4},
-- special = {"rep_inf_heavy",2, 4},
-- extra1 = { "rep_inf_shadow",2, 2},
-- extra2 = { "rep_inf_arc",1, 1},

--},
--RandomSetupREP()

SetupTeams{
REP = RepublicTeam,
cis = {
team = CIS,
units = 32,
reinforcements = 200,
soldier = { "cis_inf_bdroid",8, 24},
assault = { "cis_inf_rocketeer",2, 6},
sniper = { "cis_inf_sniper",2, 6},
officer = {"cis_inf_engineer",2, 4},
marine = {"cis_inf_sarge",2, 4},
special = { "cis_inf_slaver",2, 4},
extra1 = { "cis_inf_magnaguard",2, 4},
extra2 = { "cis_inf_merc",1, 2},
},
}

SetAttackingTeam(ATT)

SetTeamName(3, "jawas")
SetUnitCount (3, 4)
AddUnitClass (3, "rep_inf_rifleman", 2, 4)
--first number is numteam, second is numunits
SetTeamAsFriend(REP,3)
SetTeamAsFriend(3,REP)
SetTeamAsEnemy(CIS,3)
SetTeamAsEnemy(3,CIS)

--AIHeroSupport
herosupport = AIHeroSupport:New{AIATTHeroHealth = 3000, AIDEFHeroHealth = 3000, gameMode = "Conquest",}
herosupport:SetHeroClass(REP, "rep_hero_boss")
herosupport:SetHeroClass(CIS, "cis_inf_ubd")

-- 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
However, there are no errors of interest in the error log this time around.

EDIT: Went through and capitalized the variable "RepublicTeam" to no avail, in case that could've been the culprit.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Random sides crashing

Post by AQT »

You currently have:

Code: Select all

REP = RepublicTeam,
It should be:

Code: Select all

rep = RepublicTeam,
Since REP was already assigned to 1, reassigning it to RepublicTeam makes the game not know who team 1 should be.
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Re: Random sides crashing

Post by Dreadnot9 »

New scripts, still crashing...
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")
--ScriptCB_DoFile("RandomHeroREP")
--ScriptCB_DoFile("RandomHeroCIS")
ScriptCB_DoFile("RandomSetupCIS")
ScriptCB_DoFile("RandomSetupREP")
---------------------------------------------------------------------------
-- 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.
---------------------------------------------------------------------------
-- Republic Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2

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

TroopSpawnerWeapon = "rep_weap_inf_reinforcements_ord"

OnCharacterDispenseControllableTeam(
function(character,controlled)
if GetEntityClass(controlled) == GetEntityClassPtr(TroopSpawnerWeapon) then
local SupportTeam = 3 --Team the new spawned character is in (change this)
local teamSize = GetTeamSize(SupportTeam)
for i = 0, teamSize-1 do
local characterIndex = GetTeamMember(SupportTeam, i)
local charUnit = GetCharacterUnit(characterIndex)
if not charUnit then
local destination = GetEntityMatrix(GetCharacterUnit(character))
SpawnCharacter(characterIndex,destination)
AddAIGoal(3, "Follow", 80, 0 )
AddAIGoal(3, "Deathmatch", 20 )
end
end
end
end,
REP --User team (change this)
)

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

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were added!

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

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

ReadDataFile("sound\\dea.lvl;dea1cw")
ReadDataFile("dc:sound\\bx_sound.lvl")
ReadDataFile("dc:sound\\ric.lvl;riccw")
ReadDataFile("dc:SIDE\\her.lvl",
"rep_hero_obiwan",
"cis_hero_durge")
ReadDataFile("dc:SIDE\\modrep.lvl",
"rep_inf_rifleman",
"rep_inf_sniper",
"rep_inf_blank",
"rep_inf_support",
"rep_inf_engineer",
"rep_inf_flametrooper",
"rep_inf_rocketeer",
"rep_inf_gunner",
"rep_inf_commander",
"rep_inf_arc",
"rep_inf_heavy",
"rep_inf_captain",
"rep_inf_barc",
"rep_inf_shadow",
"rep_inf_jettrooper",
"rep_hero_boss")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bdroid",
"cis_inf_sniper",
"cis_inf_ig",
"cis_inf_slaver",
"cis_inf_merc",
"cis_inf_sbd",
"cis_inf_ubd",
"cis_inf_magnaguard",
"cis_inf_rocketeer",
"cis_inf_droideka",
"cis_inf_engineer",
"cis_inf_airdroid",
"cis_inf_sarge",
"cis_inf_shadow",
"cis_inf_geonosian",
"cis_inf_OOM")

SetClassProperty("cis_inf_bdroid", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_sniper", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_engineer", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_rocketeer", "OverrideTexture", "cis_inf_battledroid_blue")



--rep = {
-- team = REP,
-- units = 32,
-- reinforcements = 200,
-- soldier = { "rep_inf_rifleman",8, 24},
-- assault = { "rep_inf_rocketeer",2, 6},
-- sniper = { "rep_inf_sniper",2, 6},
-- officer = { "rep_inf_engineer",2, 4},
-- marine = { "rep_inf_gunner",2, 4},
-- special = {"rep_inf_heavy",2, 4},
-- extra1 = { "rep_inf_shadow",2, 2},
-- extra2 = { "rep_inf_arc",1, 1},

--},
--RandomSetupREP()

SetupTeams{
rep = REPUBLICTEAM,
cis = {
team = CIS,
units = 32,
reinforcements = 200,
soldier = { "cis_inf_bdroid",8, 24},
assault = { "cis_inf_rocketeer",2, 6},
sniper = { "cis_inf_sniper",2, 6},
officer = {"cis_inf_engineer",2, 4},
marine = {"cis_inf_sarge",2, 4},
special = { "cis_inf_slaver",2, 4},
extra1 = { "cis_inf_magnaguard",2, 4},
extra2 = { "cis_inf_merc",1, 2},
},
}

SetAttackingTeam(ATT)

SetTeamName(3, "jawas")
SetUnitCount (3, 4)
AddUnitClass (3, "rep_inf_rifleman", 2, 4)
--first number is numteam, second is numunits
SetTeamAsFriend(REP,3)
SetTeamAsFriend(3,REP)
SetTeamAsEnemy(CIS,3)
SetTeamAsEnemy(3,CIS)

--AIHeroSupport
herosupport = AIHeroSupport:New{AIATTHeroHealth = 3000, AIDEFHeroHealth = 3000, gameMode = "Conquest",}
herosupport:SetHeroClass(REP, "rep_hero_boss")
herosupport:SetHeroClass(CIS, "cis_inf_ubd")

-- 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
Hidden/Spoiler:
--
-- Random Sides Script for Star Wars Battlefront II Copyright (c) 2007 A.A.5. Productionzorz, All rights reserved.
-- Side Setup Script, Star Wars Battlefront II and Zero Engine Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
function RandomSetupREP()
if unexpected_condition then error() end
RandomSetupREP = math.random(1,10) --Pic a number between 1 and 10

if RandomSetupREP <4 then --if math.random results in 2 or three (and maybe 1)

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
end

if RandomSetupREP >3 and RandomSetupREP <6 then --if math.random results in 4 or 5

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
end

if RandomSetupREP >5 and RandomSetupREP <8 then --if math.random results in 6 or 7

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_jettrooper",2, 4},
extra2 = { "rep_inf_heavy",1, 2},
extra3 = { "rep_inf_arc",1, 1},
}
end

if RandomSetupREP >7 and RandomSetupREP <11 then --if math.random results in 8 or 10

REPUBLICTEAM = {
team = REP,
units = 32,
reinforcements = 200,
soldier = { "rep_inf_rifleman",8, 24},
assault = { "rep_inf_rocketeer",2, 6},
sniper = { "rep_inf_sniper",2, 6},
officer = { "rep_inf_engineer",2, 4},
special = {"rep_inf_gunner",2, 4},
extra1 = { "rep_inf_flametrooper",2, 4},
extra2 = { "rep_inf_shadow",1, 2},
extra3 = { "rep_inf_captain",1, 1},
}
end
end
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Random sides crashing

Post by AQT »

Code: Select all

ScriptCB_DoFile("RandomSetupCIS")
What does that file do?
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Re: Random sides crashing

Post by Dreadnot9 »

AQT wrote:

Code: Select all

ScriptCB_DoFile("RandomSetupCIS")
What does that file do?
Nothing at the moment, I'll try removing it for now, good spot.

EDIT: Well, still crashed after commenting out, I suppose I didn't really answer your question either; it was a script I used a while ago to randomize my cis sides, as well as the republic script. But that was before I change a lot of the sides (new units and such), so I had to change the scripts as well.

EDIT2: I've reverted back to a non-random sides to test out all the units to make sure the problem doesn't lie there, so far no crashes.
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Random sides crashing

Post by Locutus »

You are loading ScriptCB_DoFile("RandomSetupREP") right at the top of your script.
In the script you are assigning units to their classes.

Maybe it fails because you haven't loaded ReadDataFile("dc:SIDE\\modrep.lvl") at this point?
(Just guessing here...)
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Re: Random sides crashing

Post by Dreadnot9 »

Locutus wrote:You are loading ScriptCB_DoFile("RandomSetupREP") right at the top of your script.
In the script you are assigning units to their classes.

Maybe it fails because you haven't loaded ReadDataFile("dc:SIDE\\modrep.lvl") at this point?
(Just guessing here...)
It's a possibility, though I doubt it, I can try moving it I suppose...

EDIT: Tried it to no avail, thanks for the suggestion though.

EDIT2: EUREKA! Got it working, turns out at the beginning of my mission lua I had the team numbers/names/etc only defined locally, simply got rid of the the "local" lines (highlighted in red below) and it worked perfectly!
Thanks for all the patience and help AQT and Locutus.
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")
--ScriptCB_DoFile("RandomHeroREP")
--ScriptCB_DoFile("RandomHeroCIS")
ScriptCB_DoFile("RandomSetupCIS")
ScriptCB_DoFile("RandomSetupREP")
---------------------------------------------------------------------------
-- 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.
---------------------------------------------------------------------------
-- Republic Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2

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

TroopSpawnerWeapon = "rep_weap_inf_reinforcements_ord"

OnCharacterDispenseControllableTeam(
function(character,controlled)
if GetEntityClass(controlled) == GetEntityClassPtr(TroopSpawnerWeapon) then
local SupportTeam = 3 --Team the new spawned character is in (change this)
local teamSize = GetTeamSize(SupportTeam)
for i = 0, teamSize-1 do
local characterIndex = GetTeamMember(SupportTeam, i)
local charUnit = GetCharacterUnit(characterIndex)
if not charUnit then
local destination = GetEntityMatrix(GetCharacterUnit(character))
SpawnCharacter(characterIndex,destination)
AddAIGoal(3, "Follow", 80, 0 )
AddAIGoal(3, "Deathmatch", 20 )
end
end
end
end,
REP --User team (change this)
)

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

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were added!

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

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

ReadDataFile("sound\\dea.lvl;dea1cw")
ReadDataFile("dc:sound\\bx_sound.lvl")
ReadDataFile("dc:sound\\ric.lvl;riccw")
ReadDataFile("dc:SIDE\\her.lvl",
"rep_hero_obiwan",
"cis_hero_durge")
--ReadDataFile("dc:SIDE\\modrep.lvl",
-- "rep_inf_rifleman",
-- "rep_inf_sniper",
-- "rep_inf_blank",
-- "rep_inf_support",
-- "rep_inf_engineer",
-- "rep_inf_flametrooper",
-- "rep_inf_rocketeer",
-- "rep_inf_gunner",
-- "rep_inf_commander",
-- "rep_inf_arc",
-- "rep_inf_heavy",
-- "rep_inf_medic",
-- "rep_inf_captain",
-- "rep_inf_barc",
-- "rep_inf_shadow",
-- "rep_inf_jettrooper",
-- "rep_hero_boss")
--ReadDataFile("dc:SIDE\\cis.lvl",
-- "cis_inf_bdroid",
-- "cis_inf_sniper",
-- "cis_inf_ig",
-- "cis_inf_slaver",
-- "cis_inf_merc",
-- "cis_inf_sbd",
-- "cis_inf_ubd",
-- "cis_inf_magnaguard",
-- "cis_inf_rocketeer",
-- "cis_inf_droideka",
-- "cis_inf_engineer",
-- "cis_inf_airdroid",
-- "cis_inf_sarge",
-- "cis_inf_shadow",
-- "cis_inf_geonosian",
-- "cis_inf_OOM")

SetAttackingTeam(ATT)

RandomSetupCIS()
RandomSetupREP()
--SetupTeams{
--rep = {
-- team = REP,
-- units = 32,
-- reinforcements = 200,
-- soldier = { "rep_inf_rifleman",8, 24},
-- assault = { "rep_inf_rocketeer",2, 6},
-- sniper = { "rep_inf_sniper",2, 6},
-- officer = { "rep_inf_engineer",2, 4},
-- special = { "rep_inf_medic",2, 4},
-- extra1 = {"rep_inf_heavy",2, 4},
-- extra2 = { "rep_inf_shadow",2, 2},
-- extra3 = { "rep_inf_arc",1, 1},
-- }
--}

--SetupTeams{
--rep = REPUBLICTEAM,
--cis = {
-- team = CIS,
-- units = 32,
-- reinforcements = 200,
-- soldier = { "cis_inf_bdroid",8, 24},
-- assault = { "cis_inf_rocketeer",2, 6},
-- sniper = { "cis_inf_sniper",2, 6},
-- officer = {"cis_inf_engineer",2, 4},
-- special = {"cis_inf_sarge",2, 4},
-- extra1 = { "cis_inf_slaver",2, 4},
-- extra2 = { "cis_inf_magnaguard",2, 4},
-- extra3 = { "cis_inf_merc",1, 2},
--}
--}

SetClassProperty("cis_inf_bdroid", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_sniper", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_engineer", "OverrideTexture", "cis_inf_battledroid_blue")
SetClassProperty("cis_inf_rocketeer", "OverrideTexture", "cis_inf_battledroid_blue")

SetTeamName(3, "jawas")
SetUnitCount (3, 4)
AddUnitClass (3, "rep_inf_rifleman", 2, 4)
--first number is numteam, second is numunits
SetTeamAsFriend(REP,3)
SetTeamAsFriend(3,REP)
SetTeamAsEnemy(CIS,3)
SetTeamAsEnemy(3,CIS)

--AIHeroSupport
herosupport = AIHeroSupport:New{AIATTHeroHealth = 3000, AIDEFHeroHealth = 3000, gameMode = "Conquest",}
herosupport:SetHeroClass(REP, "rep_hero_boss")
herosupport:SetHeroClass(CIS, "cis_inf_ubd")

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