Page 1 of 1

Mapside StandardMesh for HandWeapon

Posted: Mon Jan 14, 2013 4:35 am
by Swaffy
My goal is to change the texture of my Stg-44 weapon, but I also need to change the StandardMesh of the weapon.

Mapside.

My mod's StandardMesh for my Stg-44 has a different path than the original one (it is the path to an animated texture).
The texture path for this one is "Mods/Swaffy'sMod/Movies/mp44_r"

And I want to add the original StandardMesh to a map that has the Texture path to the original texture.
The texture path for this one is "Texture/mp44_r"

(In other words, I have to load a different StandardMesh in place of the StandardMesh with the animated texture path, kind of like loading new textures mapside.)

- The map's Stg-44 StandardMesh is in a folder named "StandardMesh" in my map's RFA.
- I included the Stg-44's original non-animated texture in the map's "Texture" folder.
- I tried to add "run StandardMesh" and even "run Objects/StandardMesh" in my map's init.con file, but nothing changed.

Re: Mapside StandardMesh for HandWeapon

Posted: Mon Jan 14, 2013 8:41 am
by Senshi
You usually don't have to "run" Standardmeshes. When you run an objects.con code that calls a geometry, it automatically looks for it in the standardmesh folder. As you obviously can't just replace the texture mapside in your example, you have to change the standardmesh, though. Or rather, you only have to change to the .rs file where the texture material mappings are stored. You did open that file with a text editor and made sure the texture paths in there are correct, right? If they are correct and your Objects/Geometries.con calls the right standardmesh, I do not see a reason why this shouldn't work. Handweapons .sm/.rs are in no way different to every other .sm/.rs .

Re: Mapside StandardMesh for HandWeapon

Posted: Tue Jan 15, 2013 2:25 am
by Swaffy
Yes, but it is for a HandWeapon so I didn't think it would work. And, well, what I tried didn't work. I'll keep messing around and update this if anything works.

Re: Mapside StandardMesh for HandWeapon

Posted: Tue Jan 15, 2013 3:01 pm
by Senshi
As said, in terms of geometries& textures there's no difference between handweapons and any other vehicle, so the procedure to change the texture path should be exactly the same (the .rs file).

If "nothing changed", for some reason the new geometry .sm/.rs is not being loaded. I'm pretty sure it's a typo or very tiny logic error somewhere that causes this. Check mapside that your weapon's object.con calls the right geometries. Check that your weapon's geometries.con calls the right .sm/.rs files. Check the .rs file that it has correct new the texture path in it. And obviously check that your init.con "run"s the weapon's Objects.con and Geometries.con.

That's all the necessary links and references I can see, at least.

Re: Mapside StandardMesh for HandWeapon

Posted: Tue Jan 15, 2013 7:47 pm
by Swaffy
This is what I tried:

bf1942/levels/A_Test_Map/init.con

Code: Select all

run Objects/Sg44/Sg44
bf1942/levels/A_Test_Map/Objects/Sg44/Sg44.con

Code: Select all

run Geometries
run Objects
bf1942/levels/A_Test_Map/Objects/Sg44/Geometries.con

Code: Select all

GeometryTemplate.create StandardMesh Sg44
GeometryTemplate.file SG44
GeometryTemplate.hasDynamicShadow 1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 3
GeometryTemplate.setLodDistance 2 10
GeometryTemplate.setLodDistance 3 20
GeometryTemplate.setLodDistance 4 30
GeometryTemplate.setLodDistance 5 100

GeometryTemplate.create StandardMesh Sg44Magasin
GeometryTemplate.file SG44_Mag_m1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 3
GeometryTemplate.setLodDistance 2 10
GeometryTemplate.setLodDistance 3 20
GeometryTemplate.setLodDistance 4 50
GeometryTemplate.setLodDistance 5 100
And the Objects.con file was the same thing from the base mod. The result was the same gun without any sound effects, but that's because I didn't load those. So...

I then tried it without the Objects.con file, but I got the same gun but with sound. I then checked the .rs file just to make sure the path was correct, and it was. Then...


I tried to rename the StandardMesh files in the map's RFA and in the Geometries.con file, and the mapside texture finally loaded!
The trick was to use a StandardMesh name that wasn't already taken by the SMs from the base mod.