SWBFGamers

Gaming for the Original SWBF1 and SWBF2/other games => Star Wars Battlefront 2 (2005 Original) => Topic started by: Kade on April 22, 2017, 08:51:05 AM

Title: My code wont work >:( [Solved]
Post by: Kade on April 22, 2017, 08:51:05 AM


--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Galactic Civil War Template Assault File
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("RVIg_cmn")

ScriptCB_DoFile("ObjectiveSpaceAssault")
ScriptCB_DoFile("LinkedShields")
ScriptCB_DoFile("LinkedDestroyables")

myGameMode = "RVI_GCW-Assault"

function ScriptPostLoad()
    SetupObjectives()
   
    SetupShields()
    SetupDestroyables()
    SetupTurrets()

    AddAIGoal(ALL, "Deathmatch", 100)
    AddAIGoal(IMP, "Deathmatch", 100)

DisableSmallMapMiniMap()

SetClassProperty("rep_inf_ep3_marine", "WeaponName1", "imp_weap_inf_rifle")
SetClassProperty("rep_inf_ep3_marine", "WeaponName2", "all_weap_inf_rockect_launcher")
SetClassProperty("rep_inf_ep3_pilot", "WeaponName1", "all_weap_inf_pistol")
end

function SetupObjectives()
assault = ObjectiveSpaceAssault:New{
teamATT = IMP, teamDEF = ALL,
multiplayerRules = true
}

local impTargets = {
engines = {"all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"},
lifesupport = "all-life-ext",
bridge = "all-bridge",
comm = "all-comms",
sensors = "all-sensors",
frigates = "all-frigate",
internalSys = { "all-life-int", "all-engines" },
}

local allTargets = {
engines = { "imp_drive_1", "imp_drive_2", "imp_drive_3" },
lifesupport = "imp-life-ext",
bridge = "imp-bridge",
comm = "imp-comms",
sensors = "imp-sensors",
frigates = "imp-frigate",
internalSys = { "imp-life-int", "imp-engines" },
}

assault:SetupAllCriticalSystems( "imp", impTargets, true )
assault:SetupAllCriticalSystems( "all", allTargets, false )

assault:Start()
end

function SetupShields()
    -- ALL Shielded objects   
    local linkedShieldObjectsALL = { "all_ship_1", "all_ship_2",
    "all-bridge", "all-comms", "all-life-ext", "all-sensors",
    "all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"}
    shieldStuffALL = LinkedShields:New{objs = linkedShieldObjectsALL, controllerObject = "all-shield"}
    shieldStuffALL:Init()
   
    function shieldStuffALL:OnAllShieldsDown()
        ShowMessageText("level.spa.hangar.shields.atk.down", IMP)
        ShowMessageText("level.spa.hangar.shields.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_16", IMP )
BroadcastVoiceOver( "AOSMP_obj_17", ALL )
    end
    function shieldStuffALL:OnAllShieldsUp()
        ShowMessageText("level.spa.hangar.shields.atk.up", IMP)
        ShowMessageText("level.spa.hangar.shields.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_18", IMP )
BroadcastVoiceOver( "AOSMP_obj_19", ALL )
    end
   
   
    -- IMP Shielded objects   
    local linkedShieldObjectsIMP = { "imp_ship_1", "imp_ship_2", "imp_ship_3", "imp_ship_4", "imp_ship_5", "imp_ship_6",
    "imp-bridge", "imp-comms", "imp-life-ext", "imp-sensors",
    "imp_drive_1", "imp_drive_2", "imp_drive_3"}
    shieldStuffIMP = LinkedShields:New{objs = linkedShieldObjectsIMP, controllerObject = "imp-shield"}   
    shieldStuffIMP:Init()
   
    function shieldStuffIMP:OnAllShieldsDown()
        ShowMessageText("level.spa.hangar.shields.atk.down", ALL)
        ShowMessageText("level.spa.hangar.shields.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_17", IMP )
BroadcastVoiceOver( "AOSMP_obj_16", ALL )
    end
function shieldStuffIMP:OnAllShieldsUp()
        ShowMessageText("level.spa.hangar.shields.atk.up", ALL)
        ShowMessageText("level.spa.hangar.shields.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_19", IMP )
BroadcastVoiceOver( "AOSMP_obj_18", ALL )
    end
end


function SetupDestroyables()
    --ALL destroyables
    lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"all-life-int"}, {"all-life-ext"}} }
    lifeSupportLinkageALL:Init()
       
    engineLinkageALL = LinkedDestroyables:New{ objectSets = {{"all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"}, {"all-engines"}} }
    engineLinkageALL:Init()
   
    --IMP destroyables
    lifeSupportLinkageIMP = LinkedDestroyables:New{ objectSets = {{"imp-life-int"}, {"imp-life-ext"}} }
    lifeSupportLinkageIMP:Init()   
   
    engineLinkageIMP = LinkedDestroyables:New{ objectSets = {{"imp_drive_1", "imp_drive_2", "imp_drive_3"}, {"imp-engines"}} }
    engineLinkageIMP:Init()
end

[/color]




this wont work can you help me?

its the weapon part
Title: Re: My code wont work >:(
Post by: Ltin on April 22, 2017, 09:30:36 AM
can you be more specific about what you are trying to do, and what isnt working?
Title: Re: My code wont work >:(
Post by: Ascertes on April 22, 2017, 11:53:29 AM
I'm seeing a few things in here that I've never seen in an LUA before, and I'm willing to be that's what is causing your problems (however you didn't specify what exactly was happening.)

This:
SetClassProperty("rep_inf_ep3_marine", "WeaponName1", "imp_weap_inf_rifle")
SetClassProperty("rep_inf_ep3_marine", "WeaponName2", "all_weap_inf_rockect_launcher")
SetClassProperty("rep_inf_ep3_pilot", "WeaponName1", "all_weap_inf_pistol")


And these:
ScriptCB_DoFile("RVIg_cmn")
myGameMode = "RVI_GCW-Assault"


I think it would help a bit if these could be explained.
Title: Re: My code wont work >:(
Post by: Kade on April 24, 2017, 12:55:59 PM
basically on this map. the weapons that i added to the jobs crash the game but i dont know why.

Also i started a new addon but the map uses the one from the original game files. how to i make it use mine from the mod folder and not the actual map that came with the game.
Title: Re: My code wont work >:(
Post by: Led on April 24, 2017, 02:25:31 PM
Quote from: Cpt Rex on April 24, 2017, 12:55:59 PM
basically on this map. the weapons that i added to the jobs crash the game but i dont know why.

I suggest not renaming the weapons, but edit an existing weapon to be what you want.  New weapons can require properly named ODFs, more names inside the ODFs, REQ files, animation files,  and all sorts of things that can be hard to build from nothing.

My other suggestion is to make just one change at a time, then you can find out what breaks.

Title: Re: My code wont work >:(
Post by: Kade on April 24, 2017, 02:46:33 PM
oh okay. also i added the atte to ma addon and the map makes it crash. have you had this before? if so how to fix?


    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_cloakedanakin",
"rep_hero_obiwan",
                             "rep_walk_atte")
    ReadDataFile("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("SIDE\\all.lvl",
                    "all_inf_rifleman_jungle",
                    "all_inf_rocketeer_jungle",
                    "all_inf_sniper_jungle",
                    "all_inf_engineer_jungle",
                    "all_inf_officer_jungle",
                    "all_inf_wookiee",
                    "all_hero_luke_jedi")


   
SetupTeams{
rep = {
team = REP,
units = 20,
reinforcements = 150,
soldier  = { "rep_inf_ep3_rifleman",9, 25},
assault  = { "rep_inf_ep3_rocketeer",1, 4},
engineer = { "rep_inf_ep3_engineer",1, 4},
sniper   = { "rep_inf_ep3_sniper",1, 4},
officer = {"rep_inf_ep3_officer",1, 4},
special = { "rep_inf_ep3_jettrooper",1, 4},
       
},
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier  = { "all_inf_rifleman_jungle",9, 25},
assault  = { "all_inf_rocketeer_jungle",1, 4},
engineer = { "all_inf_sniper_jungle",1, 4},
sniper   = { "all_inf_engineer_jungle",1, 4},
officer = {"all_inf_officer_jungle",1, 4},
special = { "all_inf_wookiee",1, 4},
}
}
     
    SetHeroClass(ALL, "rep_hero_obiwan")
    SetHeroClass(REP, "rep_hero_cloakedanakin")

    --  Local Stats
    --SetTeamName (3, "Lost Memories")
    --AddUnitClass (1, "cis_hero_jangofett", 1)
    --SetUnitCount (1, 1)


    --  Level Stats
    ClearWalkers()
    SetMemoryPoolSize("EntityWalker", 0)
    AddWalkerType(3, 1) -- 1 atte with 3 leg pairs each

EhPortal 1.34 © 2024, WebDev