Adding a new weapon

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

Adding a new weapon

Post by Retributer »

Hey everyone !
I've recently learned how to modify existing weapons using the weapons.txt file, but I thought it would be better to add new weapons instead of just changing the existing ones. I tried editing a few files like research.txt, weapons.txt or names.txt by simply copying the machinegun and giving it another name, this way I would have two weapons that would do exactly the same thing but with different names, just to see if it would work. Unfortunatly, it doesn't, the game just crashed when I started a skirmish game.
So I need your help, what files do I need to edit to create a weapon, and what do I need to change ?
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Adding a new weapon

Post by NoQ »

Show us what you did and/or read how exactly it crashed.
Most likely forgot to add the name into names.txt.
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

Re: Adding a new weapon

Post by Retributer »

Ok, first off, here are the two errors it returns when I start a skirmish game :

http://imageshack.us/f/203/errorhf.png/

Then the four files I edited :

/stats/weapons.txt :
http://imageshack.us/f/12/weaponsi.png/
there are a few values missing on the right, but they're all the same as MG1Mk1.

/stats/weaponsounds.txt :
http://imageshack.us/photo/my-images/40/soundsf.png/

/stats/research/multiplayer/research.txt :
http://imageshack.us/photo/my-images/16/researchz.png/

and finally /messages/strings/names.txt :
http://imageshack.us/photo/my-images/837/names.png/

As you can see I named my weapon W_Test and gave it "custom" as it's internal name. I don't think I inverted the internal name and in-game name in any file, but that's not impossible. Basically all I did for every edited file was to copy the value of MG1Mk1 and past it at the end of the file.
So either there are more files to edit, or I just got it completely wrong. I'm not sure creating a weapon just takes some text editing.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Adding a new weapon

Post by NoQ »

Spoiler:
Since you're not seeing correct end-of-lines in Notepad, i have no reason to believe it writes correct end-of-lines. Try using a more sensible text editor.

Also, i don't think you can use the same internal name for both weapon and technology.
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: Adding a new weapon

Post by Reg312 »

i would suggest to use my "stat editor" viewtopic.php?f=5&t=8726
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

Re: Adding a new weapon

Post by Retributer »

Mmh, I thought about just posting some text, but I wanted to keep the layout as it was. As for using something else than notepad, dunno why I didn't use notepad++. Or Excell.
I'll try Reg's stat editor.

For the weapon technology's name, I thought it used the same than the weapon itself. I'll try with something different. Thanks for the help.
User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: Adding a new weapon

Post by milo christiansen »

To be exact this is cause by notepad clobbering line endings.
The files use \n to mark a new line and notepad uses \r\n. Since \n is "non-printing", and notepad does not recognize it as valid, notepad strips it when you save, hence you get a file that is just one big run-on line that is unreadable to the game.

Use wordpad, or better yet google notepad++.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Adding a new weapon

Post by aubergine »

@Retributer - you can use the code tags to keep text formatting the same in the forums. For more info on the tags you can use in forums, see this list of examples.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

Re: Adding a new weapon

Post by Retributer »

Ok, I changed the research name and internal name, now the game doesn't crash anymore, but my research doesn't appear. There must be another file to edit, but I don't know which one.
I tried Reg's stat editor, it's well done, but when I try to compile my work, it tells me there's an error with template.txt :
Error (linked table invalid right key): file=assignweapons.txt, KeyValue=ViperLtMGWheels, Row=ViperLtMGWheels,MG1Mk1,NULL,NULL,0,MG1Mk1,60
And I don't understand what I do with the file I get after this. Where do I put it ? Do I replace mp.wz with it ?
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Adding a new weapon

Post by Iluvalar »

no, keep mp.wz intact or else you wont be able to play a multiplayer game again. Instead load it as a mod in /mods/autoload/myMod/stats/...

you seem to forgot prresearch.txt where you must link your new research to something else already existent. OR rules.js to add the new research at start up
Heretic 2.3 improver and proud of it.
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

Re: Adding a new weapon

Post by Retributer »

I've edited prresearch, now I'm supposed to unlock my research by researching the machinegun. The game still doesn't crash, which is good, but my research still isn't here.
As for rules.js, I've added "enableresearch("Rcustom", playnum);" with the three other researches, but the game acted strangely, I started with a base even though I set the game in no base mode, and I started with 0 power instead of 2500 (if I read the rules.js right). Also I didn't have any model, and many researches were missing, and if I tried to create a template, it only displayed a black zone. Is there something else to change in this rules.js ?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Adding a new weapon

Post by aubergine »

Maybe you could upload the .txt files you altered (as attachments ...in text format!!) so people can take a look at them?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Retributer
Greenhorn
Posts: 14
Joined: 15 Jan 2013, 12:15

huehue

Post by Retributer »

Mh. I guess that's a good idea. But I can only attach 3 files, I'll have to merge some of them (I have 5 files in total).


Here. This should do it. I think.
Attachments
weapons+sounds.txt
(37.6 KiB) Downloaded 360 times
research+prresearch.txt
(74.03 KiB) Downloaded 364 times
names.txt
(74.8 KiB) Downloaded 363 times
REZ
Trained
Trained
Posts: 93
Joined: 16 Dec 2009, 11:49
Location: Pattensen, Germany

Re: Adding a new weapon

Post by REZ »

Hello,

did anyone post a solution for this example?
I do look for the same thing.

C.U. R.E.Z.
Perseus
Trained
Trained
Posts: 56
Joined: 09 Oct 2010, 22:25

Re: Adding a new weapon

Post by Perseus »

I guess not. :|
you can use the code tags to keep text formatting the same in the forums
@Retributer: You should have pasted the code into the forum edit window, then used '[/b]' (minus the quotes) around that code, that is what aubergine meant. :)
Post Reply