Replacing weapons [Solved]

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

MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Replacing weapons [Solved]

Post by MidnightSpirit »

Does anyone know where to find a tutorial that explains how to replace weapons on a custom map?

Yes, I checked the FAQ under Custom Sides but I didn't find one that explains replacing the weapons all I found was completely making your own side.

I replaced all of the odfs and mshs for the weapons but it did not work.
Last edited by MidnightSpirit on Sat Jan 11, 2014 1:49 pm, edited 3 times in total.
JimmyAngler
High General
High General
Posts: 837
Joined: Mon Nov 04, 2013 10:37 am
Projects :: Battlefront Halation
Games I'm Playing :: SWBF 1-2-2015
xbox live or psn: none
Location: Area 51

Re: Replacing weapons

Post by JimmyAngler »

you need to add the weapons odf(your_weapon_name) under you unit's odf (your_units_name)under you custom side odf folder. (lot's of odf :D )
spearmint1934
Private Recruit
Posts: 15
Joined: Mon Dec 30, 2013 7:15 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBFII
xbox live or psn: No gamertag set

Re: Replacing weapons

Post by spearmint1934 »

Download Fierfek's Map making document.

http://starwarsbattlefront.filefront.co ... ial;106441
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

I have Fierfek's tutorial and it says to replace the name just like Jimmy was saying.
I did try this and when the game loads the same old battle rifle appears which is why i tried keeping the names the same and changing the custom weapon's name.
Nothing has changed though.

Out of curiosity, I have no idea where to find the skin for the rep_weap_inf_rifle if someone would tell me where that is I would appreciate the help with that as well.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

1st.: http://www.gametoast.com/forums/viewtop ... 27&t=13806
There is an own topic for odf files.

2nd.: http://www.gametoast.com/forums/search.php

3rd.: read Tutorials and the problems of other members. Even if they are not for your problem it helps you to understand how BF2 is working.

4th.: http://www.gametoast.com/forums/viewtop ... 90#p498090

When Jimmy started modding i wrote him this to understand in what order BF calls the files.
lua > side.req > unit.req > unit.odf > unit_default.odf/msh/weapon.odf
So look in your mod lua and look if you use the dc. (<- if you are wondering what that is READ TUTORIALS Firefek's is really good and this is a really basic)
than look in your rep.req file is there your unit.req file. and in this should be your unit's odf file called. and there you should find the unit's default odf file, msh name, and weapon odf.

And in the weapon.odf you'll find again an default name of the weapon and it's msh, properties,...
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

Okay I will do that.
What I am not understanding is that I get the custom unit's odf and msh file and put them in the appropriate folders, edit the unit's odf to accept and load the weapon in game, but it doesnt load. I am assuming this is because the skin for the custom unit is not being loaded the problem is that I can't find a tga file for the weapon or any of the stock weapons. How do they have skins with no tga file?
I know this is the problem because when I use SWBFViewer0.03 in the origin file for the custom weapon is comes up skinned and everything but after I move the odfs and msh files into my map's files and try to view them they come up unskinned. When I replace a stock weapon with another stock weapon it works perfectly fine so that is why I think the skin is the problem.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

If only the tga is missing you'd have an untexture or invisible weapon.

The tgas are in the pc folder for some weaüpns. Just copy them into your rep folder. You can see in the mah viewer what the name of the tgas are
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

You're right the TGA's are not the problem I found them and applied them and the problem still is not fixed.

I went and deleted all the original weapon files and placed the custom files in their appropriate folders including putting them in the PC folder. When I load the game the original weapons are still being loaded.

Is there any tutorial specifically about applying custom weapons? Fierfek's mapping tut only talked about swapping exsisting stock weapons.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Replacing weapons

Post by Noobasaurus »

Do you have "dc:" before the side data is loaded in your lua?

Example:

Code: Select all

ReadDataFile("dc:SIDE\\all.lvl"
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

Yeah I have custom skins loaded in and everything
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

Ok.

So to make a new weapon you'll need these files:

weapon.odf
weapon_ord.odf
maybe weapon_exp.odf depending on what kind of weapon it is
weapon.msh
weapon.tga

the weapon.tga must fit to the weapon.msh you can check this in the swbfviewer.
the weapon.msh must be called under Geometry/highgeometry in the weapon.odf. the weapon_ord.odf is also called by the weapon.odf.

Than you go to your rep_inf_rifleman.odf and change the rep_weap_inf_rifle to weapon.

Please check if all files have the right name. And all files have the right extension. There are often things like .odf.txt windows did not show the .txt but under properties it says text file.
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

Ah the problem was in the weapon odf it was calling for the original msh instead of the new one. Thank you very much haha.

Edit:
With the weapon in game it does show the weapon icon in the middle of the screen though. ANy tutorials on how to fix that?
JimmyAngler
High General
High General
Posts: 837
Joined: Mon Nov 04, 2013 10:37 am
Projects :: Battlefront Halation
Games I'm Playing :: SWBF 1-2-2015
xbox live or psn: none
Location: Area 51

Re: Replacing weapons [Solved]

Post by JimmyAngler »

As always, the FAQ is very useful.

Here it is specifically.

http://www.gametoast.com/forums/viewtop ... =64&t=9703
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons [Solved]

Post by MidnightSpirit »

Once again thanks

Edit:

Okay I did what the tutorial said but I'm still having troubles.
The weapon causing problems is a rifle so when positioning the weapon icon like the tut says I copied the rep_weap_inf_rifle info for it which is:

Position(-0.200247, 0.364485, 0.003263, "Viewport")
Rotation(1.538445, 95.690582, 4.455857)
Scale(0.800000, 0.800000, 0.800000)

I munge and the icon remains in the same position as before completely unchanged.
Regarding other parts of the tutorial where I might have messed up here is the work that I did.

Step 5:
Hidden/Spoiler:
[code] TransformNameMesh("player1weapon1")
// add msh names of first weapons here and remove unused lines
{

NameMesh("rep_weap_inf_DC-15A_Blaster_Rifle", "com_inv_mesh")[/code]
Hidden/Spoiler:
[code] MeshInfo("rep_weap_inf_DC-15A_Blaster_Rifle")
{
Position(-0.200247, 0.364485, 0.003263, "Viewport")
Rotation(1.538445, 95.690582, 4.455857)
Scale(0.800000, 0.800000, 0.800000)
}[/code]
Step 4:
Hidden/Spoiler:
[code]ucft
{
REQN
{
"model"

"rep_inf_ep3trooper"
"rep_weap_DC-15A_Blaster_Rifle"

"rep_inf_ep3spacepilot"
"rep_weap_inf_pistol"

"rep_inf_ep3heavytrooper"
"rep_weap_inf_launcher"

"rep_inf_ep3sniper"
"rep_weap_inf_sniperrifle"

"rep_inf_ep3armoredpilot"

"rep_inf_clonecommander"
"rep_weap_inf_chaingun"

"rep_inf_ep3jettrooper"
}

REQN
{
"model"
"com_inv_mesh"

}

REQN
{
"config"
"extraweapons"

}
}[/code]
Step 3:
Hidden/Spoiler:
[code][Properties]
HUDTag = "rep_weap_DC-15A_Blaster_Rifle"
GeometryName = "rep_weap_DC-15A_Blaster_Rifle"
HighResGeometry = "rep_weap_DC-15A_Blaster_Rifle"
OrdnanceName = "rep_weap_inf_rifle_ord"
FirePointName = "hp_fire"[/code]
Sorry for the backwards order my first intention was not to post all the steps but then I did haha
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

So than change the values, untill the weapon is at its right position. There is no value that's for all weapons. the dc15p for example was directly at the right position, where as the dc17 are not.
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

The problem is that no matter how drastically I change the numbers and them munge the weapon icon stays in the same position.
I changed its rotation and hieght by a lot and nothing happened.

Position(2.400247, 7.364485, 0.003263, "Viewport")
Rotation(6.538445, 95.690582, 4.455857)
Scale(0.800000, 0.800000, 0.800000)

It remains aiming back at the player.
JimmyAngler
High General
High General
Posts: 837
Joined: Mon Nov 04, 2013 10:37 am
Projects :: Battlefront Halation
Games I'm Playing :: SWBF 1-2-2015
xbox live or psn: none
Location: Area 51

Re: Replacing weapons

Post by JimmyAngler »

this is my extraweapons.hud file for you to use as a reference.
Hidden/Spoiler:
Code:

ViewPort("Transforms")
{
EventNameFilter("player%")

// First Weapons Section

TransformNameMesh("player1weapon1")
// add msh names of first weapons here and remove unused lines
{
NameMesh("rep_weap_dc15marine", "com_inv_mesh")
NameMesh("rep_weap_dc15marine", "com_inv_mesh")
NameMesh("dragunov", "com_inv_mesh")
NameMesh("remington", "com_inv_mesh")
NameMesh("heavy_assault_pistol", "com_inv_mesh")


EventInput("player1.weapon1.change")
EventOutput("player1.weapon1.mesh")
}
}

Group("extraWeaponDisplay")
{
PropagateAlpha(1)
Viewport(1)
Position(0.0000000, 1.000000, 0.000000, "Viewport")
ZOrder(255)
EventEnable("player1.weaponsEnable")
EventDisable("player1.weaponsDisable")

Group("extraWeaponIcon")
{
Viewport(1)
Position(0.346161, -0.450412, 0.000000, "Viewport")
EventEnable("initialize")

Model3D("player1.weapon1mesh")
{
EventMesh("player1.weapon1.change")
Viewport(1)
ZOrder(5)
EventEnable("player1.weapon1.mesh")
EventDisable("player1.weapon1.disable")
Position(500.000000, 500.000000, 500.000000, "Viewport")
Rotation(0.804269, 359.994110, 359.999695)
Scale(0.000000, 0.000000, 0.000000)

//change position, rotation and scale of first weapon here, remove unused lines

MeshInfo("rep_weap_dc15marine")
{
Position(-0.258881, 0.364262, 0.013887, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
Scale(0.720000, 0.720000, 0.720000)
}

MeshInfo("rep_weap_dc15marine")
{
Position(-0.222832, 0.361293, 0.014590, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
}

MeshInfo("dragunov")
{
Position(-0.222832, 0.361293, 0.014590, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
}

MeshInfo("remington")
{
Position(-0.222832, 0.361293, 0.014590, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
}

MeshInfo("heavy_assault_pistol")
{
Position(-0.222832, 0.361293, 0.014590, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
}

}
}
}
my rep.req:
Hidden/Spoiler:
ucft
{
REQN
{
"lvl"
"rep_inf_ep3_rifleman"
"rep_inf_ep3_rocketeer"
"rep_inf_ep3_sniper"
"rep_inf_ep3_engineer"

}

REQN
{
"model"
"com_inv_mesh"
}

REQN
{
"config"
"extraweapons"
}
}
notice the last few lines.
Yours needs to follow this format in order to work.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

My idea: you moved your icon out of the view and the namemesh has an error. Please post the complete extra weapon. Do you have the com_inv_mesh in your rep msh folder??
MidnightSpirit
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Mon Aug 15, 2011 1:29 pm
Games I'm Playing :: BF2
xbox live or psn: ApocryphicDeath

Re: Replacing weapons

Post by MidnightSpirit »

I haven't had time to test it out which is why I ask, but now that I can munge sides properly would moving the weapon icon off-screen mess anything up? It sounds easier than fitting it in perfectly (I have no problem doing that) just curious.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Replacing weapons

Post by Anakin »

i thought on removing the icons, too, but with it looked better ;) there are much other games with no weapon icon (SWRC for example). But i think this depends on how much weapon you have. if there are only 3 or 4 weapons you use, i think you wouldn't need any HUD icons. (you can remove the HUDTag = "my HUD Icon" line from the weapon odf, so you needn't make the extraweapon thing)
Post Reply