Page 1 of 1

Certain units crashing in new era [Solved]

Posted: Fri Apr 22, 2016 9:43 pm
by Sandtrooper956
So I've been trying to create a new era mod, but for some reason two of my units crash upon clicking "spawn". They're jedi hero units, but I have gotten other jedi units working.

I can't pinpoint whats causing them to crash upon spawn and its very confusing.

Here is my .lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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

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

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------


function ScriptPostLoad()

DisableBarriers("dropship")
DisableBarriers("shield_03")
DisableBarriers("shield_02")
DisableBarriers("shield_01")
DisableBarriers("ctf")
DisableBarriers("ctf1")
DisableBarriers("ctf2")
DisableBarriers("ctf3")
DisableBarriers("coresh1")

EnableSPHeroRules()

cp1 = CommandPost:New{name = "CP1_CON"}
cp2 = CommandPost:New{name = "CP2_CON"}
--cp3 = CommandPost:New{name = "CP3_CON"}
cp4 = CommandPost:New{name = "CP4_CON"}
cp5 = CommandPost:New{name = "CP5_CON"}
cp7 = CommandPost:New{name = "CP7_CON"}
--cp8 = CommandPost:New{name = "CP8_CON"}

conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true}

conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
--conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp7)
--conquest:AddCommandPost(cp8)

conquest:Start()

end


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

ReadDataFile("sound\\myg.lvl;myg1gcw")

SetMaxFlyHeight(20)
SetMaxPlayerFlyHeight(20)

ReadDataFile("dc:SIDE\\ald.lvl",
"all_inf_rifleman",
"all_inf_rocketeer",
"all_inf_sniper",
"all_inf_engineer",
"all_inf_officer",
"all_inf_agent",
"all_hero_bastila",
"all_inf_jedi_knight")



ReadDataFile("dc:SIDE\\imd.lvl",
"imp_inf_rifleman",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_sassn",
"imp_inf_wardroid",
"imp_hero_revan")


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

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman",9, 25},
assault = { "all_inf_rocketeer",1,4},
engineer = { "all_inf_engineer",1,4},
sniper = { "all_inf_sniper",1,4},
officer = { "all_inf_officer",1,4},
special = { "all_inf_agent",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman",9, 25},
assault = { "imp_inf_rocketeer",1,4},
engineer = { "imp_inf_engineer",1,4},
sniper = { "imp_inf_sniper",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_wardroid",1,4},
},
}

AddUnitClass(ALL, "all_inf_jedi_knight", 1,2)
AddUnitClass(IMP, "imp_inf_sassn", 1,2)
AddUnitClass(ALL, "all_hero_bastila", 1,1)
AddUnitClass(IMP, "imp_hero_revan", 1,1)

-- Level Stats
ClearWalkers()
-- AddWalkerType(0, 0) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(1, 0) -- ATst- 2 legged Walkers
-- AddWalkerType(2, 0) -- 2 spider walkers with 2 leg pairs each
-- AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
SetMemoryPoolSize("Aimer", 80)
SetMemoryPoolSize("EntityCloth", 37)
SetMemoryPoolSize("EntityHover", 7)
SetMemoryPoolSize("EntityFlyer", 6)
SetMemoryPoolSize("EntityLight", 36)
SetMemoryPoolSize("MountedTurret", 14)
SetMemoryPoolSize("Obstacle", 500)
SetMemoryPoolSize("PathNode", 512)
SetMemoryPoolSize("EntitySoundStream", 1)
SetMemoryPoolSize("EntitySoundStatic", 76)
SetMemoryPoolSize("TreeGridStack", 300)
SetMemoryPoolSize("Weapon", 260)


SetSpawnDelay(10.0, 0.25)
ReadDataFile("myg\\myg1.lvl", "myg1_conquest")
SetDenseEnvironment("false")
AddDeathRegion("deathregion")
--SetStayInTurrets(1)


-- Movies
-- SetVictoryMovie(ALL, "all_end_victory")
-- SetDefeatMovie(ALL, "imp_end_victory")
-- SetVictoryMovie(IMP, "imp_end_victory")
-- SetDefeatMovie(IMP, "all_end_victory")

-- Sound

musicStream = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", musicStream)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", musicStream)

OpenAudioStream("sound\\global.lvl", "gcw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\myg.lvl", "myg1")
OpenAudioStream("sound\\myg.lvl", "myg1")
-- OpenAudioStream("sound\\myg.lvl", "myg1_emt")

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

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

SetOutOfBoundsVoiceOver(1, "allleaving")
SetOutOfBoundsVoiceOver(2, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_myg_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_myg_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2,"all_myg_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_myg_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_myg_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2,"imp_myg_amb_end", 2,1)

SetVictoryMusic(ALL, "all_myg_amb_victory")
SetDefeatMusic (ALL, "all_myg_amb_defeat")
SetVictoryMusic(IMP, "imp_myg_amb_victory")
SetDefeatMusic (IMP, "imp_myg_amb_defeat")

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


SetAttackingTeam(ATT)

--Camera Shizzle--

-- Collector Shot
AddCameraShot(0.008315, 0.000001, -0.999965, 0.000074, -64.894348, 5.541570, 201.711090);
AddCameraShot(0.633584, -0.048454, -0.769907, -0.058879, -171.257629, 7.728924, 28.249359);
AddCameraShot(-0.001735, -0.000089, -0.998692, 0.051092, -146.093109, 4.418306, -167.739212);
AddCameraShot(0.984182, -0.048488, 0.170190, 0.008385, 1.725611, 8.877428, 88.413887);
AddCameraShot(0.141407, -0.012274, -0.986168, -0.085598, -77.743042, 8.067328, 42.336128);
AddCameraShot(0.797017, 0.029661, 0.602810, -0.022434, -45.726467, 7.754435, -47.544712);
AddCameraShot(0.998764, 0.044818, -0.021459, 0.000963, -71.276566, 4.417432, 221.054550);
end

[/code]
The odf files of the units which aren't working:
Hidden/Spoiler:
[code][GameObjectClass]
ClassParent = "com_jedi_default"
GeometryName = "bastila.msh"

[Properties]
AISizeType = "hover"

GeometryName = "bastila"
GeometryLowRes = "bastila"
AnimationName = "maul"

JetJump = "10.0" //The initial jump-push given when enabling the jet
JetPush = "0.0" //The constant push given while the jet is enabled (20 is gravity)
JetAcceleration = "10.0" // for characters with jet jump, use this acceleration for in air control
JetEffect = ""
JetFuelRechargeRate = "0.0" //Additional fuel per second (fuel is 0 to 1)
JetFuelCost = "0.0" //Cost per second when hovering (only used for jet-hovers)(fuel is 0 to 1)
JetFuelInitialCost = "0.0" //4initial cost when jet jumping(fuel is 0 to 1)
JetFuelMinBorder = "0.0" //minimum fuel to perform a jet jump(fuel is 0 to 1)
JetShowHud = 0
JetEnergyDrain = 40.0

CollisionScale = "0.0 0.0 0.0" // don't take damage from collisions

WeaponName1 = "all_weap_doublesaber"
WeaponAmmo1 = 0

WeaponName2 = "com_weap_inf_sabre_throw"
WeaponAmmo2 = 0
WeaponChannel2 = 1

WeaponName3 = "com_weap_inf_force_push"
WeaponAmmo3 = 0
WeaponChannel3 = 1

//SOUND
SndHeroSelectable = ""
SndHeroSpawned = ""
SndHeroDefeated = ""
SndHeroKiller = ""

VOSound = "none"
VOSound = "none"
VOSound = "none"
VOSound = "none"
VOSound = "none"

VOSound = "none"
VOSound = "none"

VOUnitType = 0
SoldierMusic = ""
HurtSound = "bastila_chatter_wound"
DeathSound = "bastila_death"
AcquiredTargetSound = ""
HidingSound = ""
ApproachingTargetSound = ""
FleeSound = ""
PreparingForDamageSound = ""
HeardEnemySound = ""
//ShockFadeOutTime = "0.8"
//ShockFadeInTime = "2.0"
ShockFadeOutGain = ""
ShockSound = ""
ClothingRustleSound = ""
//LowHealthSound = "com_inf_saber_ambient"
LowHealthThreshold = "1.1"
FoleyFXClass = "cis_inf_soldier"
[/code]
Hidden/Spoiler:
[code][GameObjectClass]
ClassParent = "com_jedi_default"
GeometryName = "revan.msh"

[Properties]
AISizeType = "HOVER"

GeometryName = "revan"
GeometryLowRes = "revan"
AnimationName = "obiwan"
ClothODF = "revan_cape"

MaxHealth = 1900.0

JetJump = "10.0" //The initial jump-push given when enabling the jet
JetPush = "0.0" //The constant push given while the jet is enabled (20 is gravity)
JetAcceleration = "10.0" // for characters with jet jump, use this acceleration for in air control
JetEffect = ""
JetFuelRechargeRate = "0.0" //Additional fuel per second (fuel is 0 to 1)
JetFuelCost = "0.0" //Cost per second when hovering (only used for jet-hovers)(fuel is 0 to 1)
JetFuelInitialCost = "0.0" //4initial cost when jet jumping(fuel is 0 to 1)
JetFuelMinBorder = "0.0" //minimum fuel to perform a jet jump(fuel is 0 to 1)
JetShowHud = 0
JetEnergyDrain = 40.0

CollisionScale = "0.0 0.0 0.0" // don't take damage from collisions

WEAPONSECTION = 1
WeaponName1 = "imp_weap_lightsaber_revan"
WeaponAmmo1 = 0

WEAPONSECTION = 2
WeaponName2 = "com_weap_inf_sabre_throw"
WeaponAmmo2 = 0
WeaponChannel2 = 1

WEAPONSECTION = 3
WeaponName3 = "com_weap_inf_force_choke"
WeaponAmmo3 = 0
WeaponChannel3 = 1

//SOUND
SndHeroSelectable = ""
SndHeroSpawned = ""
SndHeroDefeated = ""
SndHeroKiller = ""

VOSound = "rep_off_response_hero_command SC_Follow"
VOSound = "rep_off_response_hero_command SC_StopFollow"
VOSound = "rep_off_response_hero_command SC_VehicleWaitUp"
VOSound = "rep_off_response_hero_command SC_GetIn"
VOSound = "rep_off_response_hero_command SC_GetOut"

VOSound = "none"
VOSound = "none"

VOUnitType = 0
SoldierMusic = "rep_hero_Anakin_lp"
HurtSound = ""
DeathSound = ""
AcquiredTargetSound = ""
HidingSound = ""
//ApproachingTargetSound = ""
FleeSound = ""
PreparingForDamageSound = ""
HeardEnemySound = ""
ShockFadeOutTime = ""
ShockFadeInTime = ""
ShockFadeOutGain = ""
ShockSound = ""
ClothingRustleSound = ""
//LowHealthSound = "com_inf_saber_ambient"
LowHealthThreshold = "1.1"
FoleyFXClass = "imp_inf_soldier"


[/code]
And an example of a jedi unit that isn't crashing upon spawn:
Hidden/Spoiler:
[code][GameObjectClass]
ClassParent = "com_jedi_default"
GeometryName = "kotorjedi.msh"

[Properties]

MaxHealth = 1200

PointsToUnlock = 26

AISizeType = "HOVER"

GeometryName = "kotorjedi"
GeometryLowRes = "kotorjedi"

AnimationName = "mace"
//SkeletonLowRes = "macelz"

FleeLikeAHero = 0

JetJump = "10.0" //The initial jump-push given when enabling the jet
JetPush = "0.0" //The constant push given while the jet is enabled (20 is gravity)
JetAcceleration = "10.0" // for characters with jet jump, use this acceleration for in air control
JetEffect = ""
JetFuelRechargeRate = "0.0" //Additional fuel per second (fuel is 0 to 1)
JetFuelCost = "0.0" //Cost per second when hovering (only used for jet-hovers)(fuel is 0 to 1)
JetFuelInitialCost = "0.0" //4initial cost when jet jumping(fuel is 0 to 1)
JetFuelMinBorder = "0.0" //minimum fuel to perform a jet jump(fuel is 0 to 1)
JetShowHud = 0
JetEnergyDrain = 40.0

CollisionScale = "0.0 0.0 0.0" // don't take damage from collisions

WEAPONSECTION = 1
WeaponName1 = "all_weap_kotorj_lightsaber"
WeaponAmmo1 = 0

WEAPONSECTION = 2
WeaponName2 = "com_weap_inf_force_push"
WeaponAmmo2 = 0
WeaponChannel2 = 1

WEAPONSECTION = 3
WeaponName3 = "com_weap_inf_force_pull"
WeaponAmmo3 = 0
WeaponChannel3 = 1

///SOUND
SndHeroSelectable = ""
SndHeroSpawned = "hero_windu_spawn"
SndHeroDefeated = "hero_windu_exhausted"
SndHeroKiller = "hero_windu_exhausted"

VOSound = "none"
VOSound = "none"
VOSound = "none"
VOSound = "none"
VOSound = "none"

VOSound = "none"
VOSound = "none"

VOUnitType = 0181
SoldierMusic = ""
HurtSound = "jedi_chatter_wound"
DeathSound = "jedi_chatter_death"
AcquiredTargetSound = ""
HidingSound = ""
//ApproachingTargetSound = ""
FleeSound = ""
PreparingForDamageSound = ""
HeardEnemySound = ""
ShockFadeOutTime = ""
ShockFadeInTime = ""
ShockFadeOutGain = ""
ShockSound = ""
ClothingRustleSound = ""
//LowHealthSound = "com_inf_saber_ambient"
LowHealthThreshold = "1.1"
FoleyFXClass = "all_inf_soldier"




[/code]
It may also be worth mentioning that I've gotten to spawn as these two units by removing "all_inf_jedi_knight" and "imp_inf_sassn" from the .lua but couldn't attack.

Re: Certain units crashing in new era

Posted: Sat Apr 23, 2016 6:17 am
by thelegend
Add these lines above your ReadDataFile section:

Code: Select all

    
    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
 

Re: Certain units crashing in new era

Posted: Sat Apr 23, 2016 11:33 am
by Sandtrooper956
Thanks, that worked! I'll remember this is the future.