Lua problem [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
acryptozoo
Master Bounty Hunter
Master Bounty Hunter
Posts: 1642
Joined: Wed Jun 03, 2009 3:14 pm
Projects :: Yavin Mappack
Games I'm Playing :: Homeworld 2
xbox live or psn: acryptozoo
Location: in the jungles of Yavin IV
Contact:

Lua problem [Solved]

Post by acryptozoo »

Hi GT,
i was adding locals to my map, i munged then went ingame i all the objects cps and terrain was gone and i got this error

Code: Select all

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to perform arithmetic on a nil value
stack traceback:
	(none): in function `AddCommandPost'
	(none): in function `ScriptPostLoad'
im pretty sure it has to do with the command posts but i cant find any errorsits probably really obvious
heres a snippet of my LUA
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")

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

function ScriptPostLoad()


--This defines the CPs. These need to happen first
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"}


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

EnableSPHeroRules()

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

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(500)
SetMaxPlayerFlyHeight(500)


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


ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman",
"all_inf_rocketeer",
"all_inf_sniper",
"all_inf_engineer",
"all_inf_officer",
"all_fly_xwing_dome",
"all_fly_correlian_dome",
"all_fly_moncalimari_dome",
"all_inf_wookiee",
"all_hero_hansolo_tat")

ReadDataFile("dc:SIDE\\snw.lvl",
"snw_inf_wampa")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_bobafett",
"imp_fly_destroyer_dome")

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

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_wookiee",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_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_hansolo_tat")
SetHeroClass(IMP, "imp_hero_bobafett")

SetTeamName (3, "wampas")
AddUnitClass (1, "snw_inf_wampa", 3,15)
SetUnitCount (3, 15)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsfriend(ATT,3)
SetTeamAsfriend(3,ATT)
SetTeamAsfriend(DEF,3)
SetTeamAsfriend(3,DEF)
thanks in advance
Last edited by acryptozoo on Tue Jul 19, 2011 10:07 pm, edited 1 time in total.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Lua problem

Post by THEWULFMAN »

acryptozoo wrote:
SetTeamName (3, "wampas")
AddUnitClass (1, "snw_inf_wampa", 3,15)
SetUnitCount (3, 15)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsfriend(ATT,3)
SetTeamAsfriend(3,ATT)
SetTeamAsfriend(DEF,3)
SetTeamAsfriend(3,DEF)
acryptozoo wrote:its probably really obvious
Don't be too sure. An error anyway can cause a break in the script, thus causing other errors. Think of it was a fever, you don't treat the fever you treat whats causing the fever.
User avatar
acryptozoo
Master Bounty Hunter
Master Bounty Hunter
Posts: 1642
Joined: Wed Jun 03, 2009 3:14 pm
Projects :: Yavin Mappack
Games I'm Playing :: Homeworld 2
xbox live or psn: acryptozoo
Location: in the jungles of Yavin IV
Contact:

Re: Lua problem

Post by acryptozoo »

THEWULFMAN wrote:
acryptozoo wrote:
SetTeamName (3, "wampas")
AddUnitClass (1, "snw_inf_wampa", 3,15)
SetUnitCount (3, 15)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsfriend(ATT,3)
SetTeamAsfriend(3,ATT)
SetTeamAsfriend(DEF,3)
SetTeamAsfriend(3,DEF)
acryptozoo wrote:its probably really obvious
Don't be too sure. An error anyway can cause a break in the script, thus causing other errors. Think of it was a fever, you don't treat the fever you treat whats causing the fever.
hrmm... still dosent work
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: Lua problem

Post by Cerfon Rournes »

I think that your locals need a command post.
Hidden/Spoiler:
[quote="Tutorial: How to add local sides! (FAQ)"]
Step 2:

Go to what ever layer is needed ((if you want the local side to be in the conquest mode, or XL, CTF, or all, open up the needed layer, if you want them to be in all the modes, just stay in the BASE layer))

For this tutorial, we will be using the Conquest layer. so open up the conquest layer



Step 3:


NOTE:
Steps for non capturable Command Posts


go to objects, and place a new "Invisible" Command Post anywhere in the map,

you can find an invisible Command Post in /common/odfs "com_bldg_invisible_controlzone"

best place to put the Command Post is some where where you will be able to find it again later with ease,

Next, set the the set the name to anything that you want, for this we will name it Local_CP

now, set the spawn path to anything you want again, for this we will use Local_Spawn

now assign the command post a team, for this we will assign it to team 3. so assign it to team 3 by replacing what ever is in the team box with a 3.

now you will have to lower the CP. you'll have to sink it by 5 under that ever the height is its on.

so if the height of the terrain its on is 0, set the CPs height to -5

if the terrain is something like, 22, lower it down by five so its at 17, etc

NOTE: to find out the terrains height go into HEIGHT -> pick and then click on the terrain and it will tell you the height of the terrain

now you will need make a new path by going into Path -> new path, next you will need to change the path name to what ever you set the spawn paths name in the CP to, ours is Local_Spawn.

now that you've named it we will begin to place path nodes all over the place until we feel happy.

--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "Local_CP"}

--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) [/quote]
User avatar
acryptozoo
Master Bounty Hunter
Master Bounty Hunter
Posts: 1642
Joined: Wed Jun 03, 2009 3:14 pm
Projects :: Yavin Mappack
Games I'm Playing :: Homeworld 2
xbox live or psn: acryptozoo
Location: in the jungles of Yavin IV
Contact:

Re: Lua problem

Post by acryptozoo »

did that but still get the same error
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: Lua problem

Post by Cerfon Rournes »

Lua please. :?
User avatar
acryptozoo
Master Bounty Hunter
Master Bounty Hunter
Posts: 1642
Joined: Wed Jun 03, 2009 3:14 pm
Projects :: Yavin Mappack
Games I'm Playing :: Homeworld 2
xbox live or psn: acryptozoo
Location: in the jungles of Yavin IV
Contact:

Re: Lua problem

Post by acryptozoo »

one fresh lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")

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

function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "local_cp"}


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

EnableSPHeroRules()

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

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(500)
SetMaxPlayerFlyHeight(500)


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


ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman",
"all_inf_rocketeer",
"all_inf_sniper",
"all_inf_engineer",
"all_inf_officer",
"all_fly_xwing_dome",
"all_fly_correlian_dome",
"all_fly_moncalimari_dome",
"all_inf_wookiee",
"all_hero_hansolo_tat")

ReadDataFile("dc:SIDE\\snw.lvl",
"snw_inf_wampa")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_bobafett",
"imp_fly_destroyer_dome")

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

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_wookiee",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_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_hansolo_tat")
SetHeroClass(IMP, "imp_hero_bobafett")

SetTeamName (3, "wampas")
AddUnitClass (3, "snw_inf_wampa", 3,15)
SetUnitCount (3, 15)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsfriend(ATT,3)
SetTeamAsfriend(3,ATT)
SetTeamAsfriend(DEF,3)
SetTeamAsfriend(3,DEF)
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: Lua problem

Post by Cerfon Rournes »

Hidden/Spoiler:
ReadDataFile("dc:SIDE\\\\snw.lvl",
"snw_inf_wampa")
Try that. The local sides tut says..
Hidden/Spoiler:
scroll down to

[code]ReadDataFile("sound\\\\yav.lvl;yav1cw") [/code]

add this below it

[code]ReadDataFile("SIDE\\\\des.lvl",
"tat_inf_jawa")[/code]
User avatar
acryptozoo
Master Bounty Hunter
Master Bounty Hunter
Posts: 1642
Joined: Wed Jun 03, 2009 3:14 pm
Projects :: Yavin Mappack
Games I'm Playing :: Homeworld 2
xbox live or psn: acryptozoo
Location: in the jungles of Yavin IV
Contact:

Re: Lua problem

Post by acryptozoo »

Cerfon Rournes wrote:
Hidden/Spoiler:
ReadDataFile("dc:SIDE\\\\snw.lvl",
"snw_inf_wampa")
Try that. The local sides tut says..
Hidden/Spoiler:
scroll down to

[code]ReadDataFile("sound\\\\yav.lvl;yav1cw") [/code]

add this below it

[code]ReadDataFile("SIDE\\\\des.lvl",
"tat_inf_jawa")[/code]
that didn't work
but i fixed it
i re copied the set as friend bit
and it worked
Post Reply