How to give units extra weapons

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

Post Reply
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

How to give units extra weapons

Post by baneore »

Hi, I have made a map, how would I get my clone trooper (or any other rep unit) to have a sniper rifle and fusion cutters etc?
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: How Too: Extra weapons for units

Post by AQT »

You will have to edit the unit(s)' .odf. Check the FAQ topic, there should be a tutorial for doing these things (hint: custom sides).
User avatar
CodaRez
Field Commander
Field Commander
Posts: 940
Joined: Mon May 25, 2009 6:49 am
Projects :: I would like one.....
Location: Ride around the world! And I won't give you anything :P

Re: How Too: Extra weapons for units

Post by CodaRez »

To be precise, I hope you ahve visited this topic first: http://www.gametoast.com/forums/viewtop ... 27&t=12729

if so:

Add the corresponding .odf names into the unit .odf you want. Say "rep_inf_sniper" is the unit u use, jsut add inside something along the lines of:
WEAPONSECTION = 1
WeaponName = "rep_weap_inf_sniper_rifle"
WeaponAmmo = 7

WEAPONSECTION = 2
WeaponName = "com_weap_inf_fusioncutter"
WeaponAmmo = 0
Don't forget to add in ALL the .msh and .tga(and perhaps .option files) that the weapons AND your player model need. The sniper rifle would need its rep_weap_inf_sniper_rifle.msh and so on.

ODFs with a "com" in them like the fusioncutter are normally provided alrdy(provided you followed the make ur own sides tut: http://www.gametoast.com/forums/viewtop ... 27&t=12729 ) so no worries for em.(THIS ONLY APPLIES TO SHIPPED MSHs! NAMING A CUSTOM MODEL com_**_** WONT AHVE THE SAME EFFECT)

If you want a rifle for example, jsut find its .odf also in the assets folder, like so:
WEAPONSECTION = 1
WeaponName = "rep_weap_inf_rifle"
WeaponAmmo = 7
GL

Lol man somehow I love a job answering questions XD

EDIT: lol beaten, but anyway, heres a more direct explanation

But still, READ the custom sides tut
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

Where do i add these files?
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: How to give units extra weapons

Post by AQT »

What you are asking is covered in the custom sides tutorial. I suggest you read it and then ask questions about what you do not understand.
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

I read it like you said (that was the fourth time) and i tried to make a new side but i get missing brackets, is all this side creating stuff neccisary just to add a fusion cutter to a rep trooper unit?
Xavious
Sith Master
Sith Master
Posts: 2783
Joined: Mon Jun 12, 2006 3:46 pm

Re: How to give units extra weapons

Post by Xavious »

You could always add this line to your lua.

Code: Select all

SetClassProperty("rep_inf_yourunitname", "WeaponName2", "rep_weap_inf_fusioncutter")
Though learning how to custom sides is still something you should do.
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

Where do i put that in the lua? and do i put anyhting in place of weaponame2?
User avatar
CodaRez
Field Commander
Field Commander
Posts: 940
Joined: Mon May 25, 2009 6:49 am
Projects :: I would like one.....
Location: Ride around the world! And I won't give you anything :P

Re: How to give units extra weapons

Post by CodaRez »

Weapon making doesn't require LUA magic...

Just go to the desired units .odf and add the weapons, like I stated in CLEAR detail above.

This may be a risky procedure, but if the prob still persists and you are SURE you got everything right, go to data_(mod name)/_BUILD/Sides/(side name**). There u should find a MUNGED folder.

** - you SHOULD ahve this, if you followed the tut

Delete it, BUT MAKE SURE YOU DON'T EMPTY UR RECYCLE BIN, incase something goes wrong, then u can restore it. Re-munge again after that.

I had sides probs before where my units didn't show up, when I deleted the MUNGED folder and re-munged they came back. Hopefully this works

(REMEMBER THIS IS A LAST RESORT TACTIC, SO DON'T ABUSE IT UNLESS U KNOW WHAT UR DOING)
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How to give units extra weapons

Post by Frisbeetarian »

baneore wrote:Where do i put that in the Lua? and do i put anything in place of weaponame2?
At the end of the ScriptPostLoad section.
You don't need to change any ODFs.

It really would be best, however, to just make a new side. It's really not that hard and only adds a little to the file size.

@CodaRez
Deleting the MUNGED folder is not that big of a deal, as that is exactly what the Clean button does in Visual Munge.
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

Frisbeetarian wrote:

It really would be best, however, to just make a new side. It's really not that hard and only adds a little to the file side .


I would love to get my own side but thsi is my problem every time-
ERROR[levelpack mission\TCMg_con.req]:Expecting bracket, but none was found.
File : munged\pc\tcmg_con.script.req(1)...

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

ucft <--

2 Errors 0 Warnings
User avatar
destos
Chief Warrant Officer
Chief Warrant Officer
Posts: 349
Joined: Sat Sep 22, 2007 10:37 pm

Re: How to give units extra weapons

Post by destos »

post your lua. perhaps you added a extra , or ) or forgot to close it.
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")

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

function ScriptPostLoad()


--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"}



--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:Start()

EnableSPHeroRules()

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


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\\tat.lvl;tat2gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_marine",
"all_inf_rocketeer",
"all_inf_sniper",
"all_inf_engineer",
"all_inf_officer",
"all_inf_wookiee",
"all_hero_hansolo_tat")

ReadDataFile(dc:"SIDE\\esr.lvl",
"esr_inf_stunt_racer")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_marine",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_bobafett",
"imp_fly_destroyer_dome")


ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_tat_barge",
"tur_bldg_laser")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_marine",9, 25},
assault = { "all_inf_rocketeer",1,4},
engineer = { "all_inf_engineer",1,4},
sniper = { "all_inf_sniper",1,4},
officer = { "all_inf_officer",1,4},
special = { "all_inf_wookiee",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_marine",9, 25},
assault = { "imp_inf_rocketeer",1,4},
engineer = { "imp_inf_engineer",1,4},
sniper = { "imp_inf_sniper",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_hansolo_tat")
SetHeroClass(IMP, "imp_hero_bobafett")

AddUnitClass(IMP, "esr_inf_stunt_racer",1,4)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- 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("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)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:TCM\\TCM.lvl", "TCM_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

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

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\tat.lvl", "tat2")
OpenAudioStream("sound\\tat.lvl", "tat2")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

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(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_tat_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_tat_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_tat_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_tat_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_tat_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_tat_amb_end", 2,1)

SetVictoryMusic(ALL, "all_tat_amb_victory")
SetDefeatMusic (ALL, "all_tat_amb_defeat")
SetVictoryMusic(IMP, "imp_tat_amb_victory")
SetDefeatMusic (IMP, "imp_tat_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.974338, -0.222180, 0.035172, 0.008020, -82.664650, 23.668301, 43.955681);
AddCameraShot(0.390197, -0.089729, -0.893040, -0.205362, 23.563562, 12.914885, -101.465561);
AddCameraShot(0.169759, 0.002225, -0.985398, 0.012916, 126.972809, 4.039628, -22.020613);
AddCameraShot(0.677453, -0.041535, 0.733016, 0.044942, 97.517807, 4.039628, 36.853477);
AddCameraShot(0.866029, -0.156506, 0.467299, 0.084449, 7.685640, 7.130688, -10.895234);
end
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How to give units extra weapons

Post by Frisbeetarian »

How did you set up the .req files? The problem is probably there.
destos wrote:post your lua. perhaps you added a extra , or ) or forgot to close it.
If that were the case, the munge log would have said so while pointing out where it the script it happened.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: How to give units extra weapons

Post by [RDH]Zerted »

Yes, post the .req files you've edited. Especially TCMg_con.req.
User avatar
baneore
Private Second Class
Posts: 64
Joined: Fri Aug 01, 2008 12:58 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: How to give units extra weapons

Post by baneore »

That file -TCMg_con.req- does not exist after runin a search on my CP.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How to give units extra weapons

Post by Frisbeetarian »

That's probably because you didn't search properly. It's in ...\BF2_ModTools\data_TCM\Common\mission.

Regardless, that doesn't keep you from posting the .req files you edited for your side.
User avatar
Par3210
Jedi
Jedi
Posts: 1033
Joined: Sun Jun 14, 2009 10:31 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Owning people in SWBF2
Contact:

Re: How to give units extra weapons

Post by Par3210 »

[This Post was edited and taken off by request from the author of the post]
Last edited by Par3210 on Sun Jul 12, 2009 8:00 am, edited 1 time in total.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How to give units extra weapons

Post by Frisbeetarian »

You need to learn how to do things for yourself, not rely on others to feed you everything you need or want to know. If you read BF2 Jedi Creation.doc, it will tell you how weapons are added, down in the third section. If you read the odf_guide.doc, it will tell you how the hierarchy of ODFs work. This would help you to understand the reason I make the following suggestion. Since you are creating a new side, I would suggest that you combine any ODF you're duplicating with it's class parent, since that's going to be were the weapon sections are.

I'm going to wait until the mods break this off into a different topic to post more, since it's hijacking the original topic.
Post Reply