Page 1 of 1

All my bugs thread [How do I add these timers?]

Posted: Thu Jan 14, 2010 1:10 am
by wishihadaname
I tried using examples from the game scripts and just butchered/combined them toghether to form this second objective. It works, the only problem is that for some reason it just has me win as soon as objective 2 starts... I thought I set ATT team to be defensive though. Anyways, could someone please tell me what i screwed up. and also ps. how do I get the units to spawn? I set it to no spawning so that you could explore in the beggining but now IDK how to get units spawned.

here is my mission lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end
-- Hold the rally point

Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.objective2", popupText = "level.LPR.campaign.popup3", timeLimit = 240, timeLimitWiningTeam = ATT}


Objective2.OnStart = function (self)

DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")

MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)

SetProperty ("cp3", "AISpawnWeight", 100)
KillObject ("cp4")


Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")

OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 45)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)

end
end



function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)

objectiveSequence:Start()

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.
---------------------------------

Re: How do I script a defence

Posted: Thu Jan 14, 2010 2:14 am
by SW_elite
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)

Change false to true, then they will spawn.

Re: How do I script a defence

Posted: Thu Jan 14, 2010 3:53 am
by sampip
wishihadaname wrote:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end
-- Hold the rally point

Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.objective2", popupText = "level.LPR.campaign.popup3", timeLimit = 240, timeLimitWiningTeam = ATT}


Objective2.OnStart = function (self)

DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")

MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)

SetProperty ("cp3", "AISpawnWeight", 100)
KillObject ("cp4")


Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")

OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 45)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)

end
end



function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)

objectiveSequence:Start()

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.
---------------------------------
You'll need to put that line in (the red highlighted one), at the minute you're only saying there's one objective. Then it'll know there's two. Just keep on adding that line (except change the Objective number) for each objective you do.

Re: How do I script a defence

Posted: Fri Jan 15, 2010 12:53 am
by wishihadaname
Ok, also along these same lines, whats the code to increase the number of units on a team after a certain objective is complete? I started out with 15 units but you get backup after objective 3 so I need to raise that to 40 AI on the team, can I do that?

Re: How do I script a defence

Posted: Fri Jan 15, 2010 1:16 am
by Sky_216
Yep, add this line

SetUnitCount (x, y)

Where x is the team (choose from - 1, 2, 3, ATT, DEF) , Y is the number of units

Re: How do I script a defence *yet another issue*

Posted: Fri Jan 15, 2010 6:41 pm
by wishihadaname
Another problem im having ATM, I added a CTF objective to the campaign and now its not working for some reason... IDK here is the error log, the game crashes before the loading screen.

Message Severity: 2
.\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
this.CurButton = check_mode10
cur_button = nil
Checkbox for check_era3 clicked
this.CurButton = check_era3
cur_button = nil
this.CurButton = nil
cur_button = nil
custom_AddMapNew()
custom_printTable(): table: 04CF11EC
The key, value is: bSelected 1
The key, value is: era_c 1
The key, value is: mode_con_c 1
The key, value is: isModLevel 1
The key, value is: mode_c_c 1
The key is mapluafile, the formated value is: LPR<A>_<B>
custom_printTable(): Returning
custom_printTable(): table: 04CF66CC
The key, value is: key mode_con
The key, value is: subst con
The key, value is: showstr modename.name.con
The key, value is: descstr modename.description.con
The key, value is: icon mode_icon_con
custom_printTable(): Returning
gMapEras.key = era_c Era = era_c subst = c
Adding map: LPRc_c idx: 1
this.CurButton = _map_add
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `GetRegion' (a nil value)

and here is my mission lua for referance
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")
KillObject ("tankdrop1")


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroup1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end
-- Hold the rally point
Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup2", timeLimit = 240, timeLimitWiningTeam = ATT}


Objective2.OnStart = function (self)

DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")
AllowAISpawn(REP, true)
AllowAISpawn(CIS, true)

MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)

KillObject ("cp4")


Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")

OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 15)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)

end
end
--Get the radio working and call for backup

Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.LPR.campaign.capture1", popupText = "level.LPR.campaign.popup3", AIGoalWeight = 0}
Objective3:AddFlag{name = "powercell", captureRegion = "goto1",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0}

Objective3.OnStart = function(self)

AICanCaptureCP("cp3", DEF, false)


powercell_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
end
end,
"powercell"
)

powercell_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp3")
end
end,
"powercell"
)

att_obj3_def = AddAIGoal(ATT, "Defend", 100, "cp3")
def_obj3_dm = AddAIGoal(DEF, "Deathmatch", 100)
end

Objective3.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("cp3")

ReleaseFlagPickUp(powercell_capture_on)
powercell_capture_on = nil
ReleaseFlagDrop(powercell_capture_off)
powercell_capture_off = nil

DeleteAIGoal(att_obj3_def)
DeleteAIGoal(def_obj3_dm)

ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)

end



function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectiveSequence:AddObjectiveSet(Objective3)

objectiveSequence:Start()

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.
---------------------------


I know its an lua problem because conquest mode works just fine. I can't pinpoint what I did wrong though...

All my bugs thread

Posted: Fri Jan 15, 2010 11:46 pm
by wishihadaname
I don't know what I did to make this error happened but it seems that my map no longer recognises one of its CP's. I get a crash before the loading screen and all I get for a message is this

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3776)
Command Post "cp3" not found
(none):0: attempt to perform arithmetic on a nil value

It has something to do with campaign mode because the conquest mode works just fine... however it seems to not have anything to do with the actual scripting I have done because I've tried removing everything except for what has worked in the past and hasn't been changed since (objective 1). I am ABSOLUTELY sure that cp3 is called cp3 and that all the code referances are to cp3. I'm not sure what the problem here is... anyone have any ideas?

Here is my entire campaign lua just in case its needed
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")
KillObject ("tankdrop1")


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroup1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end
-- Hold the rally point
Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup2", timeLimit = 240, timeLimitWiningTeam = ATT}
Objective2:AddCommandPost(Objective2CP)

Objective2.OnStart = function (self)

DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")
AllowAISpawn(REP, true)
AllowAISpawn(CIS, true)

MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)

KillObject ("cp4")


Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")

OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 15)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)

end
end
-- Aquire Objective 3 -------------------------------------------------------------
-- Get the radio working and call for backup--

Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.LPR.campaign.capture1", popupText = "level.LPR.campaign.popup3"}

Objective3:AddFlag{name = "pol_icon_disk", captureRegion = "Team1_Capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0}

Objective3.OnStart = function (self)

AICanCaptureCP("cp3", DEF, false)

SetProperty ("cp3", "CaptureRegion", "fakecapture")

disk_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
end
end,
"pol_icon_disk"
)

disk_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp3")
end
end,
"pol_icon_disk"
)
SetProperty ("cp3", "AISpawnWeight", 100)

DEFGoal = AddAIGoal (DEF, "Deathmatch" , 100)
ATTGoal = AddAIGoal (ATT, "Defend" , 100, "cp3")

AMBGoal = AddAIGoal (AMB, "Deathmatch", 1)
-- spawn Holodisk
Holocron1Spawn = GetPathPoint("HolodiskSpawn", 0) --gets the path point
CreateEntity("pol_icon_disk", Holocron1Spawn, "pol_icon_disk") --spawns the disk
SetProperty ("pol_icon_disk", "AllowAIPickUp", 0)

end
Objective3.OnComplete = function (self)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)
ReleaseFlagPickUp(disk_capture_on)
ReleaseFlagDrop(disk_capture_off)
OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 40)
ShowMessageText("game.objectives.complete", ATT)
if self.winningTeam == self.teamDEF then
end
end

function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
--objectiveSequence:AddObjectiveSet(Objective3)

objectiveSequence:Start()

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

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\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_engineer",
"rep_inf_ep2_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep2_jettrooper",
"rep_hover_fightertank",
"rep_walk_atte",
"rep_hero_anakin",
"rep_hover_barcspeeder")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")


ReadDataFile("dc:SIDE\\tur.lvl",
"rep_bldg_artillerygun",
"tur_bldg_geoturret",
"tur_bldg_laser",
"tur_bldg_tower")

SetupTeams{
rep = {
team = REP,
units = 15,
reinforcements = 30,
soldier = { "rep_inf_ep2_rifleman",9, 25},
officer = { "rep_inf_ep3_officer",4, 6},
},
cis = {
team = CIS,
units = 40,
reinforcements = -1,
soldier = { "cis_inf_rifleman",15, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",15, 25},
--sniper = { "cis_inf_sniper",1, 4},
--officer = {"cis_inf_officer",1, 4},
--special = { "cis_inf_droideka",1, 4},
}
}


-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("CommandWalker", 6)
SetMemoryPoolSize("SoldierAnimation", 450)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("WalkerBlendUnit", 10)
SetMemoryPoolSize("WalkerLegPair", 3)
SetMemoryPoolSize("ParticleTransformer:SizeTransf", 1010)
SetMemoryPoolSize("WalkerBlend", 4)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:LPR\\LPR.lvl", "LPR_conquest")
ReadDataFile("dc:LPR\\LPR.lvl", "LPR_campaign")
SetDenseEnvironment("false")



-- Sound

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")

SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_GEO_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_GEO_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_GEO_amb_end", 2,1)

SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
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")



--OpeningSateliteShot
AddCameraShot(0.908386, -0.209095, -0.352873, -0.081226, -45.922508, -19.114113, 77.022636);

AddCameraShot(-0.481173, 0.024248, -0.875181, -0.044103, 14.767292, -30.602322, -144.506851);
AddCameraShot(0.999914, -0.012495, -0.004416, -0.000055, 1.143253, -33.602314, -76.884430);
AddCameraShot(0.839161, 0.012048, -0.543698, 0.007806, 19.152437, -49.802273, 24.337317);
AddCameraShot(0.467324, 0.006709, -0.883972, 0.012691, 11.825212, -49.802273, -7.000720);
AddCameraShot(0.861797, 0.001786, -0.507253, 0.001051, -11.986043, -59.702248, 23.263165);
AddCameraShot(0.628546, -0.042609, -0.774831, -0.052525, 20.429928, -48.302277, 9.771714);
AddCameraShot(0.765213, -0.051873, 0.640215, 0.043400, 57.692474, -48.302277, 16.540724);
AddCameraShot(0.264032, -0.015285, -0.962782, -0.055734, -16.681797, -42.902290, 129.553268);
AddCameraShot(-0.382320, 0.022132, -0.922222, -0.053386, 20.670977, -42.902290, 135.513001);
end

Re: Map doesn't recongnise itself

Posted: Sat Jan 16, 2010 1:51 pm
by KnightsFan
Is cp3 in the correct layer?

Re: Map doesn't recongnise itself

Posted: Sat Jan 16, 2010 2:04 pm
by wishihadaname
Its in the conquest layer but I added that layer as a needed part of the campaign mission and its worked before, it just recently broke.

Re: Map doesn't recongnise itself

Posted: Sat Jan 16, 2010 2:16 pm
by YaNkFaN
it could be that you destroyed them

KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")

remove those lines they are really unecessary for what you are trying to do.

If you want the AI unable to capture these CPS you can


either add this line
AICanCaptureCP("cpname", ATT, false)
or this
SetProperty("cpname", "CaptureRegion", "null")

the region named "null" here is under the terrain unable to be reached by anyone.
This is the more annoying one since you will have to put a region in ZE and then put this line
SetProperty("cpname", "CaptureRegion", "cpname_capture")
to switch the region back to the real capture region

I suggest just using
AICanCaptureCP("cpname", ATT, false)

since it is just as effective

Re: How do I script a defence [Help Still Needed]

Posted: Sat Jan 16, 2010 5:10 pm
by [RDH]Zerted
I'm not exactly sure which lines are messed up, but the problem is that not all of your Objective creation code is inside the ScriptPostLoad() function, which it should be.

Re: Map doesn't recongnise itself

Posted: Mon Jan 18, 2010 6:37 pm
by wishihadaname
I do need to kill cp's for how i planned out the mission, though removing that line did solve the problem. I think it may have to do with were the line is located. IDK ill work arround this issue. Another irrelevant but also annoying issue i've been having is with lighting. Since I don't want to spam the forums ill just post all future problems and help pleas here.

ok so problem of the day, I added shadows as directed by the GT tutorial on it but they flicker ingame. And i've got 2 error messages that are relevant but i'm not sure what to do with.

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "ParticleTransformer::SizeTransf" is full; raise count to at least 1054

and

Message Severity: 3
.\Graphics\RedLight.cpp(254)
Global light 1 must be a directional light

I assume these have something to do with it? To fix the first one do i just add it as a memory pool to my .lua or is there something more complicated to do? and what do i do with the second one?

*edit* scratch that, its not the kill object lines that caused that crash. I edited the lua to edit that line out and it still crashed. I assume that it has something to do with objectives 2 or 3 since when I edited them out it along with the kill object lines it worked*

Re: All my bugs thread

Posted: Mon Jan 18, 2010 7:14 pm
by YaNkFaN
the second one is kinda of self explanatory. make the global light a directional light instead of an omni or spot light

Re: How do I script a defence [Help Still Needed]

Posted: Mon Jan 18, 2010 9:15 pm
by wishihadaname
Zerted, what do you mean I don't have all the objective creation code I need? I looked through the shipped vanilla missions and they are structured the exact same way. What am I missing?

Also an update on what the problem is: I am 100% sure that it is the lua and that objective 1 has nothing to do with it.

How I know that:
I took my mission lua and used it to replace the default campaign lua of a blank world that only had 4 cp's and a goto region added. I got the exact same result. So that must mean that my actual map has nothing to do with this crash.

The problem now: IDK what to do to my lua to make it work. It looks exactly the same as the shipped mission scripts and I used the scripting tool and copies of shipped scripts to make it so there shouldn't be typo's. IDK... here is my entire lua again with the few changes i've added to try to get this to work.
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
--KillObject ("cp3")
--KillObject ("cp1")
--KillObject ("cp2")
KillObject ("tankdrop1")

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroup1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
-- RespawnObject("cp3")
-- RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end
--Hold the rally point
Objective2CP = CommandPost:New{name = "cp3"}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup2", timeLimit = 240, timeLimitWiningTeam = ATT}
Objective2:AddCommandPost(Objective2CP)


Objective2.OnStart = function(self)
AICanCaptureCP("cp3", ATT, false)
AICanCaptureCP("cp3", DEF, true)
att_obj2_aigoal = AddAIGoal(ATT, "Defend", 100, "cp3")
def_obj2_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
end

Objective2.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
DeleteAIGoal(att_obj2_aigoal)
DeleteAIGoal(def_obj2_aigoal)
SetProperty("cp3", "Team", 1)
SetProperty("cp3", "CaptureRegion", "")

end

-- Aquire Objective 3 -------------------------------------------------------------
-- Get the radio working and call for backup--
--
-- Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.LPR.campaign.capture1", popupText = "level.LPR.campaign.popup3"}
--
-- Objective3:AddFlag{name = "pol_icon_disk", captureRegion = "Team1_Capture",
-- capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0}
--
-- Objective3.OnStart = function (self)
--
-- AICanCaptureCP("cp3", DEF, false)
--
-- SetProperty ("cp3", "CaptureRegion", "fakecapture")
--
-- disk_capture_on = OnFlagPickUp(
-- function(flag, carrier)
-- if IsCharacterHuman(carrier) then
-- MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
-- end
-- end,
-- "pol_icon_disk"
-- )
--
-- disk_capture_off = OnFlagDrop(
-- function(flag, carrier)
-- if IsCharacterHuman(carrier) then
-- MapRemoveEntityMarker("cp3")
-- end
-- end,
-- "pol_icon_disk"
-- )
-- SetProperty ("cp3", "AISpawnWeight", 100)
--
-- DEFGoal = AddAIGoal (DEF, "Deathmatch" , 100)
-- ATTGoal = AddAIGoal (ATT, "Defend" , 100, "cp3")
--
-- AMBGoal = AddAIGoal (AMB, "Deathmatch", 1)
-- spawn Holodisk
-- Holocron1Spawn = GetPathPoint("HolodiskSpawn", 0) --gets the path point
-- CreateEntity("pol_icon_disk", Holocron1Spawn, "pol_icon_disk") --spawns the disk
-- SetProperty ("pol_icon_disk", "AllowAIPickUp", 0)
--
-- end
-- Objective3.OnComplete = function (self)
-- DeleteAIGoal(DEFGoal)
-- DeleteAIGoal(ATTGoal)
-- ReleaseFlagPickUp(disk_capture_on)
-- ReleaseFlagDrop(disk_capture_off)
-- OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
-- SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 40)
-- ShowMessageText("game.objectives.complete", ATT)
-- if self.winningTeam == self.teamDEF then
-- end
-- end
--
function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
--objectiveSequence:AddObjectiveSet(Objective3)

objectiveSequence:Start()

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

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\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_engineer",
"rep_inf_ep2_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep2_jettrooper",
"rep_hover_fightertank",
"rep_walk_atte",
"rep_hero_anakin",
"rep_hover_barcspeeder")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")


ReadDataFile("dc:SIDE\\tur.lvl",
"rep_bldg_artillerygun",
"tur_bldg_geoturret",
"tur_bldg_laser",
"tur_bldg_tower")

SetupTeams{
rep = {
team = REP,
units = 15,
reinforcements = 30,
soldier = { "rep_inf_ep2_rifleman",9, 25},
officer = { "rep_inf_ep3_officer",4, 6},
},
cis = {
team = CIS,
units = 40,
reinforcements = -1,
soldier = { "cis_inf_rifleman",15, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",15, 25},
--sniper = { "cis_inf_sniper",1, 4},
--officer = {"cis_inf_officer",1, 4},
--special = { "cis_inf_droideka",1, 4},
}
}


-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("CommandWalker", 6)
SetMemoryPoolSize("SoldierAnimation", 450)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("WalkerBlendUnit", 10)
SetMemoryPoolSize("WalkerLegPair", 3)
SetMemoryPoolSize("ParticleTransformer:SizeTransf", 1200)
SetMemoryPoolSize("WalkerBlend", 4)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:LPR\\LPR.lvl", "LPR_conquest")
ReadDataFile("dc:LPR\\LPR.lvl", "LPR_campaign")
SetDenseEnvironment("false")



-- Sound

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")

SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_GEO_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_GEO_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_GEO_amb_end", 2,1)

SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
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")



--OpeningSateliteShot
AddCameraShot(0.908386, -0.209095, -0.352873, -0.081226, -45.922508, -19.114113, 77.022636);

AddCameraShot(-0.481173, 0.024248, -0.875181, -0.044103, 14.767292, -30.602322, -144.506851);
AddCameraShot(0.999914, -0.012495, -0.004416, -0.000055, 1.143253, -33.602314, -76.884430);
AddCameraShot(0.839161, 0.012048, -0.543698, 0.007806, 19.152437, -49.802273, 24.337317);
AddCameraShot(0.467324, 0.006709, -0.883972, 0.012691, 11.825212, -49.802273, -7.000720);
AddCameraShot(0.861797, 0.001786, -0.507253, 0.001051, -11.986043, -59.702248, 23.263165);
AddCameraShot(0.628546, -0.042609, -0.774831, -0.052525, 20.429928, -48.302277, 9.771714);
AddCameraShot(0.765213, -0.051873, 0.640215, 0.043400, 57.692474, -48.302277, 16.540724);
AddCameraShot(0.264032, -0.015285, -0.962782, -0.055734, -16.681797, -42.902290, 129.553268);
AddCameraShot(-0.382320, 0.022132, -0.922222, -0.053386, 20.670977, -42.902290, 135.513001);
end
*note: could one of the admins combine this with my general troubleshooting thread? I don't wanna take up the whole forum*
^Done -Staff

Re: All my bugs thread

Posted: Mon Jan 18, 2010 10:39 pm
by Eggman
You have an extra 'end' at the end of objective 1:

Code: Select all

--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroup1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
-- RespawnObject("cp3")
-- RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)


end


end

Re: All my bugs thread [mission scripting help needed]

Posted: Wed Jan 20, 2010 2:53 pm
by wishihadaname
Ok... When i removed the extra end entirely the munge couldn't read the script. I then placed it after objective #2, the current last objective. The game then worked up to that point and then as soon as objective 2 should have started... I did not get an error message for it this time... Ill try to figure it out since my code is jumbles rather badly atm from me trying to fix it but idk, I may have another stupid bug. Thanks for the help though eggman, i would have never guessed that that extra end would have anything to do with it. What are the double ends use for anyway? I copied that line out of the felucia script.


*update*: I've gotten the script into slightly better shape. I am currently having problems with objective #2. The game crashes after it completes the objective1oncomplete section. There are no obvius error messages as to whats wrong. All I know is that it has to do with either objective 2, the start sequance or the end sequace since objective 1 works fine and objective 3 isn't used at the time of the crash.

here are all the error message that have any relavance to this at all
Message Severity: 3
.\Source\SoldierAnimatorClass.cpp(1881)
Can't find soldier animation human_sabre_jumpattack_recover(_upper)


Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2264)
ShowPopup() has been depricated. Please remove all references to it in code

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "victoryTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "delayTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "dittyTimer" not found
release self.dittyTimerResponse

and here is the mission segment of my script *updated*
Hidden/Spoiler:
-
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")
KillObject ("tankdrop1")

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)

end
end)


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroup1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 15)


end

--Hold the rally point


Objective2CP = CommandPost:New{name = "cp3"}
Objective2 = ObjectiveConquest:New{teamATT = DEF, teamDEF = ATT, textDEF = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup2", timeLimit = 240, timeLimitWiningTeam = ATT}
Objective2:AddCommandPost(Objective2CP)


Objective2.OnStart = function (self)

DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")

MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)

SetProperty ("cp3", "AISpawnWeight", 100)
SetProperty ("cp2", "AISpawnWeight", 100)
KillObject ("cp4")
AllowAISpawn(ATT, true)
AllowAISpawn(DEF, true)

AICanCaptureCP("cp3", ATT, false)

end

Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")

OBJ3_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ3_ReinforcementCount + 15)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)

end

-- Aquire Objective 3 -------------------------------------------------------------
-- Get the radio working and call for backup--

Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.LPR.campaign.capture1", popupText = "level.LPR.campaign.popup3"}

Objective3:AddFlag{name = "pol_icon_disk", captureRegion = "Team1_Capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0}

Objective3.OnStart = function (self)

AICanCaptureCP("cp3", DEF, false)

disk_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
end
end,
"pol_icon_disk"
)

disk_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp3")
end
end,
"pol_icon_disk"
)
SetProperty ("cp3", "AISpawnWeight", 100)

DEFGoal = AddAIGoal (DEF, "Deathmatch" , 100)
ATTGoal = AddAIGoal (ATT, "Defend" , 100, "cp3")

AMBGoal = AddAIGoal (AMB, "Deathmatch", 1)
-- spawn Holodisk
Holocron1Spawn = GetPathPoint("HolodiskSpawn", 0) --gets the path point
CreateEntity("pol_icon_disk", Holocron1Spawn, "pol_icon_disk") --spawns the disk
SetProperty ("pol_icon_disk", "AllowAIPickUp", 0)

end
Objective3.OnComplete = function (self)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)
ReleaseFlagPickUp(disk_capture_on)
ReleaseFlagDrop(disk_capture_off)
OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 40)
ShowMessageText("game.objectives.complete", ATT)
if self.winningTeam == self.teamDEF then

end
end
end

function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectiveSequence:AddObjectiveSet(Objective3)

objectiveSequence:Start()

end


EDIT
Sorry for double post, i've finally figured out EXACTLY whats wrong with my script. I tested out my script by completely changing objective #2 to a very simple conquest objective taken straight out of the scripting tool. Lo and behond I got a crash at exactly the same time with the exact same error message. So the explanation that I have left is that i'm missing some timers *bugs at the bottom of the post*. The issue is that I have no idea how to fix it. The shipped codes for the campaign don't include any lines to add a "ditty timer" or "delay timer" and i'm not sure how to add them, or where. For short, does anyone know were and how to add these timers?

here are those bugs again for referance

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "victoryTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "delayTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "dittyTimer" not found
release self.dittyTimerResponse

Re: All my bugs thread [How do I add these timers?]

Posted: Tue Feb 23, 2010 4:07 pm
by CressAlbane
I have those errors (timer errors)in a campaign that works perfectly, so those shouldn't be the problem.