Jump to content

M4A1 Carbine


Brettzies
 Share

Recommended Posts

So, I'm attempting to convert my Swat4 M4A1(minus the flashlight) into Graw. See the pre-modding thread if you like: M4A1 pre-modding

This first step was to duplicate one of the weapons structures but rename all of the files so they point to a new weapon. I chose the SCAR-L since it is the most similar in ballistics I assume. Bascially I added a weapon called M4A1 Carbine, by modding the inventory.xml and a bunch of other xmls to point at dirs and files called bp_m4v2 instead of scar_light. All textures, u files, objects, etc have been duplicated, edited and renamed accordingly. That all works fine. Essentailly now there are two SCAR-Ls, only one is called M4A1 Carbine in the weapons loadout section. You can pick all of the attachments or assign it to the other soldiers. First step complete.

The next step is to start changing the .diesel files with the correct models. However, this is where things get confusing. I've exported the model to the proper dir and named it correctly with the 3ds material named correctly as well. However, when I pick the weapon in the loadout screen, the game just crashes to the desktop.

Debugging this is like shooting in the dark. It could be a variety of reasons of course and I have my guesses. But, I'll post my questions and answers here so if anyone has any insight that would help feel free to offer it up.

For this particular problem, it could be with the 3d file, though, I had no problems with Swat, so I would guess it's more with the xmls or names. I think it either needs the other lods, b and c. Or, it needs the proper "dummies" for the attachment points. Unfortunately, I don't know what those names are, so it's all just guessing from here. Based on the unit file, I think this has something to do with it:

<var name="object_ejector" value="shell"/> <!-- name of the ejector object -->

<var name="object_muzzle" value="fire"/> <!-- name of the ejector object -->

<var name="object_clip_align" value="mag_align"/> <!-- name of the ejector object -->

<var name="unit_clip" value="bp_m4v2_mag$name_ext"/> <!-- name of the casing unit -->

<var name="body_drop" value="main_body"/> <!-- name of the body to activate when dropping the gun -->

or maybe this:

<var name="top_mount" value=""/>

<!--<var name="top_mod" value="scar_ironsight"/>-->

<var name="top_mod" value="aimpoint"/>

<var name="front_mod" value=""/>

<var name="bottom_mod" value=""/>

<var name="grenade_mod" value=""/>

I can start adding dummies for all of these and probably will to test, but at this point, I have no idead what is making the game crash upon selecting the M4A1.

Edited by Brettzies
Link to comment
Share on other sites

  • Replies 75
  • Created
  • Last Reply

Top Posters In This Topic

Tried some various things. Here's what happens when I try to equip the weapon in the weapon loadout phase, game crashes:

data\lib\units\types\weapons\bulletweapon.dsf(-1): cant find member: world_pos in type <void>

SCRIPT STACK

data\lib\units\types\weapons\bulletweapon.dsf(0)

data\lib\units\extensions\inventory.dsf(0)

data\lib\units\extensions\inventory.dsf(0)

data\lib\units\extensions\hudinventory.dsf(0)

data\lib\units\extensions\hudinventory.dsf(0)

Link to comment
Share on other sites

Tried some various things. Here's what happens when I try to equip the weapon in the weapon loadout phase, game crashes:

data\lib\units\types\weapons\bulletweapon.dsf(-1): cant find member: world_pos in type <void>

SCRIPT STACK

data\lib\units\types\weapons\bulletweapon.dsf(0)

data\lib\units\extensions\inventory.dsf(0)

data\lib\units\extensions\inventory.dsf(0)

data\lib\units\extensions\hudinventory.dsf(0)

data\lib\units\extensions\hudinventory.dsf(0)

Either you need the "dummies" or are you specifying like a new round? I've had the same issues, but then again it could be a "dummy" issue, i.e. the mounting point...

Another thing you might want to hit is the (don't know if you actually did) the Strings/inventory.xml file. That for some reason may be causing the crash, but again a small chance..

Edited by EricJ
Link to comment
Share on other sites

Either you need the "dummies" or are you specifying like a new round? I've had the same issues, but then again it could be a "dummy" issue, i.e. the mounting point...

Another thing you might want to hit is the (don't know if you actually did) the Strings/inventory.xml file. That for some reason may be causing the crash, but again a small chance..

I think the inventory script is good as well as the mod_data.xml. I'm not actually changing any values except for the "mod_id". Everything worked great when I was just using the scar-L and addons with renamed and edited xmls. However, looking at the mod_data.xml has given me an idea. The mod_slot usually just says, top, bottom, front, etc. yet the unti file has refrences to names like top_mod, bottom_mod, front_mod, grenade_mod. Which is what I named all of my nulls/dummies. Maybe they should just be top, front, and bottom. I also added nulls like unit_clip_align, but perhaps it should be mag_align:

<var name="object_clip_align" value="mag_align"/> <!-- name of the ejector object -->

I have a feeling it crashes because it doesn't know where to put the attachements, and even the ironsight and magazine are treated like attachments.

Link to comment
Share on other sites

Either you need the "dummies" or are you specifying like a new round? I've had the same issues, but then again it could be a "dummy" issue, i.e. the mounting point...

Another thing you might want to hit is the (don't know if you actually did) the Strings/inventory.xml file. That for some reason may be causing the crash, but again a small chance..

I think the inventory script is good as well as the mod_data.xml. I'm not actually changing any values except for the "mod_id". Everything worked great when I was just using the scar-L and addons with renamed and edited xmls. However, looking at the mod_data.xml has given me an idea. The mod_slot usually just says, top, bottom, front, etc. yet the unti file has refrences to names like top_mod, bottom_mod, front_mod, grenade_mod. Which is what I named all of my nulls/dummies. Maybe they should just be top, front, and bottom. I also added nulls like unit_clip_align, but perhaps it should be mag_align:

<var name="object_clip_align" value="mag_align"/> <!-- name of the ejector object -->

I have a feeling it crashes because it doesn't know where to put the attachements, and even the ironsight and magazine are treated like attachments.

Yes the magazine is, if you check the bundle reader... which is in Objects/Weapons/weaponname/weapon_mag.diesel. I'm not sure if that's what it means but could be the mag you just dropped.. or inserted then dropped. If that made any sense..

Link to comment
Share on other sites

I took a look at the scarl.diesel file in a hex editor. Found some interesting text in it and wrote down what I thought might refer to something:

align (obviously the rootpoint)

body01 (maybe collision box?)

fire

left_hand_grip

left_hand_mag

shell

grip_align

scope_align

clip_ejection

grenade_launcher_align

mag_align

silencer_align

center

I tried renaming my nulls/dummies to these. Didn't use body01, have no idea what that is. I got a little further. This time upon equipping the weapon in the loadout screen, it brought a few things up, and left a few things maybe from the last weapon onscreen. I could see the iron sights out of position and rotated 180 degrees. Also the shell or bullet. I think the mag and scope were left over. However, didn't see my weapon at all, and it still....crashed.

Edited by Brettzies
Link to comment
Share on other sites

There's a line in the weapon_data.xml that specifies what's the "defaul" mod, i.e. ironsights, etc:

<mod mod_id="12" default="1"/>

<mod mod_id="11"/>

<mod mod_id="18"/>

<mod mod_id="19"/>

<mod mod_id="8"/>

<mod mod_id="16"/>

<mod mod_id="17"/>

id="12" is the Aimpoint that shows up when you first load up (this is from Mig1's mod BTW) and specifies that. Maybe you need to look in the mod_data.xml file and figure out what individual id is though? Maybe that's why it's crashing, it's saying "put this here" but there's nowhere to put it. Did you put "body01" somewhere though?

Then again, it's a shame GRIN is being mum on the issue, maybe becaue of Ubisoft, but that's my speculation. I can only think you should rotate the points... but then again if you can't see it...

Edited by EricJ
Link to comment
Share on other sites

I'm sure it is all related. However, I did create duplicate entries for the "mods" and assigned them new id #s in the mod_data.xml. Then I created a new entry in the weapon_data.xml and used the new mod # id's for the section you are pointing out. This all works fine for adding a new weapon with new addons but using the existing diesel files with new names. ie, the scar_light.diesel is renamed to bp_m4v2.diesel, etc.

I'm pretty sure the problem lies with the object not having the correct nulls/dummies so that the program knows where to put things. On the other hand, I could edit the xmls to not include the mods/attachments for now. That can be prone to error as well, could be crashing for all new reasons. Guess I'll try it out.

Thanks for the suggestions.

Link to comment
Share on other sites

Well I guess it's somehow related to "helperpoints" that define where the attachment points go. So I would guess that the null/dummy points need to be named accordingly by those things. What little modding I did for [GR] is saying to try that out. More than likely, it all refers to what Piggyson (modeller for [GR]) defines. My guess is to just do it one step at a time. The "grip_align" probably refers to where the left hand goes when gripping the weapon.

http://www.piggyson.com

I highly doubt that he did the modelling work for GRAW, but maybe he can offer pointers to get you what you need.

Oh well, guess I stuck my foot in my mouth for that one:

http://www.piggyson.com/resume.html

He may really help :thumbsup:

Edited by EricJ
Link to comment
Share on other sites

I added body01 as a null. Got this error on crashing:

Mass properties not valid to create rigid body

Maybe it needs to be a bounding box or something.

Tried adding a box and naming it body01. It still crashed but didn't return that error this time.

Edited by Brettzies
Link to comment
Share on other sites

I hope you guys get the kinks out. Better still, I hope Grin releases tools just for this sort of thing.

I'm not sure there's really any tools needed other then the diesel exporter. However, right now it's like shooting in the dark. Too much guess work involved, too many xmls pointing to the same thing or defining parts of the same thing. It's organized, but very easy to get lost.

Right now I'd be happy with some refrence files for the Scar and the mag. Then we could see how many nulls are attached to it and what their names are. Is the mag a seperate file in the right location or is it moved to the origin? Is the align null at the origin? Are "addons/mods" at the origin and parented to align nulls? Just being able to look at the 3d files for a few things could answer a lot of questions.

Writing a tutorial for this would be very time consuming, so I can understand why they haven't done it. There are so many xmls, lines of code, and files to worry about, it would be no easy undertaking just writing it all down. The scarL and addons with texture files, etc, comprise 64 files in 42 folders alone.

I'm kind of running out of guesses and have made zero progress bringing any actual geometry into the game.

Link to comment
Share on other sites

I think it is some kind of alignment points, as JasonFMX if I remember correctly had some issues with alignment of magazines and such. Perhaps you may glean something from his mod in the General Mod Topics?

Link to comment
Share on other sites

Small Victory : ) Obviously lots of things wrong, but I decided to work from the little things first and see if I could get something...anything into the game. Not much to look at, but it's the 3rd person M4 mag. Orientation, scale, and wrong texture, but "finally," something to build off of. Also switched out the "attachments" with boxes. They are much simpler then the actual weapon itself. Well, maybe not the grenade launcher.

m4_graw_01_mag.jpg

3rdPerson Weapon: will probably take the flashlight off or make it an attachment

m4_swat_23_alt.v2_wire.jpg

Question for GRIN people. What is the bullet for? Does it just show up in a discarded half empty mag or does it do somethingelse? Why are there two bodies in the diesel file? body01 and body02, one for the bullet and one for the mag? Are they collision bounding boxes? Do they need a surface?

Link to comment
Share on other sites

Small Victory : ) Obviously lots of things wrong, but I decided to work from the little things first and see if I could get something...anything into the game. Not much to look at, but it's the 3rd person M4 mag. Orientation, scale, and wrong texture, but "finally," something to build off of. Also switched out the "attachments" with boxes. They are much simpler then the actual weapon itself. Well, maybe not the grenade launcher.

m4_graw_01_mag.jpg

3rdPerson Weapon: will probably take the flashlight off or make it an attachment

m4_swat_23_alt.v2_wire.jpg

Question for GRIN people. What is the bullet for? Does it just show up in a discarded half empty mag or does it do somethingelse? Why are there two bodies in the diesel file? body01 and body02, one for the bullet and one for the mag? Are they collision bounding boxes? Do they need a surface?

eh? why not just use the SCAR-L magazine model? Waste the time getting the actual weapon in game as you got the magazine definition already (SCAR-L) and go from there. You can specifiy in the XMLs the magazine it can use, to an extent. No sense in reinventing the mag bro..

Besides now that I got a side pic, the front sight assembly is scaled wrong, the Aimpoint needs work. Use what's availabe than trying to redo it. If you look at the credits, they talked with an Aimpoint AB rep for the Aimpoint. Other than markings, it's pretty spot on.

Edited by EricJ
Link to comment
Share on other sites

eh? why not just use the SCAR-L magazine model? Waste the time getting the actual weapon in game as you got the magazine definition already (SCAR-L) and go from there. You can specifiy in the XMLs the magazine it can use, to an extent. No sense in reinventing the mag bro..

Besides now that I got a side pic, the front sight assembly is scaled wrong, the Aimpoint needs work. Use what's availabe than trying to redo it. If you look at the credits, they talked with an Aimpoint AB rep for the Aimpoint. Other than markings, it's pretty spot on.

Well, mainly it's called learning how and why things work. Why they are lined up a certain way, how they connect to the weapon, etc. It's all very easy to say it works or can be done or even look at xml text pointing here and there, but quite a different situation trying to actually get it to work. Sometime it's easier to take small steps with something simple like a box or in this case a mag, which is almost a box. All you need is a little piece to unlock a bigger puzzle. You see it as a "waste of time," I see it as making progress in figuring out how to get the whole thing in. Which I have tried several times with all kinds of nulls/dummies, parenting schemes, only to have the game crash time after time. So, now it's time for a different approach.

It also forces you to use their texture and UV placement, at least for the mag if I use theirs, which could be a major pain to replicate with a custom weapon. That alone is enough reason, but I want the mag to fit correctly, so, it's easier to use the one I already built. It gives a point of refrence for the whole weapon's scale, orientation, etc. Now I can see which axis they are pointing down. Not only that, but it's fun to make the whole thing yourself. What would be the point of doing it otherwise for me? I don't really get much out of interchanging prebuilt objects and typing in xmls. However, I wasn't planning on redoing the game's aimpoint unless it just doesn't fit right.

Edited by Brettzies
Link to comment
Share on other sites

to make a custom mag is the correct procedure both for alignement and uv reasons, so good job with your progresses (I know how you feel when you finally see your meshes into the inventory :thumbsup: )

I know that feeling :) Good job :)

The bullet is for mags that have bullets left. If you look at empty mags the bullet is gone, on halfempty and full mags you see the next bullet. It's seen in mags on hte ground and when reloading.

As there are max objects named body01 and body02 its a bit confusing. The tag makes bodies, the names of the objects is not important - to clarify:

The body01 and body02 are just objects names in max called body01 and body02 that form the mags collision. Since they are both specified whithin the main_body tag they act as only one body.

Link to comment
Share on other sites

I agree with Brettzies, it's best to do it all yourself for right now; not only do you then get to figure out exactly how everything works but you know it will work with your gun in terms of placement and alignment. Not all the alignment helper points are the same on the default weapons so you never know what might happen. I found that out when I tried to stick a SCAR-L mag onto the M-8 model for a mod only to find that the Mag was aligned backwards to the gun model.

To point out a few more things on the model: it looks like the flash hider looks huge - or it may just be that you don't have the attachment rings modeled, and also the barrel step cut and buttstock tube are much to skinny. The step-cut in the barrel actually slopes to the rear of the weapon and is only a flat step on the muzzle-end of the barrel. :thumbsup:

The Aimpoit does not look that off to me ... although the front half seems to have some odd proportions, but who knows I only own one ... and I suppose I don't look at the outside much :P

Clark

Link to comment
Share on other sites

To point out a few more things on the model: it looks like the flash hider looks huge - or it may just be that you don't have the attachment rings modeled, and also the barrel step cut and buttstock tube are much to skinny. The step-cut in the barrel actually slopes to the rear of the weapon and is only a flat step on the muzzle-end of the barrel. :thumbsup:

The Aimpoit does not look that off to me ... although the front half seems to have some odd proportions, but who knows I only own one ... and I suppose I don't look at the outside much

Any model discprencies you guys point out are probably accurate observations. I based the original off of refrence pictures I found. Some have different barrels or sights and what not. I really don't have anything to go off but still photo refrence. So, I did the best I could and took which pieces I thought looked cool from different M4 photos.

Besides now that I got a side pic, the front sight assembly is scaled wrong

I actually did scale this down for SWAT4. I didn't like the aimpoint riding high for that game. The front sight was originally more like the wireframe in the pic below. And yes, I know the aimpoint doesn't line up with the sight, that's why I scaled the front sight before based on your's or someone's comment from the other thread. I'm going to put it back to the proper proportion for this game, and it will have the carrying handle sight as default.(those do line up. I'm modeled them that way). Some model problems are easy to fix, others may be a pain and maybe not even worth it.

m4_render_11.jpg

Thanks for the suggestions and Grin comments too. One last question about Body0x objects. Are they actually 3ds meshes or boxes or just dummies? Does their pivot point matter? Should it be in the same place as the align dummy?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...