Page 1 of 1

Mission .lua Problems!!

Posted: Sun Apr 30, 2006 3:27 pm
by PR-0927
Well, I have been working dilligently on Rise of the Empire #2: Escape Attempt. However, I have hit a bump in the road: errors in my .lua files.

Now, I hope you guys can help me find my errors (bracket type stuff). This is a space map, so I have two .lua files.

Thank you for your time. I assure you that your time is being used to make a great map!

I haven't even tested the map though, so I hope this can be sorted out.

Here is my RE2g_Diet Dr. Pepper.lua file:

Code: Select all

--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Galactic Civil War Template Assault File
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("RE2g_cmn")

ScriptCB_DoFile("ObjectiveSpaceAssault")
ScriptCB_DoFile("LinkedShields")
ScriptCB_DoFile("LinkedDestroyables")

myGameMode = "RE2_GCW-Assault"
 
function ScriptPostLoad()
    SetupObjectives()
    
    SetupShields()
    SetupDestroyables()
    SetupTurrets()
	
    AddAIGoal(ALL, "Deathmatch", 100)
    AddAIGoal(IMP, "Deathmatch", 100)
	
	DisableSmallMapMiniMap()
end

function SetupObjectives()
	assault = ObjectiveSpaceAssault:New{
		teamATT = IMP, teamDEF = ALL, 
		multiplayerRules = true
	}
	
	local impTargets = {
		engines		= { "cis_drive_1", "cis_drive_2" },
		bridge		= "cis-bridge",
		frigates	= { "all-frigate", "all-frigate2", "all-frigate3", "all-frigate4", "all-frigate5", "all-frigate6", "all-frigate7", "all-frigate8", "all-frigate9", "all-frigate10", "all-frigate11", "all-frigate12" },
		internalSys	= { "cis-life-int", "cis-engines" },
	}
	
	local allTargets = {
		engines		= "rep_drive_1",
		bridge		= "rep-bridge",
		frigates	= { "rep-frigate", "rep-frigate2" },
		internalSys	= { "rep-life-int", "rep-engines" },
	}
	
	assault:SetupAllCriticalSystems( "imp", impTargets, true )
	assault:SetupAllCriticalSystems( "all", allTargets, false )
	
	assault:Start()
end

function SetupShields()
    -- ALL Shielded objects    
    local linkedShieldObjectsALL = { "cis_ship_1", "cis_ship_2", "cis_ship_3", "cis_ship_4", "cis-bridge", "cis_drive_1", "cis_drive_2"}
    shieldStuffALL = LinkedShields:New{objs = linkedShieldObjectsALL, controllerObject = "cis-shield"}
    shieldStuffALL:Init()
    
    function shieldStuffALL:OnAllShieldsDown() 
        ShowMessageText("level.spa.hangar.shields.atk.down", IMP)
        ShowMessageText("level.spa.hangar.shields.def.down", ALL)
		
		BroadcastVoiceOver( "IOSMP_obj_16", IMP )
		BroadcastVoiceOver( "AOSMP_obj_17", ALL )
    end
    function shieldStuffALL:OnAllShieldsUp() 
        ShowMessageText("level.spa.hangar.shields.atk.up", IMP)
        ShowMessageText("level.spa.hangar.shields.def.up", ALL)
		
		BroadcastVoiceOver( "IOSMP_obj_18", IMP )
		BroadcastVoiceOver( "AOSMP_obj_19", ALL )
    end
    
    
    -- IMP Shielded objects    
    local linkedShieldObjectsIMP = { "rep_ship_1", "rep_ship_2", "rep_ship_3", "rep_ship_4", "rep-bridge", "rep_drive_1"}
    shieldStuffIMP = LinkedShields:New{objs = linkedShieldObjectsIMP, controllerObject = "rep-shield"}    
    shieldStuffIMP:Init()
    
    function shieldStuffIMP:OnAllShieldsDown() 
        ShowMessageText("level.spa.hangar.shields.atk.down", ALL)
        ShowMessageText("level.spa.hangar.shields.def.down", IMP)
		
		BroadcastVoiceOver( "IOSMP_obj_17", IMP )
		BroadcastVoiceOver( "AOSMP_obj_16", ALL )
    end
	function shieldStuffIMP:OnAllShieldsUp() 
        ShowMessageText("level.spa.hangar.shields.atk.up", ALL)
        ShowMessageText("level.spa.hangar.shields.def.up", IMP)
		
		BroadcastVoiceOver( "IOSMP_obj_19", IMP )
		BroadcastVoiceOver( "AOSMP_obj_18", ALL )
    end
end


function SetupDestroyables()
    engineLinkageCIS = LinkedDestroyables:New{ objectSets = {{"cis_drive_1", "cis_drive_2"}, {"cis-engines"}} }
    engineLinkageCIS:Init()
    
    engineLinkageREP = LinkedDestroyables:New{ objectSets = {{"rep_drive_1"}, {"rep-engines"}} }
    engineLinkageREP:Init()
end

Here is my RE2g_cmn.lua file:

Code: Select all

--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information 
--

ScriptCB_DoFile("setup_teams")

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

function SetupUnits()
    ReadDataFile("dc:SIDE\\all.lvl",
        "all_inf_pilot",
        "all_fly_ywing_sc",
        "all_inf_engineer",
        "all_inf_support",
        "all_inf_rifleman",
        "all_inf_rocketeer",
	"all_inf_infiltrator",
        "all_fly_greviousfighter",
        "all_fly_arc170fighter_sc",
	"all_inf_medic",
        "all_fly_gunship_sc",
        "all_inf_sniper")
     ReadDataFile("dc:SIDE\\rep.lvl",
        "rep_inf_ep3_pilot",
        "rep_fly_anakinstarfighter_sc",
        "rep_fly_arc170fighter_sc",
        "rep_fly_vwing",
        "rep_fly_gunship_sc",
        "rep_inf_ep3_rifleman")
    ReadDataFile("dc:SIDE\\geo.lvl",
        "gen_inf_geonosian")
end

	SetupTeams{
		all = {
			team = ALL,
			units = 32,
			reinforcements = 1000,
			pilot    = { "all_inf_pilot",4},
			marine	= { "all_inf_rifleman",4},
		},
	}

    AddUnitClass(ALL,"all_inf_rocketeer",  4)
    AddUnitClass(ALL,"all_inf_engineer",  4)
    AddUnitClass(ALL,"all_inf_sniper",  4)
    AddUnitClass(ALL,"all_inf_support",  4)
    AddUnitClass(ALL,"all_inf_medic",  4)
    AddUnitClass(ALL,"all_inf_infiltrator",  4)

	SetupTeams{
    		imp = {
        		team = IMP,
        		units = 32,
        		reinforcements = 1000,
        		pilot    = { "rep_inf_ep3_pilot",16},
        		marine   = { "rep_inf_ep3_rifleman",16},
		},
	}


    SetTeamName(3, "locals")
    SetUnitCount(3, 14)
    AddUnitClass(3, "geo_inf_geonosian", 14)
    SetTeamAsFriend(DEF,3)
    SetTeamAsFriend(3,DEF)
    SetTeamAsEnemy(ATT,3)
    SetTeamAsEnemy(3,ATT)
end

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


---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
   
  -- Designers, this line *MUST* be first!
    ReadDataFile("ingame.lvl")
   
    SetMinFlyHeight(-1800)
    SetMaxFlyHeight(1800)
    SetMinPlayerFlyHeight(-1800)
    SetMaxPlayerFlyHeight(1800)
    SetAIVehicleNotifyRadius(100)
    
    ReadDataFile("sound\\spa.lvl;spa1gcw")
     ScriptCB_SetDopplerFactor(0.4)
     ScaleSoundParameter("tur_weapons",   "MinDistance",   3.0);
     ScaleSoundParameter("tur_weapons",   "MaxDistance",   3.0);
     ScaleSoundParameter("tur_weapons",   "MuteDistance",   3.0);
     ScaleSoundParameter("Ordnance_Large",   "MinDistance",   3.0);
     ScaleSoundParameter("Ordnance_Large",   "MaxDistance",   3.0);
     ScaleSoundParameter("Ordnance_Large",   "MuteDistance",   3.0);
     ScaleSoundParameter("explosion",   "MaxDistance",   5.0);
     ScaleSoundParameter("explosion",   "MuteDistance",  5.0);
         
    SetupUnits()
    SetupTeams(myTeamConfig)

    --  Level Stats
    ClearWalkers()
    local weaponCnt = 250
    local guyCnt = 32
    SetMemoryPoolSize("Aimer", 190)
    SetMemoryPoolSize("AmmoCounter", weaponCnt)
    SetMemoryPoolSize("BaseHint", 89)
    SetMemoryPoolSize("CommandFlyer", 6)
    SetMemoryPoolSize("SoldierAnimation", 180)
    SetMemoryPoolSize("EnergyBar", weaponCnt)
    SetMemoryPoolSize("EntityFlyer", 66)
    SetMemoryPoolSize("EntityLight", 115)
    SetMemoryPoolSize("EntityRemoteTerminal", 12)
    SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
    SetMemoryPoolSize("MountedTurret", 56)
    SetMemoryPoolSize("EntityPortableTurret", 20)
    SetMemoryPoolSize("Navigator", guyCnt)
    SetMemoryPoolSize("Obstacle", 135)
    SetMemoryPoolSize("PathNode", 80)
    SetMemoryPoolSize("PathFollower", guyCnt)
    SetMemoryPoolSize("TreeGridStack", 240)
    SetMemoryPoolSize("UnitAgent", 65)
    SetMemoryPoolSize("UnitController", 65)
    SetMemoryPoolSize("Weapon", weaponCnt)

    SetSpawnDelay(10.0, 0.25)
    
    -- do any pool allocations, custom loading here
    if myScriptInit then
        myScriptInit()
        myScriptInit = nil
    end
    
    ReadDataFile("dc:RE2\\spa_sky.lvl", "end")

    ReadDataFile("dc:RE2\\RE2.lvl", myGameMode)
    
    SetDenseEnvironment("false")

    SetParticleLODBias(15000)

    --  Sound Stats
    local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
    AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
    AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
    
    local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
    AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)    
    
    OpenAudioStream("sound\\global.lvl",  "gcw_music")
    OpenAudioStream("sound\\spa.lvl",  "spa")
    OpenAudioStream("sound\\spa.lvl",  "spa")
    
    SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
    SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)
    
    SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
    SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
    SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
    SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)
    
    SetOutOfBoundsVoiceOver(ALL, "allleaving")
    SetOutOfBoundsVoiceOver(IMP, "impleaving")
    
    SetAmbientMusic(ALL, 1.0, "all_spa_amb_start",  0,1)
    SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
    SetAmbientMusic(ALL, 0.1,"all_spa_amb_end",    2,1)
    SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start",  0,1)
    SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
    SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end",    2,1)
    
    SetVictoryMusic(ALL, "all_spa_amb_victory")
    SetDefeatMusic (ALL, "all_spa_amb_defeat")
    SetVictoryMusic(IMP, "imp_spa_amb_victory")
    SetDefeatMusic (IMP, "imp_spa_amb_defeat")
    
    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
    SetSoundEffect("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 
    AddCameraShot(-0.049495, 0.003922, -0.995646, -0.078892, 24.992880, -22.995819, -1025.940186);
    AddCameraShot(0.546201, 0.047743, 0.833116, -0.072822, 402.610260, -105.474068, -55.044727);
    AddCameraShot(0.988295, -0.091070, 0.121873, 0.011230, 33.932011, 10.868500, 1567.624146);
    AddCameraShot(-0.380690, 0.021761, -0.922940, -0.052756, 1351.167236, 188.651230, -10.971837);
    AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

    AddDeathRegion("deathregion3")
    AddDeathRegion("deathregion4")
    AddDeathRegion("deathregion5")
    AddLandingRegion("cis-CP1Con")
    AddLandingRegion("rep-CP1Con")
    AddLandingRegion("rep-CP2Con")
   
end

Thank you!! Please help!!

- Majin Revan

RE: Mission .lua Problems!!

Posted: Sun Apr 30, 2006 3:42 pm
by PR-0927
This is my PC_MungeLog.log file:

Code: Select all

D:\Paurav\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\common\scripts\RE2\RE2g_cmn.lua:76: <eof> expected near `end'
ERROR[scriptmunge scripts\RE2\RE2g_cmn.lua]:Could not read input file.ERROR[scriptmunge scripts\RE2\RE2g_cmn.lua]:Could not read input file. [continuing]
   2 Errors    0 Warnings

ERROR[levelpack mission\RE2g_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\re2g_cmn.script.req(1)...

ucft <--
ERROR[levelpack mission\RE2g_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\re2g_cmn.script.req(1)...

ucft <--
 [continuing]
   2 Errors    0 Warnings

ERROR[levelpack shell.req]:Input file shell.req does not exist. [continuing]
   1 Errors    0 Warnings

WARNING[PC_modelmunge msh\all_1st_weap_inf_bowcaster.msh]:all_1st_weap_inf_bowcaster has 1178 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\all_inf_bothanspy.msh]:all_inf_bothanspy has 2272 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\all_inf_engineer.msh]:all_inf_engineer has 2573 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\all_inf_marksperson.msh]:all_inf_marksperson has 1534 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\all_inf_pilot.msh]:all_inf_pilot has 1330 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\all_inf_wookie.msh]:all_inf_wookie has 1925 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
   0 Errors    6 Warnings

WARNING[PC_modelmunge msh\gen_inf_geonosian.msh]:gen_inf_geonosian has 1439 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
   0 Errors    1 Warnings

WARNING[PC_modelmunge msh\rep_inf_ep3spacepilot.msh]:rep_inf_ep3spacepilot has 1797 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
WARNING[PC_modelmunge msh\rep_inf_ep3trooper.msh]:rep_inf_ep3trooper has 1963 vertices and NO COLLISION GEOMETRY (WILL BE SLOW)!
   0 Errors    2 Warnings

soundflmunge.exe : Warning : Files line 26 and 27 reference the same source file c:\windows\media\chord.wav.  whooshl3 will alias whooshl4
  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
soundflmunge.exe : Warning : Files line 26 and 29 reference the same source file c:\windows\media\chord.wav.  whooshl3 will alias whooshr3
  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
soundflmunge.exe : Warning : Files line 26 and 30 reference the same source file c:\windows\media\chord.wav.  whooshl3 will alias whooshr4
  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
soundflmunge.exe : Error : Unable to open file D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\effects\whooshl3.wav  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
soundflmunge.exe : Error : Unable to open file D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\effects\whooshl3.wav, format may be invalid  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
soundflmunge.exe : Error : Unable to read file list D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx  - while munging D:\Paurav\BF2_ModTools\data_RE2\Sound\shell\shell.sfx
- Majin Revan

RE: Mission .lua Problems!!

Posted: Sun Apr 30, 2006 4:45 pm
by Teancum
look on line 76 of RE2g_cmn.lua. That's what that munge error reads.

RE: Mission .lua Problems!!

Posted: Sun Apr 30, 2006 4:58 pm
by PR-0927
Yep, I did. It made no sense at all, because the line reads "end" and nothing else.

I don't know what <eof> is either.

Plus, my other .lua has errors, but I don't know where.

- Majin Revan

RE: Mission .lua Problems!!

Posted: Sun Apr 30, 2006 5:00 pm
by Teancum
If the luas have never been touched, then it's probably just a bad munge. Go through and manually delete munged stuff then remunge.

RE: Mission .lua Problems!!

Posted: Sun Apr 30, 2006 5:22 pm
by PR-0927
No, I have messed with the .lua files a TON.

I always clear out my munge files too.

- Majin Revan

Posted: Sun Apr 30, 2006 5:58 pm
by [RDH]Zerted
First off, I don't think your locals will work. You didn't give them an AI goal.

<eof> means end of file. You are getting the error because you have an extra "end" after the ReadDataFile()s which shouldn't be there.

Change your code to look like this:
"rep_inf_ep3_rifleman")
ReadDataFile("dc:SIDE\\geo.lvl",
"gen_inf_geonosian")

SetupTeams{
all = {
team = ALL,
units = 32,
reinforcements = 1000,
pilot = { "all_inf_pilot",4},
marine = { "all_inf_rifleman",4},
},

imp = {
team = IMP,
units = 32,
reinforcements = 1000,
pilot = { "rep_inf_ep3_pilot",16},
marine = { "rep_inf_ep3_rifleman",16},
},
}

AddUnitClass(ALL,"all_inf_rocketeer", 4)
AddUnitClass(ALL,"all_inf_engineer", 4)
AddUnitClass(ALL,"all_inf_sniper", 4)
AddUnitClass(ALL,"all_inf_support", 4)
AddUnitClass(ALL,"all_inf_medic", 4)
AddUnitClass(ALL,"all_inf_infiltrator", 4)

SetTeamName(3, "locals")
SetUnitCount(3, 14)

Posted: Sun Apr 30, 2006 8:36 pm
by MercuryNoodles
That eof error is because you're calling "end" without there being a function call to begin with. (So, wouldn't that make it "end of function"?) Notice that all function calls are always closed off with "end".

Btw, the ground map classes do work in space, so you don't need to use AddUnitClass for everything.

Posted: Sun Apr 30, 2006 8:57 pm
by [RDH]Zerted
Yeah, you are right. <eof> most likely means 'end of function'. EOF can be used to check for the 'end of file' when you are reading from one.

Posted: Tue May 02, 2006 5:04 pm
by PR-0927
Well, I did some of what you said for the .lua file. However, my map won't work. My PCMungeLog.txt file just gives me errors about models, etc. The game crashes not even a second after I launch the map, so the only errors in the log are for the videos, etc.

This is pissing me off! My .lua files are fine now, but the map won't launch due to unknown problems. The map cannot be released or even tested until these problems are solved.

If someone could help go through my files, I'd appreciate it. Contact me on MSN Messenger (my MSN is in that MSN link in this thread).

The VisualMunge thing gives me some error about not being able to find RE2_GCW-Assault.mrq, even though it is there. I checked thousands of times, opening up the files and checking for errors too. Before that error is given, it finds RE2.req, but then searches for it again (after the error) and gives me an error of not being able to find it.

- Majin Revan

Posted: Tue May 02, 2006 7:32 pm
by Vyse
Don't you just love mod tools! :wink: Have you tried making a whole new map and copying the .WLD to see if thats the prob.

I am thinking its not cleaning right....

Posted: Tue May 02, 2006 7:40 pm
by Teancum
That error is decieving. What it usually meansis that it can't find something on the GCW-Assault layer it needs to work. Note: This would entail any ZeroEdit layers under this gametype. Click 'configure' to find out what it uses in ZeroEdit.