Very Need help! Campaign script errors?

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

Private First Class
User avatar
Posts: 76
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Very Need help! Campaign script errors?

Postby correctmushroom2013 » Tue Jul 10, 2018 8:15 pm

Hello everyone! It just killed me :faint: ... I've been trying to do a custom objectives for two weeks on my map. The problem is very strange in my opinion.
I created 15 objectives in which it is need to reach the point, destroy the objects, and capture the CPs. Problem in the last objectives, about CPs.

The normal version of the code works fine.
Hidden/Spoiler:
Code: Select all
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("Ambush")
   
   --  REP Attacking (attacker is always #1)
    REP = 1;
    CIS = 2;
    --  These variables do not change
    ATT = REP;
    DEF = CIS;


function ScriptPostLoad()

function StartObjectives()
   objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 15.0 }
   objectiveSequence:AddObjectiveSet(Objective1)
   objectiveSequence:AddObjectiveSet(Objective2)
   objectiveSequence:AddObjectiveSet(Objective3)
   objectiveSequence:AddObjectiveSet(Objective4)
   objectiveSequence:AddObjectiveSet(Objective5)
   objectiveSequence:AddObjectiveSet(Objective6)
   objectiveSequence:AddObjectiveSet(Objective7)
   objectiveSequence:AddObjectiveSet(Objective8)
   objectiveSequence:AddObjectiveSet(Objective9)
   objectiveSequence:AddObjectiveSet(Objective10)
   objectiveSequence:AddObjectiveSet(Objective11)
   objectiveSequence:AddObjectiveSet(Objective12)
   objectiveSequence:AddObjectiveSet(Objective13)
   objectiveSequence:AddObjectiveSet(Objective14)
   objectiveSequence:AddObjectiveSet(Objective15)
    objectiveSequence:Start()
end

SetAIDifficulty(0, 2, "hard")
        AllowAISpawn(ATT, false)
        AllowAISpawn(DEF, true)
   ScriptCB_SetGameRules("campaign")
   
      onfirstspawn = OnCharacterSpawn(
        function(character)
            if IsCharacterHuman(character) then
               ReleaseCharacterSpawn(onfirstspawn)
            onfirstspawn = nil
               objectives_timer = CreateTimer("objectives_timer")
               SetTimerValue(objectives_timer, 10)
               StartTimer(objectives_timer)
               begin_objectives = OnTimerElapse(
                  function(timer)
                      StartObjectives ()
                      ScriptCB_EnableCommandPostVO(0)
                 StartTimer(timeoutTimer)
                     end,
                     objectives_timer
                     )
            end
        end
        )   


--FIRST----------------------------------------------
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
                           text = "level.DFC.objectives.1", popupText = "level.DFC.objectives.1",
                           regionName = "goto1", mapIcon = "hud_objective_icon_circle",  AIGoalWeight = 0}
   
   Objective1:AddHint("level.geo1.hints.movement")
   Objective1:AddHint("level.geo1.hints.obj_markers")
   Objective1:AddHint("level.geo1.hints.review_objectives")
   Objective1:AddHint("level.geo1.hints.sprint")
   Objective1:AddHint("level.geo1.hints.capture_cp")
   
   
   
    Objective1.OnStart = function(self)
       MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true)
       
    end
    
    Objective1.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      MapRemoveEntityMarker("goto")
      
    end

--SECOND----------------------------------------------
Objective2 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
                           text = "level.DFC.objectives.2", popupText = "level.DFC.objectives.2",
                           regionName = "goto2", mapIcon = "hud_objective_icon_circle",  AIGoalWeight = 0}
   
   Objective2:AddHint("level.geo1.hints.weapons")
   Objective2:AddHint("level.geo1.hints.lockon")
   Objective2:AddHint("level.geo1.hints.reticle")
   Objective2:AddHint("level.geo1.hints.enemymarkers")
   
   
   
    Objective2.OnStart = function(self)
       MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true)
       
    end
    
    Objective2.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      MapRemoveEntityMarker("goto")      
      
    end

--THIRD----------------------------------------------
Objective3 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
                           text = "level.DFC.objectives.3", popupText = "level.DFC.objectives.3",
                           regionName = "goto3", mapIcon = "hud_objective_icon_circle",  AIGoalWeight = 0}
   
   Objective3:AddHint("level.geo1.hints.weapons")
   Objective3:AddHint("level.geo1.hints.lockon")
   Objective3:AddHint("level.geo1.hints.reticle")
   Objective3:AddHint("level.geo1.hints.enemymarkers")
   
   
   
    Objective3.OnStart = function(self)
       MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true)
       
    end
    
    Objective3.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      MapRemoveEntityMarker("goto")      
      
    end

--FOURTH----------------------------------------------

--objective: assault
    Dobjekt = Target:New{name = "crock4"}
   Dobjekt.OnDestroy = function(self)

   end
   
   Objective4 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
                             text = "level.DFC.objectives.4", popupText = "level.DFC.objectives.4"}
   Objective4:AddTarget(Dobjekt)


   Objective4.OnStart = function(self)
       

   end

        Objective4.OnComplete = function(self)
   ShowMessageText("game.objectives.complete", ATT)

   end

--FIFTH----------------------------------------------
--Objective 5, destroy the 4 formicides
    
    Scouts = TargetType:New{classname = "ant_inf_formicide", killLimit = 4, icon = "hud_objective_icon_circle"}
   
   Objective5 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
                       text = "level.DFC.objectives.5", popupText = "level.DFC.objectives.5",  AIGoalWeight = 0}
   Objective5:AddTarget(Scouts)
   
   Objective5:AddHint("level.geo1.hints.weapons")
   Objective5:AddHint("level.geo1.hints.lockon")
   Objective5:AddHint("level.geo1.hints.reticle")
   Objective5:AddHint("level.geo1.hints.enemymarkers")
    
    Objective5.OnStart = function(self)
       Ambush("scout_ambush_spawn", 4, 4)
       scouts_goal = AddAIGoal(4, "Defend", 100, "health_pad")
    end
    
    Objective5.OnComplete = function(self)
       ShowMessageText("game.objectives.complete", ATT)
       DeleteAIGoal(scouts_goal)
       
    end

--SIXTH----------------------------------------------
Objective6 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
                           text = "level.DFC.objectives.6", popupText = "level.DFC.objectives.6",
                           regionName = "goto4", mapIcon = "hud_objective_icon_circle",  AIGoalWeight = 0}
   
   Objective6:AddHint("level.geo1.hints.movement")
   Objective6:AddHint("level.geo1.hints.obj_markers")
   Objective6:AddHint("level.geo1.hints.review_objectives")
   Objective6:AddHint("level.geo1.hints.sprint")
   Objective6:AddHint("level.geo1.hints.capture_cp")
   
   
   
    Objective6.OnStart = function(self)
       MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true)
       
    end
    
    Objective6.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      MapRemoveEntityMarker("goto")      
      
    end

--SEVENTH----------------------------------------------
--objective: assault
    Dobjekt = Target:New{name = "sgen"}
   Dobjekt.OnDestroy = function(self)

   end
   
   Objective7 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
                             text = "level.DFC.objectives.7", popupText = "level.DFC.objectives.7"}
   Objective7:AddTarget(Dobjekt)


   Objective7.OnStart = function(self)
       

   end

        Objective7.OnComplete = function(self)
   ShowMessageText("game.objectives.complete", ATT)

   end

--EIGHT----------------------------------------------
--objective: conquest
    Objective8CP = CommandPost:New{name = "CP5"}
   Objective8 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.8", popupText = "level.DFC.objectives.8",  AIGoalWeight = 0}
   Objective8:AddCommandPost(Objective8CP)
   
   Objective8:AddHint("level.geo1.hints.capture_cp", 3.0, 1, "YELLOW", true)
   
   Objective8.OnStart = function(self)
      AICanCaptureCP("CP5", ATT, true)
      AICanCaptureCP("CP5", DEF, false)
   end
     
   Objective8.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP5", "Team", 1)
      SetProperty("CP5", "CaptureRegion", "")

    end

--NINTH----------------------------------------------
--objective: conquest
    Objective9CP = CommandPost:New{name = "CP6"}
   Objective9 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.9", popupText = "level.DFC.objectives.9",  AIGoalWeight = 0}
   Objective9:AddCommandPost(Objective9CP)
   
   Objective9:AddHint("level.geo1.hints.capture_cp")
   
   Objective9.OnStart = function(self)
      AICanCaptureCP("CP6", ATT, true)
      AICanCaptureCP("CP6", DEF, false)
   end
     
   Objective9.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP6", "Team", 1)
      SetProperty("CP6", "CaptureRegion", "")

    end

--TENTH----------------------------------------------
--objective: conquest
    Objective10CP = CommandPost:New{name = "CP8"}
   Objective10 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.10", popupText = "level.DFC.objectives.10",  AIGoalWeight = 0}
   Objective10:AddCommandPost(Objective10CP)
   
   Objective10:AddHint("level.geo1.hints.capture_cp")
   
   Objective10.OnStart = function(self)
      AICanCaptureCP("CP8", ATT, true)
      AICanCaptureCP("CP8", DEF, false)
   end
     
   Objective10.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP8", "Team", 1)
      SetProperty("CP8", "CaptureRegion", "")

    end

--ELEVENTH----------------------------------------------
--objective: conquest
    Objective11CP = CommandPost:New{name = "CP7"}
   Objective11 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.11", popupText = "level.DFC.objectives.11",  AIGoalWeight = 0}
   Objective11:AddCommandPost(Objective11CP)
   
   Objective11:AddHint("level.geo1.hints.capture_cp")
   
   Objective11.OnStart = function(self)
      AICanCaptureCP("CP7", ATT, true)
      AICanCaptureCP("CP7", DEF, false)
   end
     
   Objective11.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP7", "Team", 1)
      SetProperty("CP7", "CaptureRegion", "")

    end

--TWELFTH----------------------------------------------
--objective: conquest
    Objective12CP = CommandPost:New{name = "CP4"}
   Objective12 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.12", popupText = "level.DFC.objectives.12",  AIGoalWeight = 0}
   Objective12:AddCommandPost(Objective12CP)
   
   Objective12:AddHint("level.geo1.hints.capture_cp")
   
   Objective12.OnStart = function(self)
      AICanCaptureCP("CP4", ATT, true)
      AICanCaptureCP("CP4", DEF, false)
   end
     
   Objective12.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP4", "Team", 1)
      SetProperty("CP4", "CaptureRegion", "")

    end

--THIRTEENTH----------------------------------------------
--objective: assault
    Dobjekt = Target:New{name = "tmf"}
   Dobjekt.OnDestroy = function(self)

   end
   
   Objective13 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
                             text = "level.DFC.objectives.13", popupText = "level.DFC.objectives.13"}
   Objective13:AddTarget(Dobjekt)


   Objective13.OnStart = function(self)
       

   end

        Objective13.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)

   end


--FOURTEENTH----------------------------------------------
--objective: conquest
    Objective14CP = CommandPost:New{name = "CP3"}
   Objective14 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.14", popupText = "level.DFC.objectives.14",  AIGoalWeight = 0}
   Objective14:AddCommandPost(Objective14CP)
   
   Objective14:AddHint("level.geo1.hints.capture_cp")
   
   Objective14.OnStart = function(self)
      AICanCaptureCP("CP3", ATT, true)
      AICanCaptureCP("CP3", DEF, false)
   end
     
   Objective14.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP3", "Team", 1)
      SetProperty("CP3", "CaptureRegion", "")

    end

--FIFTEENTH----------------------------------------------
--objective: conquest
    Objective15CP = CommandPost:New{name = "CP2"}
   Objective15 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.15", popupText = "level.DFC.objectives.15",  AIGoalWeight = 0}
   Objective15:AddCommandPost(Objective15CP)
   
   Objective15:AddHint("level.geo1.hints.capture_cp")
   
   Objective15.OnStart = function(self)
      AICanCaptureCP("CP2", ATT, true)
      AICanCaptureCP("CP2", DEF, false)
   end
     
   Objective15.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      SetProperty("CP2", "Team", 1)
      SetProperty("CP2", "CaptureRegion", "")

    end

animateobja = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "sgen" then
         PlayAnimation("sdest")
      end
   end
)     

OnObjectRespawn(
      function (object)
            if GetEntityName(object) == "con1" then
                  PlayAnimation("turb")
            end   
      end
)   

animateobja = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "con1" then
         PauseAnimation("turb")
      end
   end
)

animateobja = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "pol1" then
         PlayAnimation("polak")
      end
   end
)

animateobja = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "pan" then
         PlayAnimation("do")
      end
   end
)

ActivateRegion("EnterRegion")
regionx = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then

PlayAnimation("fly")
end
end,
"EnterRegion"
)

OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "tmf" then
     SetProperty("tmf", "Team", 0)
     SetProperty("t1", "Team", 0)
     SetProperty("t2", "Team", 0)
     SetProperty("t3", "Team", 0)
     SetProperty("t4", "Team", 0)
     SetProperty("t5", "Team", 0)
     SetProperty("t6", "Team", 0)
     SetProperty("t7", "Team", 0)
      end
   end
)

OnObjectRespawn(
      function (object)
            if GetEntityName(object) == "tmf" then
     SetProperty("tmf", "Team", 1)
     SetProperty("t1", "Team", 1)
     SetProperty("t2", "Team", 1)
     SetProperty("t3", "Team", 1)
     SetProperty("t4", "Team", 1)
     SetProperty("t5", "Team", 1)
     SetProperty("t6", "Team", 1)
     SetProperty("t7", "Team", 1)
            end
      end
)
   
   
    --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"}
    cp6 = CommandPost:New{name = "cp6"}
    cp7 = CommandPost:New{name = "cp7"}
    cp8 = CommandPost:New{name = "cp8"}
   
   
   
    --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:AddCommandPost(cp6)
    conquest:AddCommandPost(cp7)
    conquest:AddCommandPost(cp8)
   
    conquest:Start()
    SetUberMode(1);

    EnableSPHeroRules()
   AddDeathRegion("deathregion1")
   
 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("dc:Load\\common.lvl")

ReadDataFile("dc:Load\\common.lvl")
   
    ReadDataFile("ingame.lvl")
   
   
    SetMaxFlyHeight(3000)
    SetMaxPlayerFlyHeight (3000)
   
    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:sound\\bx_sound.lvl;bx_soundcw")
    ReadDataFile("SIDE\\rep.lvl",
                             "rep_inf_ep3_rifleman",
                             "rep_inf_ep3_rocketeer",
                             "rep_inf_ep3_engineer",
                             "rep_inf_ep3_sniper",
                             "rep_inf_ep3_officer",
                             "rep_inf_ep3_jettrooper",
                             "rep_hover_fightertank",
                             "rep_hero_anakin")
    ReadDataFile("SIDE\\cis.lvl",
                             "cis_inf_marine",
                             "cis_inf_rocketeer",
                             "cis_inf_engineer",
                             "cis_inf_sniper",
                             "cis_inf_officer",
                             "cis_inf_droideka",
                             "cis_hero_darthmaul",
                             "cis_tread_snailtank")

    ReadDataFile("dc:SIDE\\RCS.lvl",
              "rep_inf_boss_commando",
              "rep_inf_fixer_commando",
              "rep_inf_scorch_commando",
              "rep_inf_sev_commando")


    ReadDataFile("dc:SIDE\\AQD.lvl",
              "cis_inf_aquadroid")


    ReadDataFile("dc:SIDE\\ant.lvl",
              "ant_inf_formicide",
              "ant_inf_formicide_red")


    ReadDataFile("dc:SIDE\\BXD.lvl",
              "cis_inf_BX_commandodroid")


    ReadDataFile("dc:SIDE\\MTT.lvl",
              "cis_hover_mtt")


    ReadDataFile("dc:SIDE\\tur.lvl",
             "tur_bldg_recoilless_myg_auto",
         "tur_bldg_tower") 


    ReadDataFile("dc:SIDE\\SBD.lvl",
              "cis_inf_sbd")       
                                       
                             
   SetupTeams{
      rep = {
         team = REP,
         units = 4,
         reinforcements = 4,
         soldier  = { "rep_inf_boss_commando",0, 1},
         assault  = { "rep_inf_fixer_commando",0, 1},
         engineer = { "rep_inf_scorch_commando",0, 1},
         sniper   = { "rep_inf_sev_commando",0, 1},
          
      },
      cis = {
         team = CIS,
         units = 30,
         reinforcements = 320,
         soldier  = { "cis_inf_marine",7, 8},
         assault  = { "cis_inf_BX_commandodroid",4, 6},
         engineer = { "cis_inf_engineer",3, 4},
         sniper   = { "cis_inf_sniper",3, 4},
         officer = {"cis_inf_aquadroid",3, 4},
         special = { "cis_inf_sbd",3, 4},
      }
   }


SetTeamName (3, "Formicide")
   AddUnitClass (3, "ant_inf_formicide", 2,25)
   AddUnitClass (3, "ant_inf_formicide_red", 2,25)
   SetUnitCount (3, 50)
   AddAIGoal(3, "Deathmatch", 1000) 
   SetTeamAsEnemy(ATT,3)
   SetTeamAsEnemy(3,ATT)
   SetTeamAsEnemy(DEF,3)
   SetTeamAsEnemy(3,DEF)

   

    --  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, 50) -- 3x2 (3 pairs of legs)
    local weaponCnt = 1024
    SetMemoryPoolSize("Aimer", 75)
    SetMemoryPoolSize("AmmoCounter", weaponCnt)
    SetMemoryPoolSize("BaseHint", 1024)
    SetMemoryPoolSize("EnergyBar", weaponCnt)
   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)
       SetMemoryPoolSize("AcklayData", 50)
       SetMemoryPoolSize("CommandHover", 1)
   
    SetSpawnDelay(10.0, 0.25)
    --ReadDataFile("dc:DFC\\DFC.lvl", "DFC_conquest")
    ReadDataFile("dc:DFC\\DFC.lvl", "DFC_conquest")
    SetDenseEnvironment("false")




    --  Sound
   
    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")

    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\\yav.lvl",  "yav1")
    OpenAudioStream("sound\\yav.lvl",  "yav1")
    OpenAudioStream("sound\\yav.lvl",  "yav1_emt")

    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)

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

    SetAmbientMusic(REP, 1.0, "rep_yav_amb_start",  0,1)
    SetAmbientMusic(REP, 0.8, "rep_yav_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.2, "rep_yav_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_yav_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.8, "cis_yav_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.2, "cis_yav_amb_end",    2,1)

    SetVictoryMusic(REP, "rep_yav_amb_victory")
    SetDefeatMusic (REP, "rep_yav_amb_defeat")
    SetVictoryMusic(CIS, "cis_yav_amb_victory")
    SetDefeatMusic (CIS, "cis_yav_amb_defeat")

    SetSoundEffect("ScopeDisplayZoomIn",      "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut",     "binocularzoomout")
    --SetSoundEffect("BirdScatter",             "birdsFlySeq1")
    --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

BUT! All droids after the capture of the first CP leave the base and get into the crowd at one point from the outside, ignoring all their CPs.
It happen wheh I use code with this line:
Hidden/Spoiler:
--objective: conquest
Objective8CP = CommandPost:New{name = "CP5"}
Objective8 = ObjectiveConquest:New{teamATT = ATT, TeamDEF = DEF, text = "level.DFC.objectives.8", popupText = "level.DFC.objectives.8", AIGoalWeight = 0}
Objective8:AddCommandPost(Objective8CP)

Objective8:AddHint("level.geo1.hints.capture_cp", 3.0, 1, "YELLOW", true)

Objective8.OnStart = function(self)
AICanCaptureCP("CP5", ATT, true)
AICanCaptureCP("CP5", DEF, false)
end

Objective8.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
SetProperty("CP5", "Team", 1)
SetProperty("CP5", "CaptureRegion", "")

end


If I delete this line, CP is captured and after the objective is executed, it immediately turns red.
If I remove all objectives completely, after capturing CP all droids run to protect it and capture it back.

What wrong with my code? Or map?? :runaway:

More information:
Hidden/Spoiler:
Map has 8 CPs-1 rep and 7 cis. The first command (rep) must capture all 7 CPs. Play 4 people without bots.
Map has barriers and planning. Planning is only for about 7 CP droids not associated with 1 CP.
Map has 3th team.


It's very important for me, if you know about this help me, or I can do video for more information. :bowdown:

EDIT:I tried different variants and combinations of code. Always the droids leave the base and get crowd in one point, when one CP is captured.

Resistance Leader
User avatar
Posts: 5104
Joined: Tue Feb 09, 2010 8:43 pm
Location: Greater Seattle Area
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Civ3 + DEHR
xbox live or psn: Marth8880

Re: Very Need help! Campaign script errors?

Postby Marth8880 » Wed Jul 11, 2018 12:21 pm

I'm a bit confused here. What exactly is the problem?

Private First Class
User avatar
Posts: 76
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Re: Very Need help! Campaign script errors?

Postby correctmushroom2013 » Wed Jul 11, 2018 2:11 pm

I ask you to carefully read and see everything please.
The problem is this.
All droids after the capture of one cp, leave the base and crowd at one point outside, instead of defending and capture CPs back.
Image

Resistance Leader
User avatar
Posts: 5104
Joined: Tue Feb 09, 2010 8:43 pm
Location: Greater Seattle Area
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Civ3 + DEHR
xbox live or psn: Marth8880

Re: Very Need help! Campaign script errors?

Postby Marth8880 » Wed Jul 11, 2018 9:14 pm

Please turn on aimode (by typing aimode into the debugger's console) and take a screenshot of the AI clumped up like that.

Private First Class
User avatar
Posts: 76
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Re: Very Need help! Campaign script errors?

Postby correctmushroom2013 » Thu Jul 12, 2018 11:51 am

I found a problem, this happens when I place vehicles on map. Without vehicles all done.
Also on map has command hover MTT. Droid can enter in it and use, but they don't do it with this NR99 tank on screenshot.
Hidden/Spoiler:
Image


Vehicles properties:
Hidden/Spoiler:
Image

Resistance Leader
User avatar
Posts: 5104
Joined: Tue Feb 09, 2010 8:43 pm
Location: Greater Seattle Area
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Civ3 + DEHR
xbox live or psn: Marth8880

Re: Very Need help! Campaign script errors?

Postby Marth8880 » Sat Jul 14, 2018 1:27 pm

In Objective8 = ObjectiveConquest:New{...}, try changing AIGoalWeight = 0 to AIGoalWeight = 100.

If that doesn't help, try also putting SetAIVehicleNotifyRadius(0) in the Objective8.OnStart function.

Notes:

https://github.com/marth8880/SWBF2-Lua- ... oclua#L996
http://www.secretsociety.com/forum/down ... IGoals.txt
http://www.secretsociety.com/forum/down ... mands.html

Private First Class
User avatar
Posts: 76
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Re: Very Need help! Campaign script errors?

Postby correctmushroom2013 » Sun Jul 15, 2018 4:50 pm

It does not help. I tried both variants and combined it. Nothing happens. What can I try to do next?((

Resistance Leader
User avatar
Posts: 5104
Joined: Tue Feb 09, 2010 8:43 pm
Location: Greater Seattle Area
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: Civ3 + DEHR
xbox live or psn: Marth8880

Re: Very Need help! Campaign script errors?

Postby Marth8880 » Mon Jul 16, 2018 1:54 am

Could you please post your changed code? :)

Private First Class
User avatar
Posts: 76
Joined: Fri Jul 19, 2013 11:10 am
Location: Russian Federation
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 SWTOR
xbox live or psn: No gamertag set

Re: Very Need help! Campaign script errors?

Postby correctmushroom2013 » Mon Jul 16, 2018 1:05 pm

Hidden/Spoiler:
Code: Select all
--EIGHT--
--objective: conquest
    Objective8CP = CommandPost:New{name = "CP5"}
   Objective8 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.DFC.objectives.8", popupText = "level.DFC.objectives.8",  AIGoalWeight = 100}
   Objective8:AddCommandPost(Objective8CP)
   
   Objective8:AddHint("level.geo1.hints.capture_cp")
   
   Objective8.OnStart = function(self)
      SetAIVehicleNotifyRadius(0)
      AICanCaptureCP("CP5", ATT, false)
      AICanCaptureCP("CP5", DEF, false)
      att_obj1_aigoal = AddAIGoal(ATT, "Defend", 50, "CP5")
      def_obj1_aigoal = AddAIGoal(DEF, "Defend", 50, "CP5")
      att_obj1_aigoal2 = AddAIGoal(ATT, "Deathmatch", 100)
      def_obj1_aigoal2 = AddAIGoal(DEF, "Deathmatch", 100)
   end
     
   Objective8.OnComplete = function(self)
      ShowMessageText("game.objectives.complete", ATT)
      DeleteAIGoal(att_obj1_aigoal)
      DeleteAIGoal(att_obj1_aigoal2)
      DeleteAIGoal(def_obj1_aigoal)
      DeleteAIGoal(def_obj1_aigoal2)
      SetProperty("CP5", "Team", 1)
      SetProperty("CP5", "CaptureRegion", "")

    end

I also tried change values AIGoalWeight = 100 to 200
and SetAIVehicleNotifyRadius(0) to 1000 or -1. :)

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 1 guest