New Unit

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

TimberWolf

New Unit

Post by TimberWolf »

Alright, I have a question that will, for once, be very easily answered. How do you make a new unit selectable on the spawn screen? Or, more generally, how to make it in-game? I have .class, .lvl, .model, .msh, .odf, .option, and .req files in place -- I just don't know what the final straw is. Most of these files were borrowed from an existing unit and I changed their names; it is highly likely that I missed some because I added them as I found a place that it looked like they needed to go in. Yes, I'm a nub, have pity. ;)
User avatar
General_Grievous_4
Rebel Sergeant
Rebel Sergeant
Posts: 214
Joined: Sun Mar 26, 2006 10:07 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: New Unit

Post by General_Grievous_4 »

Did you call for the unit correctly in the LUA? Such as putting ("dc:SIDE) in?
TimberWolf

Post by TimberWolf »

Yeah, I have dc:all and that unit is added with the others below it. This is a space map if it makes a difference.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

AddUnitClass

Post by AceMastermind »

Did you add it to the "SetUpTeams" section in your LUA like this(without the arrow) :

Code: Select all

 SetupTeams{

         rep = {
            team = REP,
            units = 26,
            reinforcements = -1,
            pilot    = { "all_inf_pilot",2},
            marine   = { "all_inf_marine",14},
            AddUnitClass(REP,"rep_inf_clone_commando",1,10), <======
        },
TimberWolf

Post by TimberWolf »

There is no such section in my LUA. This is the closest thing:

SetupUnits()
SetupTeams(myTeamConfig)

Should I add that stuff somewhere?
t551
General
General
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by t551 »

Whoa... your lua seems kinda messed up. First question -- Is your custom side named "all"?
TimberWolf

Post by TimberWolf »

Erm... I never made a custom side. I just kinda slapped the stuff into the already-existing All side folder 'cause they're the ones that're going to use it. :oops:
t551
General
General
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by t551 »

I don't think that that will work, TimberWolf, and, if it does, it will certainly not be very memory-efficient. Create a custom side as outlined in the jedi-creation doc, and take it from there.

As a side note, it does not matter what side a unit is loaded from, it can be used by any team.
TimberWolf

Post by TimberWolf »

Okay, I've seen the error of my ways and I made a new side. It still won't show up in-game, though. My new side is called Alladdon, by the way. Here's my LUA:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

function SetupUnits()
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_marine",
"all_fly_xwing_sc",
"all_fly_ywing_sc",
"all_fly_awing",
"all_fly_gunship_sc",
"all_veh_remote_terminal")
ReadDataFile("dc:SIDE\\imp.lvl",
"imp_inf_pilot",
"imp_inf_marine",
"imp_fly_tiefighter_sc",
"imp_fly_tiebomber_sc",
"imp_fly_tieinterceptor",
"imp_fly_trooptrans",
"imp_veh_remote_terminal")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
)
end

myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
saboteur = { ALLADDON,"alladdon_inf_saboteur",3,0},
},

imp = {
team = IMP,
units = 32,
reinforcements = -1,
pilot = { "imp_inf_pilot",26},
marine = { "imp_inf_marine",6},
}
}

ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", IMP )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", IMP )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp-defense",
turrets = {"imp_turr_1", "imp_turr_2", "imp_turr_3", "imp_turr_4", "imp_turr_5", "imp_turr_6"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
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()

-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")

SetMinFlyHeight(-1800)
SetMaxFlyHeight(1800)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(1800)
SetAIVehicleNotifyRadius(100)

ReadDataFile("sound\\spa.lvl;spa1gcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 190)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("Combo::DamageSample", 0)
SetMemoryPoolSize("CommandFlyer", 2)
SetMemoryPoolSize("SoldierAnimation", 180)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 0)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 56)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", guyCnt)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", guyCnt)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 240)
SetMemoryPoolSize("UnitAgent", 65) -- guyCnt*2
SetMemoryPoolSize("UnitController", 65)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end

ReadDataFile("dc:SWS\\spa_sky.lvl", "end")

ReadDataFile("dc:SWS\\SWS.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(IMP, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start", 0,1)
SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(IMP, "imp_spa_amb_victory")
SetDefeatMusic (IMP, "imp_spa_amb_defeat")

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

-- Camera Stats
SetAttackingTeam(IMP)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(-0.049495, 0.003922, -0.995646, -0.078892, 24.992880, -22.995819, -1025.940186);
--Flag shot
AddCameraShot(0.546201, 0.047743, 0.833116, -0.072822, 402.610260, -105.474068, -55.044727);
--Internal Imperial hangar
AddCameraShot(0.988295, -0.091070, 0.121873, 0.011230, 33.932011, 10.868500, 1567.624146);
-- Imperial ship overall
AddCameraShot(-0.380690, 0.021761, -0.922940, -0.052756, 1351.167236, 188.651230, -10.971837);
-- Alliance ship overall
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion1")
AddDeathRegion("deathregion2")
AddLandingRegion("all-CP1Con")
AddLandingRegion("imp-CP1Con")

end
In my alladdon sides folder (and in their respective folders) I have...

-The infantry default, my unit's default, my unit, and his weapon ODFs

-My unit's normal and low-quality MSHs with their option files, my unit's TGA, and weapon MSH and option files (in PC subfolder)

-My unit's Req file

-Nothing in the Munged folder

-Nothing in the effects folder

The unit is listed in the Side's req file. I don't think I need anything in the Munged or Effect folders because he's just a soldier.
Hebes24
Sith Master
Sith Master
Posts: 2594
Joined: Sat Jun 03, 2006 5:15 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: In An Epic Space Battle!
Contact:

Post by Hebes24 »

Change this:
myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
saboteur = { ALLADDON,"alladdon_inf_saboteur",3,0},
},

imp = {
team = IMP,
units = 32,
reinforcements = -1,
pilot = { "imp_inf_pilot",26},
marine = { "imp_inf_marine",6},
}
}
to this:
myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
saboteur = { ALLADDON,"alladdon_inf_saboteur",3,0},
},

imp = {
team = IMP,
units = 32,
reinforcements = -1,
pilot = { "imp_inf_pilot",26},
marine = { "imp_inf_marine",6},
}
}

AddUnitClass(ALL,"alladdon_inf_saboteur", 1, 3)
and make sure you have this in the lua:
ReadDataFile("dc:SIDE\\ALLaddon.lvl",
"alladdon_inf_saboteur")
TimberWolf

Post by TimberWolf »

I did those two things but it still won't appear ingame. When I munged, I got two errors, as follows.
ERROR[levelpack mission\SWSg_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\swsg_cmn.script.req(1)...

ucft <--
ERROR[levelpack mission\SWSg_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\swsg_cmn.script.req(1)...

ucft <--

2 Errors 0 Warnings
Hebes24
Sith Master
Sith Master
Posts: 2594
Joined: Sat Jun 03, 2006 5:15 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: In An Epic Space Battle!
Contact:

Post by Hebes24 »

Post the updated LUA.
TimberWolf

Post by TimberWolf »

Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

function SetupUnits()
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_marine",
"all_fly_xwing_sc",
"all_fly_ywing_sc",
"all_fly_awing",
"all_fly_gunship_sc",
"all_veh_remote_terminal")
ReadDataFile("dc:SIDE\\imp.lvl",
"imp_inf_pilot",
"imp_inf_marine",
"imp_fly_tiefighter_sc",
"imp_fly_tiebomber_sc",
"imp_fly_tieinterceptor",
"imp_fly_trooptrans",
"imp_veh_remote_terminal")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"

ReadDataFile("dc:SIDE\\ALLaddon.lvl",
"alladdon_inf_saboteur")
)
end

myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
saboteur = { ALLADDON,"alladdon_inf_saboteur",3,0},
},

imp = {
team = IMP,
units = 32,
reinforcements = -1,
pilot = { "imp_inf_pilot",26},
marine = { "imp_inf_marine",6},
}
}

AddUnitClass(ALL,"alladdon_inf_saboteur", 1, 3)

ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", IMP )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", IMP )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp-defense",
turrets = {"imp_turr_1", "imp_turr_2", "imp_turr_3", "imp_turr_4", "imp_turr_5", "imp_turr_6"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
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()

-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")

SetMinFlyHeight(-1800)
SetMaxFlyHeight(1800)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(1800)
SetAIVehicleNotifyRadius(100)

ReadDataFile("sound\\spa.lvl;spa1gcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 190)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("Combo::DamageSample", 0)
SetMemoryPoolSize("CommandFlyer", 2)
SetMemoryPoolSize("SoldierAnimation", 180)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 0)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 56)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", guyCnt)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", guyCnt)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 240)
SetMemoryPoolSize("UnitAgent", 65) -- guyCnt*2
SetMemoryPoolSize("UnitController", 65)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end

ReadDataFile("dc:SWS\\spa_sky.lvl", "end")

ReadDataFile("dc:SWS\\SWS.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(IMP, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start", 0,1)
SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(IMP, "imp_spa_amb_victory")
SetDefeatMusic (IMP, "imp_spa_amb_defeat")

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

-- Camera Stats
SetAttackingTeam(IMP)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(-0.049495, 0.003922, -0.995646, -0.078892, 24.992880, -22.995819, -1025.940186);
--Flag shot
AddCameraShot(0.546201, 0.047743, 0.833116, -0.072822, 402.610260, -105.474068, -55.044727);
--Internal Imperial hangar
AddCameraShot(0.988295, -0.091070, 0.121873, 0.011230, 33.932011, 10.868500, 1567.624146);
-- Imperial ship overall
AddCameraShot(-0.380690, 0.021761, -0.922940, -0.052756, 1351.167236, 188.651230, -10.971837);
-- Alliance ship overall
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion1")
AddDeathRegion("deathregion2")
AddLandingRegion("all-CP1Con")
AddLandingRegion("imp-CP1Con")

end
Hebes24
Sith Master
Sith Master
Posts: 2594
Joined: Sat Jun 03, 2006 5:15 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: In An Epic Space Battle!
Contact:

Post by Hebes24 »

Try getting rid of this line (Should've put that in my last post. *slaps forehead*)
saboteur = { ALLADDON,"alladdon_inf_saboteur",3,0},
TimberWolf

Post by TimberWolf »

F:\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\common\scripts\SWS\SWSg_cmn.lua:43: `)' expected (to close `(' at line 34) near `ReadDataFile'
ERROR[scriptmunge scripts\SWS\SWSg_cmn.lua]:Could not read input file.ERROR[scriptmunge scripts\SWS\SWSg_cmn.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

ERROR[levelpack mission\SWSg_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\swsg_cmn.script.req(1)...

ucft <--
ERROR[levelpack mission\SWSg_Diet Dr. Pepper.req]:Expecting bracket, but none was found.
File : munged\pc\swsg_cmn.script.req(1)...

ucft <--

2 Errors 0 Warnings
Still not working. :(
t551
General
General
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by t551 »

You still have "dc:" infront of the all and imp.lvl assets loading:

ReadDataFile("dc:SIDE\\all.lvl", => ReadDataFile("SIDE\\all.lvl",

and the same for the imps.
Hebes24
Sith Master
Sith Master
Posts: 2594
Joined: Sat Jun 03, 2006 5:15 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: In An Epic Space Battle!
Contact:

Post by Hebes24 »

Right Here....:
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"
....you forgot to close the parentheses for the ReadDataFile.
t551
General
General
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by t551 »

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof"

ReadDataFile("dc:SIDE\\ALLaddon.lvl",
"alladdon_inf_saboteur")
) <======================
end

What is that doing there (another problem)... Actually, I think it's the closing parenthesis of the tur.lvl ReadDataFile block.
TimberWolf

Post by TimberWolf »

It's a conspiracy! Alright. I made those changes and, miraculously, there were no errors when I munged. Alas, my unit perseveres in its efforts to avoid being in-game. Ugh. Here's the LUA.
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

ScriptCB_DoFile("setup_teams")

-- Republic Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2

function SetupUnits()
ReadDataFile("SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_marine",
"all_fly_xwing_sc",
"all_fly_ywing_sc",
"all_fly_awing",
"all_fly_gunship_sc",
"all_veh_remote_terminal")
ReadDataFile("SIDE\\imp.lvl",
"imp_inf_pilot",
"imp_inf_marine",
"imp_fly_tiefighter_sc",
"imp_fly_tiebomber_sc",
"imp_fly_tieinterceptor",
"imp_fly_trooptrans",
"imp_veh_remote_terminal")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_imp_beam",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_chaingun_roof")

ReadDataFile("dc:SIDE\\ALLaddon.lvl",
"alladdon_inf_saboteur")

end

myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
},

imp = {
team = IMP,
units = 32,
reinforcements = -1,
pilot = { "imp_inf_pilot",26},
marine = { "imp_inf_marine",6},
}
}

AddUnitClass(ALL,"alladdon_inf_saboteur", 1, 3)

ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", IMP )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", IMP )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp-defense",
turrets = {"imp_turr_1", "imp_turr_2", "imp_turr_3", "imp_turr_4", "imp_turr_5", "imp_turr_6"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
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()

-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")

SetMinFlyHeight(-1800)
SetMaxFlyHeight(1800)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(1800)
SetAIVehicleNotifyRadius(100)

ReadDataFile("sound\\spa.lvl;spa1gcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 190)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("Combo::DamageSample", 0)
SetMemoryPoolSize("CommandFlyer", 2)
SetMemoryPoolSize("SoldierAnimation", 180)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 0)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 56)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", guyCnt)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", guyCnt)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 240)
SetMemoryPoolSize("UnitAgent", 65) -- guyCnt*2
SetMemoryPoolSize("UnitController", 65)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end

ReadDataFile("dc:SWS\\spa_sky.lvl", "end")

ReadDataFile("dc:SWS\\SWS.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "imp_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(IMP, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_spa_amb_start", 0,1)
SetAmbientMusic(IMP, 0.99, "imp_spa_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.1,"imp_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(IMP, "imp_spa_amb_victory")
SetDefeatMusic (IMP, "imp_spa_amb_defeat")

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

-- Camera Stats
SetAttackingTeam(IMP)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(-0.049495, 0.003922, -0.995646, -0.078892, 24.992880, -22.995819, -1025.940186);
--Flag shot
AddCameraShot(0.546201, 0.047743, 0.833116, -0.072822, 402.610260, -105.474068, -55.044727);
--Internal Imperial hangar
AddCameraShot(0.988295, -0.091070, 0.121873, 0.011230, 33.932011, 10.868500, 1567.624146);
-- Imperial ship overall
AddCameraShot(-0.380690, 0.021761, -0.922940, -0.052756, 1351.167236, 188.651230, -10.971837);
-- Alliance ship overall
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion1")
AddDeathRegion("deathregion2")
AddLandingRegion("all-CP1Con")
AddLandingRegion("imp-CP1Con")

end
Meh, I don't know. I must be missing something fundamental and 'duh-inspiring.' It just won't appear to be spawnable as. If you're thinking "he must have done that...." and move on, don't -- I'm a total newb. ;)
t551
General
General
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by t551 »

AddUnitClass(ALL,"alladdon_inf_saboteur", 1, 3) =====> I'm fairly certain that this is wrong -- it's not inside one fo the team setups. Instead, it should be:

myTeamConfig = {
all = {
team = ALL,
units = 16,
reinforcements = -1,
soldier = { "alladon_inf_saboteur", <a number>}, <===============
pilot = { "all_inf_pilot",12},
marine = { "all_inf_marine",4},
},
Post Reply