Scripting issues
Posted: Sat May 30, 2009 10:15 am
by MetalcoreRancor
Ok, so I've been working on a wave mode with Itfactor's upcoming map, using Maveritchell's template he allowed me to use.
The template works fine, and for the sake of confidentiality, I will not be posting that part of the lua here for reference. Aside from that, my problem is last night I was given directions by repsharpshooter to set up a table system for forced in spawning, and ending the game when the table hits 0.
I don't know a lick about this kind of coding set up, so any help would be great.
All I know is, I can't spawn as the ATT, aka hunters side, and when I switch sides it instantly spawns me as the wrong side, DEF.
The template works fine, and for the sake of confidentiality, I will not be posting that part of the lua here for reference. Aside from that, my problem is last night I was given directions by repsharpshooter to set up a table system for forced in spawning, and ending the game when the table hits 0.
I don't know a lick about this kind of coding set up, so any help would be great.
All I know is, I can't spawn as the ATT, aka hunters side, and when I switch sides it instantly spawns me as the wrong side, DEF.
Hidden/Spoiler:
[code]function ScriptPostLoad()
AllowAISpawn(ALL, false)
AllowAISpawn(IMP, false)
--ScriptCB_SetGameRules("campaign")
EnableSPHeroRules()
-- This is the actual objective setup
TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
multiplayerScoreLimit = 2000,
textATT = "game.modes.tdm",
textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
TDM:Start()
local KOH_timerSpawn = OnTimerElapse(
function( timer )
show("KOH_timerSpawn OnTimerElapse()")
--spawn new units
spawnUnits( self.teamATT )
--reset and restart the timer
SetTimerValue( "spawnTimer", self.spawnTime )
ShowTimer( "spawnTimer" )
StartTimer( "spawnTimer" )
end, "spawnTimer"
)
local spawnUnits = function( team )
show("spawnUnits()")
--check input
if not team then show("Warning: No team given.") return end
--get the amount of players on the given team
local size = GetTeamSize(team)
show(size)
--for each team member,
local a
for a = 0, size do
--get the unit of the next team member
local character = GetTeamMember(team, a)
local unit = GetCharacterUnit( character )
--if there is not a unit the character is dead, so spawn a new unit for the character
if not unit then
--get a random path and path node
local path, node = getPathAndNode( team )
--spawn the given player at the generated path point
SpawnCharacter(character, GetPathPoint(path, node))
end--if unit
end--for each team member
end--end of spawnUnits()
|wave coding|
---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",70) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",850) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",750) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",8000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",140) -- should be ~1x #combo -- should be ~1x #combo
ReadDataFile("ingame.lvl")
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
SetUberMode(1);
SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)
ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("dc:SIDE\\geo.lvl",
"hnt_inf_hunter_engineer",
"hnt_inf_hunter_commando",
"hnt_inf_hunter_melee",
"zom_inf_juggernaught",
"zom_inf_ghost",
"zom_inf_leaper",
"zom_inf_nomnom",
"zom_inf_pigzombie",
"hnt_inf_hunter_rocket",
"zom_inf_female",
"zom_inf_martyr",
"zom_inf_insanezombie",
"hnt_inf_hunter_sniper",
"hnt_inf_survivor")
ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_healthbot",
"hnt_weap_healthinjection")
SetMemoryPoolSize("MountedTurret", 35)
--ReadDataFile("SIDE\\snw.lvl", "snw_inf_wampa")
SetupTeams{
hero = {
team = ALL,
units = 6,
reinforcements = -1,
},
}
AddUnitClass(ALL, "hnt_inf_hunter_rocket",1,2)
AddUnitClass(ALL, "hnt_inf_hunter_sniper",1,2)
AddUnitClass(ALL, "hnt_inf_hunter_engineer",1,2)
SetupTeams{
villain = {
team = IMP,
units = 10,
reinforcements = -1,
},
}
AddUnitClass(IMP,"zom_inf_female",1,60)
--AddUnitClass(IMP,"zom_inf_nomnom",100,110)
--AddUnitClass(IMP,"zom_inf_juggernaught",100,110)
--AddUnitClass(IMP,"zom_inf_martyr",100,110)
--AddUnitClass(IMP,"zom_inf_insanezombie",4,10)
--AddUnitClass(IMP,"zom_inf_leaper",100,110)
--AddUnitClass(IMP,"zom_inf_ghost",100,110)
--LOL ZOMBEHS
SetTeamName(3, "Zombies")
AddUnitClass (3, "zom_inf_leaper", 100, 150)
AddUnitClass (3, "zom_inf_female", 100, 150)
AddUnitClass (3, "zom_inf_pigzombie", 40, 50)
SetUnitCount (3, 50)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)
SetTeamName(4, "Zombies")
AddUnitClass (4, "zom_inf_nomnom", 100, 150)
AddUnitClass (4, "zom_inf_juggernaught", 100, 150)
AddUnitClass (4, "zom_inf_martyr", 30, 50)
SetUnitCount (4, 50)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)
SetTeamName(5, "Zombies")
AddUnitClass(5,"zom_inf_ghost",50,75)
AddUnitClass (5, "zom_inf_insanezombie", 100, 150)
SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)
--SetTeamName(7, "Survivors")
--AddUnitClass (7, "hnt_inf_survivor", 5, 10)
--SetUnitCount (7, 15)
--AddAIGoal(7, "Deathmatch", 100)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)
SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)
SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)[/code]
AllowAISpawn(ALL, false)
AllowAISpawn(IMP, false)
--ScriptCB_SetGameRules("campaign")
EnableSPHeroRules()
-- This is the actual objective setup
TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
multiplayerScoreLimit = 2000,
textATT = "game.modes.tdm",
textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
TDM:Start()
local KOH_timerSpawn = OnTimerElapse(
function( timer )
show("KOH_timerSpawn OnTimerElapse()")
--spawn new units
spawnUnits( self.teamATT )
--reset and restart the timer
SetTimerValue( "spawnTimer", self.spawnTime )
ShowTimer( "spawnTimer" )
StartTimer( "spawnTimer" )
end, "spawnTimer"
)
local spawnUnits = function( team )
show("spawnUnits()")
--check input
if not team then show("Warning: No team given.") return end
--get the amount of players on the given team
local size = GetTeamSize(team)
show(size)
--for each team member,
local a
for a = 0, size do
--get the unit of the next team member
local character = GetTeamMember(team, a)
local unit = GetCharacterUnit( character )
--if there is not a unit the character is dead, so spawn a new unit for the character
if not unit then
--get a random path and path node
local path, node = getPathAndNode( team )
--spawn the given player at the generated path point
SpawnCharacter(character, GetPathPoint(path, node))
end--if unit
end--for each team member
end--end of spawnUnits()
|wave coding|
---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",70) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",850) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",750) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",8000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",140) -- should be ~1x #combo -- should be ~1x #combo
ReadDataFile("ingame.lvl")
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
SetUberMode(1);
SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)
ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("dc:SIDE\\geo.lvl",
"hnt_inf_hunter_engineer",
"hnt_inf_hunter_commando",
"hnt_inf_hunter_melee",
"zom_inf_juggernaught",
"zom_inf_ghost",
"zom_inf_leaper",
"zom_inf_nomnom",
"zom_inf_pigzombie",
"hnt_inf_hunter_rocket",
"zom_inf_female",
"zom_inf_martyr",
"zom_inf_insanezombie",
"hnt_inf_hunter_sniper",
"hnt_inf_survivor")
ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_healthbot",
"hnt_weap_healthinjection")
SetMemoryPoolSize("MountedTurret", 35)
--ReadDataFile("SIDE\\snw.lvl", "snw_inf_wampa")
SetupTeams{
hero = {
team = ALL,
units = 6,
reinforcements = -1,
},
}
AddUnitClass(ALL, "hnt_inf_hunter_rocket",1,2)
AddUnitClass(ALL, "hnt_inf_hunter_sniper",1,2)
AddUnitClass(ALL, "hnt_inf_hunter_engineer",1,2)
SetupTeams{
villain = {
team = IMP,
units = 10,
reinforcements = -1,
},
}
AddUnitClass(IMP,"zom_inf_female",1,60)
--AddUnitClass(IMP,"zom_inf_nomnom",100,110)
--AddUnitClass(IMP,"zom_inf_juggernaught",100,110)
--AddUnitClass(IMP,"zom_inf_martyr",100,110)
--AddUnitClass(IMP,"zom_inf_insanezombie",4,10)
--AddUnitClass(IMP,"zom_inf_leaper",100,110)
--AddUnitClass(IMP,"zom_inf_ghost",100,110)
--LOL ZOMBEHS
SetTeamName(3, "Zombies")
AddUnitClass (3, "zom_inf_leaper", 100, 150)
AddUnitClass (3, "zom_inf_female", 100, 150)
AddUnitClass (3, "zom_inf_pigzombie", 40, 50)
SetUnitCount (3, 50)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)
SetTeamName(4, "Zombies")
AddUnitClass (4, "zom_inf_nomnom", 100, 150)
AddUnitClass (4, "zom_inf_juggernaught", 100, 150)
AddUnitClass (4, "zom_inf_martyr", 30, 50)
SetUnitCount (4, 50)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)
SetTeamName(5, "Zombies")
AddUnitClass(5,"zom_inf_ghost",50,75)
AddUnitClass (5, "zom_inf_insanezombie", 100, 150)
SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)
--SetTeamName(7, "Survivors")
--AddUnitClass (7, "hnt_inf_survivor", 5, 10)
--SetUnitCount (7, 15)
--AddAIGoal(7, "Deathmatch", 100)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)
SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)
SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)[/code]