FOnline Development > 3D Development

Problems porting weapons to FOnline

<< < (3/4) > >>

E3245:
How does ATTRIBUTE_Handle_Weapon_22Autoloader work? I've seen that in the _animations.fos script. I tried to add ATTRIBUTE_Handle_Weapon_M16 then add case PID_M16A1 ;handle = ATTRIBUTE_Handle_Weapon_M16 in the client_main.fos, but nothing happens.

Just so I'm clear, I am going to try to add this the old way instead of the other way.

Luther Blissett:
I've never really messed with that stuff myself, sorry. Looks like you're trying two things, which are :
1) General modding to add a new item
2) Linking a 3D model to an item

I pretty much know nothing about the first, but one of the 2238 devs or any other general modder must know this. I've only got a vague idea about the 2nd bit too. I guess you can either wait, or try various things yourself.

I'd look at the following files :
server\scripts\_itempid.fos < I missed mentioning this before, so perhaps this is a key file to change?
server\data\ItemNames.lst
server\scripts\_client_main.fos
server\proto\items\weapon.fopro
server\text\engl\foobj.msg
server\scripts\_animation.fos
server\scripts\pids_groups.fos < not sure about this, but it does include "PID_10MM_PISTOL" in it, so perhaps should include equivalent for what you're adding?

A lot of the threads which explained this stuff were on the old fonline.ru, and seem now to be lost. I did copy and paste this bit which may be necessary (though it might only apply to changing the character registration screen) :


--- Quote ---Some changes in the .fos need to update the fosb and fosp files
- Run client
- Press Enter
- Restart client
- Registration (This called "update client scripts")
This is necessary for changes to client registration. It makes new .fosb .fosp
--- End quote ---

If you do find the answer yourself, make sure to report how to do so here. It will save a lot of trouble in future.

E3245:
Finally, I've got the weapons working and linked, which means Karpov's weapons will work once they get implemented, but only through the _VBHuman.fo3d, because the _FOHuman.fo3d file doesn't load in FOnline.

Anyways, here are the steps to add a new weapon and then link the 3d model into the latest update, Revision 404:[/size]
1. Make a weapon model in you favorite 3d modeling program (i.e 3dsmax, Maya, Fragmotion, Blender, etc.) and export it to the .x file. Name your weapon: WP_Weaponname.x (Replace Weaponname with the name you choose). The textures don't really need to be name ITEM_Texturename, because the engine loads them anyways, so there is no point. Probably the same case with the WP_Weaponname.x file.
Following this tutorial will help: http://fodev.net/forum/index.php/topic,26833.0.html

2. Put the textures in /.../Client/data/textures and the .x file in /.../Client/data/art/critters/

3. Open Notepad or a text editor and save the file as WP_Weaponname.fo3d in the same directory with the model (i.e /.../Client/data/art/critters/) as Like this: WP_WeaponName.fo3d

4. Now for the text part.
The first line should be:

--- Code: ---Model WP_Weaponname.x
--- End code ---
If your weapon has multiple textures, you'll need to write this: Root

--- Code: ---Subset 1 Texture 0 Texture1.tga
Subset 2 Texture 0 Texture2.tga
--- End code ---
Subset = the material that the weapon is assigned in the 3d modeling program.
I'm not sure what this line means but the other WP_x.fo3d files has this loaded, so I added it in anyways:

--- Code: ---Include _VBWeapon.fo3d name WP_WeaponName
--- End code ---
So, it should look like this:

--- Code: ---Model WP_Weaponname.x
Subset 1 Texture 0 Texture1.tga
Subset 2 Texture 0 Texture2.tga
Include _VBWeapon.fo3d name WP_WeaponName

--- End code ---
5. Open the _VBHuman.fo3d and go down to Layer 1 or # Right Handle. Go to the end of the Layer 1 and add this:

--- Code: ---Value 57 Attach WP_Weaponname.fo3d Link R_Handle_1 RotX x  RotY y RotZ z MoveX xx Move yy MoveZ zz Scale s
--- End code ---

Replace the symbols x,y,z,xx,yy,zz,s with the desired numbers. You may need to tinker a bit before it will look right.

6. Now we added the weapon thru the _VBHuman.fo3d, we need to actually add the weapon so the FOnline Server will add the weapon. Open the file ItemNames.lst in Server/data/ folder and go down to the last line, which should be 872. Write 873 PID_WEAPONNAME on the next line. (873 is the ProtoID that will be referenced, PID_WEAPONNAME being the weapon. It is case sensitive so be sure to copy the PID name.)

7. You will need to use Object Editor in the Tools folder to understand what each parameters does in the .fopro file later in the tutorial. Open Object Editor and go to File>Load List, and go to Server/proto/item/weapon.fopro. Then choose a weapon (I chose Assault Rifle) and go to Object>Clone Selected Object (CTRL+SHIFT+C), and type in the right PID, in this case 872. Rename the weapon and description and change the parameters in the Main and Ext Info. Once you are done, then File>Save List and overwrite weapon.fopro.

8. We are not done yet. Go to Server/Scripts and open _itempid.fos. Go find the weapons section and add this line anywhere:

--- Code: ---#define PID_WEAPONNAME ( 872 )
--- End code ---

9. Open Client_main and go down until you see this line

--- Code: ---if( pid == 0 || ( pid >= 1000 && pid <= 1100 ) )
        return 0;
--- End code ---
Insert this line:

--- Code: ---case PID_WEAPONNAME:
        handle = 57;
        break;
--- End code ---
This could also work, I haven't test this yet:

--- Code: ---case 872: handle = 57; break;
--- End code ---

10. Test and Enjoy! Post any errors that you encounter below.

The _VBHuman.fo3d loads but not the _FOHuman.fo3d. I think it is defined what loads somewhere in the server/scripts folder.

Also, can someone tell me how to add muzzle effects to these weapons?

Luther Blissett:
Nicely done!

E3245:
New problem, How do I change animations to weapons. I noticed that the Rocket Launcher is two handed but there is no .fo3d or script that tells how the weapon's animation is handled.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version