Random Side script crashing (new one...) [Solved]
Posted: Thu Jul 11, 2013 8:47 pm
by Dreadnot9
Using this script:
I get this error and a ctd:
My guess is that I have to separate the math.random functions, but i'm not entirely sure how.
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 RandomSetupCIS()
if unexpected_condition then error() end
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bdroid",
"cis_inf_sniper",
"cis_inf_rocketeer")
cissoldier = "cis_inf_bdroid"
cisassault = "cis_inf_rocketeer"
cissniper = "cis_inf_ig"
RandomSupport = math.random(1,8) --Pic a number between 1 and 10
if RandomSupport <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_engineer")
cisengineer = "cis_inf_engineer"
end
if RandomSupport >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_nemodian")
cisengineer = "cis_inf_nemodian"
end
if RandomSupport >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_geonosian")
cisengineer = "cis_inf_geonosian"
end
--------------
RandomHeavy = math.random(1,8) --Pic a number between 1 and 10
if RandomHeavy <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_sbd")
cisheavy = "cis_inf_sbd"
end
if RandomHeavy >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_sarge")
cisheavy = "cis_inf_sarge"
end
if RandomHeavy >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_merc")
cisheavy = "cis_inf_merc"
end
--------------
RandomSpecial = math.random(1,8) --Pic a number between 1 and 10
if RandomSpecial <5 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_airdroid")
cisspecial = "cis_inf_airdroid"
end
if RandomSpecial >4 and RandomSetup <8 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_droideka")
cisspecial = "cis_inf_droideka"
end
--if RandomSpecial >5 and RandomSetup <8 then --if math.random results in 6 or 7
-- ReadDataFile("dc:SIDE\\cis.lvl",
-- "rep_inf_assassin")
--
--cisspecial = "rep_inf_assassin"
--end
--------------
RandomOfficer = math.random(1,8) --Pic a number between 1 and 10
if RandomOfficer <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bx")
cisofficer = "cis_inf_bx"
end
if RandomOfficer >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_OOM")
cisofficer = "cis_inf_OOM"
end
if RandomOfficer >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_magnaguard")
cisofficer = "cis_inf_magnaguard"
end
--end
end
-- 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 RandomSetupCIS()
if unexpected_condition then error() end
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bdroid",
"cis_inf_sniper",
"cis_inf_rocketeer")
cissoldier = "cis_inf_bdroid"
cisassault = "cis_inf_rocketeer"
cissniper = "cis_inf_ig"
RandomSupport = math.random(1,8) --Pic a number between 1 and 10
if RandomSupport <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_engineer")
cisengineer = "cis_inf_engineer"
end
if RandomSupport >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_nemodian")
cisengineer = "cis_inf_nemodian"
end
if RandomSupport >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_geonosian")
cisengineer = "cis_inf_geonosian"
end
--------------
RandomHeavy = math.random(1,8) --Pic a number between 1 and 10
if RandomHeavy <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_sbd")
cisheavy = "cis_inf_sbd"
end
if RandomHeavy >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_sarge")
cisheavy = "cis_inf_sarge"
end
if RandomHeavy >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_merc")
cisheavy = "cis_inf_merc"
end
--------------
RandomSpecial = math.random(1,8) --Pic a number between 1 and 10
if RandomSpecial <5 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_airdroid")
cisspecial = "cis_inf_airdroid"
end
if RandomSpecial >4 and RandomSetup <8 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_droideka")
cisspecial = "cis_inf_droideka"
end
--if RandomSpecial >5 and RandomSetup <8 then --if math.random results in 6 or 7
-- ReadDataFile("dc:SIDE\\cis.lvl",
-- "rep_inf_assassin")
--
--cisspecial = "rep_inf_assassin"
--end
--------------
RandomOfficer = math.random(1,8) --Pic a number between 1 and 10
if RandomOfficer <4 then --if math.random results in 2 or three (and maybe 1)
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_bx")
cisofficer = "cis_inf_bx"
end
if RandomOfficer >3 and RandomSetup <6 then --if math.random results in 4 or 5
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_OOM")
cisofficer = "cis_inf_OOM"
end
if RandomOfficer >5 and RandomSetup <8 then --if math.random results in 6 or 7
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_magnaguard")
cisofficer = "cis_inf_magnaguard"
end
--end
end
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to compare nil with number
stack traceback:
(none): in function `RandomSetupCIS'
(none): in function `ScriptInit'
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to compare nil with number
stack traceback:
(none): in function `RandomSetupCIS'
(none): in function `ScriptInit'