Page 1 of 1

Black screen after spawning

Posted: Tue Jun 10, 2014 1:04 pm
by Noobasaurus
It's the weirdest thing. After I spawn, the screen is black. I can still see my HUD and move around and shoot and stuff, but I simply can't see. If I use free camera nothing changes. I've been getting an error that looks like this:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #2 to `OnTimerElapse' (string expected, got nil)
stack traceback:
	[C]: in function `OnTimerElapse'
	(none): in function `ScriptPostLoad'
But I have no clue what's wrong with my timers. They all look fine.

Lua:
Hidden/Spoiler:
[code]--
-- 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")

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

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

-- MapHideCommandPosts()
-- KillObject("CP1")
-- KillObject("CP2")
-- KillObject("CP3")
-- KillObject("CP4")
-- KillObject("CP5")
-- KillObject("CP6")
-- KillObject("CP7")
DisableBarriers("start_room_barrier")
DisableBarriers("dr_left")
DisableBarriers("circle_bar1")
DisableBarriers("circle_bar2")

SetProperty("CP1", "SpawnPath", "")
SetProperty("CP2", "SpawnPath", "")
SetProperty("CP3", "SpawnPath", "")
AddDeathRegion("DeathRegion01")
AddDeathRegion("DeathRegion02")
AddDeathRegion("DeathRegion03")
AddDeathRegion("DeathRegion04")
AddDeathRegion("DeathRegion05")
------------------------- SETUP THE FIRST FEW TIMERS
dead = CreateTimer("dead")
dead2 = CreateTimer("dead2")
win = CreateTimer("win")
SetTimerValue(win, 300)

cool1 = CreateTimer("cool1")
SetTimerValue(cool1, 30)
cool2 = CreateTimer("cool2")
SetTimerValue(cool2, 120)
cool3 = CreateTimer("cool3")
SetTimerValue(cool3, 180)
cool4 = CreateTimer("cool4")
SetTimerValue(cool4, 240)
cool5 = CreateTimer("cool5")
SetTimerValue(cool5, 270)
cool6 = CreateTimer("cool6")
SetTimerValue(cool6, 285)
cool7 = CreateTimer("cool7")
SetTimerValue(cool7, 295)

alive = CreateTimer("alive")
SetTimerValue(alive, 1)

SetTimerValue(spawn, 60)
SetTimerValue(dead, 1)
SetTimerValue(dead2, 1)

----------------------------------------------------
ShowObjectiveTextPopup("level.PRH.load", DEF)
ShowObjectiveTextPopup("level.PRH.load", ATT)
-------------------------------------------------- ONCE THE FIRST ONE SPAWNS START THE TIMERS

print("1")
onfirstspawn = OnCharacterSpawn(
function(character)
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
-- StartTimer(alive)
StartTimer(dead)
StartTimer(cool1)
StartTimer(cool2)
StartTimer(cool3)
StartTimer(cool4)
StartTimer(cool5)
StartTimer(cool6)
StartTimer(cool7)
StartTimer(spawn)
StartTimer(win)
ShowTimer(win)
print("2")
end
)
------------------------------------------------------------------------------
--------------------------------- RELEASE THE HOUNDS SPAWN TIMER
OnTimerElapse(
function(timer)
print("4")
ShowMessageText("level.PRH.seekerscanspawn")
SetProperty("CP1", "SpawnPath", "CP1Spawn")
SetProperty("CP2", "SpawnPath", "CP2Spawn")
SetProperty("CP3", "SpawnPath", "CP3Spawn")
SetProperty("CP4", "SpawnPath", "")
SetProperty("CP5", "SpawnPath", "")
SetProperty("CP6", "SpawnPath", "")
DestroyTimer(timer)
end,
spawn
)

-------------------------------------------------------
------------------------------------- VICTORY TIMER
OnTimerElapse(
function(timer)
print("4")
MissionVictory(1)
DestroyTimer(timer)
end,
win
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.30seek")
DestroyTimer(timer)
end,
cool1
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.3minsleft")
DestroyTimer(timer)
end,
cool2
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.2minsleft")
DestroyTimer(timer)
end,
cool3
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.1minleft")
DestroyTimer(timer)
end,
cool4
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.30secsleft")
DestroyTimer(timer)
end,
cool5
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.15secsleft")
DestroyTimer(timer)
end,
cool6
)

OnTimerElapse(
function(timer)
ShowMessageText("level.PRH.5secsleft")
DestroyTimer(timer)
end,
cool7
)
OnTimerElapse(
function(timer)
print("Checking for dead people...")
if GetNumTeamMembersAlive(1) == 0 then
print("Dead people found, seekers win.")
MissionVictory(2)
DestroyTimer(timer)
end
print("No dead people found.")
SetTimerValue(dead, 1)
StartTimer(dead)
end,
dead
)
-----------TEAM 1 IS PROPS AND TEAM 2 IS SEEKERS



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

-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4000000)
ReadDataFile("ingame.lvl")

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

ReadDataFile("sound\\dea.lvl;dea1gcw")
ReadDataFile("dc:sound\\tss.lvl;tssgcw")


SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight (72)
AISnipeSuitabilityDist(30)

ReadDataFile("dc:SIDE\\prh.lvl",
"prh_inf_healthdroid",
"prh_inf_ammodroid",
"prh_inf_dea1_barrel",
"prh_inf_dea1_crate",
"prh_inf_seeker",
"prh_inf_dea1_door")



SetupTeams{

all={
team = ALL,
units = 32,
reinforcements = -1,
soldier = {"prh_inf_healthdroid",0, 0},
assault = {"prh_inf_ammodroid",0, 0},
engineer = {"prh_inf_dea1_barrel",0, 0},
sniper = {"prh_inf_dea1_door",0, 0},
officer = {"",0, 0},
special = {"prh_inf_dea1_crate",0, 0},

},

imp={
team = IMP,
units = 32,
reinforcements = -1,
soldier = {"prh_inf_seeker",0, 0},


}
}

-- Level Stats
ClearWalkers()
-- AddWalkerType(0, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(1, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(2, 0) -- 2 spider walkers with 2 leg pairs each
-- AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
local weaponCnt = 200
SetMemoryPoolSize ("Aimer", 0)
SetMemoryPoolSize ("AmmoCounter", weaponCnt)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("EnergyBar", weaponCnt)
SetMemoryPoolSize ("EntityCloth", 18)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("SoldierAnimation", 750)
SetMemoryPoolSize ("MountedTurret", 0)
SetMemoryPoolSize ("Navigator", 500)
SetMemoryPoolSize ("Obstacle", 560)
SetMemoryPoolSize ("PathFollower", 50)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("RedOmniLight", 130)
SetMemoryPoolSize ("UnitAgent", 600)
SetMemoryPoolSize ("Timer", 630)
SetMemoryPoolSize ("ShieldEffect", 0)
SetMemoryPoolSize ("TreeGridStack", 200)
SetMemoryPoolSize ("UnitAgent", 50)
SetMemoryPoolSize ("UnitController", 50)
SetMemoryPoolSize ("Weapon", weaponCnt)
SetMemoryPoolSize ("EntityFlyer", 6)

-- Local Stats
--SetTeamName (3, "locals")
--AddUnitClass (3, "ewk_inf_trooper", 4)
--AddUnitClass (3, "ewk_inf_repair", 6)
--SetUnitCount (3, 14)
--SetTeamAsFriend(3,ATT)
--SetTeamAsEnemy(3,DEF)


SetSpawnDelay(10.0, 0.25)
ReadDataFile("dea\\dea1.lvl", "dea1_Conquest")
SetDenseEnvironment("true")

--SetStayInTurrets(1)


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

-- Sound

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

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

OpenAudioStream("sound\\global.lvl", "gcw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\dea.lvl", "dea1")
OpenAudioStream("sound\\dea.lvl", "dea1")
-- OpenAudioStream("sound\\cor.lvl", "dea1gcw_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_dea_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_dea_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2,"all_dea_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_dea_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_dea_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2,"imp_dea_amb_end", 2,1)

SetVictoryMusic(ALL, "all_dea_amb_victory")
SetDefeatMusic (ALL, "all_dea_amb_defeat")
SetVictoryMusic(IMP, "imp_dea_amb_victory")
SetDefeatMusic (IMP, "imp_dea_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)


AddCameraShot(0, 0, 0, 0, 0, 0, 0);
end
[/code]
I think that something breaks on the "dead" timer, but I'm not sure what. Help is greatly appreciated.

Re: Black screen after spawning

Posted: Thu Jun 12, 2014 7:57 am
by [RDH]Zerted
It's saying the second argument/parameter to one of the OnTimerElapse() functions has a value of nil but the function requires a string.

You never created your 'spawn' timer, so the spawn variable holds the value of nil.

Re: Black screen after spawning

Posted: Thu Jun 19, 2014 3:26 pm
by Noobasaurus
Thank you Zerted. I fixed that, but I'm still getting a black screen after I spawn. Everything else seems to work great.

After going through the log again, I noticed this error.

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\HUDManager.cpp(619)
HUD unable to find HUD element type 0x16ce484a
I haven't loaded any custom HUDs or used a custom ingame.lvl in this mod. I searched for this and I saw one solution that added more memory to SoldierAnimation but that memory pool is already raised in mine.

Re: Black screen after spawning

Posted: Thu Jun 19, 2014 3:34 pm
by Marth8880
That error comes shipped with the game so there's no need to worry about it.