home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


How to add new weapons?

by vinny on 04/29/2017 08:26, 4 messages, last message: 10/08/2021 22:48, 4191 views, last view: 04/19/2024 18:21

Hello! I'm having a lot of fun with this project and i've decided to create new weapons for it. I'm an artist so i don't have a lot of knowledge about modding the source. I have a few questions and i would love to get more info on them. Thanks in advance!

* In order to add a new weapon, i just have to change the fpsgame/game.h file and add a new line on the guninfo struct?

* What is the coordinate system that Sauerbraten uses? Also, what's the scale so i can adjust my models in Blender?

* What is the preferred method of exporting from Blender to Sauerbraten? MD5? IQM?

* I've started by replacing the hudgun/rifle model with my own, but i can't get it to show. Maybe i'm using the wrong scale or something? Is there a way to debug this? How do i know if the hudgun model was loaded correctly?

* How can i remove the default arms?

* How can i add a magazine reload system to the weapons?

   Board Index   

#1: ..

by suicizer03 on 05/01/2017 09:43

Hey Vinny,
There once was a tutorial of how tot add weapons to Sauerbraten. However, it's probably obsolete....
If you really want to add another weapon, I would recommend to get into coding (C++) and learn Cube Engine 2.

If you just want to see your weapon working, I would recommend to replace one of the original weapons.
It doesn't really matter which extension is used, altough some may act different or need a different approach (as in commands or features). The names of necessary files is critical.

There's a prefabrication-file of all settings (and explanation) for models in the next link.
http://quadropolis.us/node/3091

reply to this message

#2: ..

by suicizer03 on 05/02/2017 12:14

When exporting ftom Blender, it depends pretty much what file you want to export to.
When not using any bones, .md3 is often easier then .iqm, md5 or .smd (the less features, the less chance to mess up), although some may disagree.

One important thing when exporting from Blender (or even model) that the version should be compatibel with exporter.

A link about .iqm export;
http://sauerbraten.org/iqm/

A link about .md5 export;
https://www.katsbits.com/smforum/index.php?topic=178.0

A link about .md3 export;
http://openarena.wikia.com/wiki/Making_a_player_model
https://forums.duke4.net/topic/5358-blender-27-md3-export-script/

reply to this message

#3: Re: Adding weapons

by exist on 05/03/2017 14:57, refers to #2

To add a new weapon:

1: Search the project tree for "GUN_PISTOL". Add your weapon to the enum list in fpsgame/game.h before GUN_PISTOL. Update game.h, ai.*, weapon.cpp.

2. Add new player animation for your weapon. Search ANIM_. (game.h and I think cube.h?).

3. Search for an ammo type such as "bullets" and update your entities list and fpsgame struct methods appropriately. Add your new entity to the END of the entity enum list (alternatively add after "grenades" and shift the indexes).

4. If your weapon is a projectile weapon, you'll need to update server.cpp to add another serverside projectile type. Search server.cpp for "rockets" or "grenades".

5. You'll need to update the playersmodels' 3rd person animation to display something for your weapon. Edit their anim files.

Hope this could help a bit :) It's been a while since I worked on Sauer but maybe it will be useful.

reply to this message

#4: Re: Adding weapons

by exist on 05/08/2017 17:28, refers to #3

To add a magazine reload system, the code is simple, there's many ways to go about it, but easiest is to add an int variable "lastreloadms" or something as a field to fpsent, create a reload function/COMMAND in weapon.cpp that simply sets that to "lastmillis", set some #define or const "reloadtime" and modify game::shoot() to disallow firing when lastmillis-lastreloadms<reloadtime. As for managing how the ammo is used internally and displayed to the HUD, I'll leave this up to you. There's many ways this can be done and it's all preference.
Have fun!

reply to this message

   Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53698833 visitors requested 71466310 pages
page created in 0.015 seconds using 10 queries
hosted by Boost Digital