Page 1 of 2

Altering the damage values of weapons (SP)

Posted: 18 Jan 2016, 19:50
by imrightyourleft
HI,

Could anyone help me with this?

How would I go about altering the amount of damage each weapon does in the game?

For example, say I want to make the bryar pistol more damaging or the bowcaster less damaging?

I've looked in weapon.dat but I can't seem to see anything to do with damage values.

I'd appreciate so much if someone could help me with this.

Thanks.

Re: Altering the damage values of weapons (SP)

Posted: 18 Jan 2016, 22:51
by Boothand
I think this is only changed through the source code, since my edits there didn't require any updating in weapons.dat.

We intend to put out some guides, links etc on how to get started with source modding and more, but in the meanwhile (unless you're familiar with compiling), the values can easily be edited by opening g_weapon.c in the source code and changing the defines in the top. Someone else would have to answer whether this changes the SP part as well, not just MP. Then it needs to be compiled through a .bat file.

I'll see if I can make some time for a little guide like this either on Tuesday or Thursday, perhaps.

Re: Altering the damage values of weapons (SP)

Posted: 18 Jan 2016, 23:01
by Tr!Force
the only way to modify damages is via code, in the source code for SP, file g_weapon.cpp u can found all the weapon damages (for the player and bots weapons), something like:

Code: Select all

// Bryar Pistol
//--------
#define BRYAR_PISTOL_VEL			1800
#define BRYAR_PISTOL_DAMAGE			14
#define BRYAR_CHARGE_UNIT			200.0f	// bryar charging gives us one more unit every 200ms--if you change this, you'll have to do the same in bg_pmove

// E11 Blaster
//---------
#define BLASTER_MAIN_SPREAD			0.5f
#define BLASTER_ALT_SPREAD			1.5f
#define BLASTER_NPC_SPREAD			0.5f
#define BLASTER_VELOCITY			2300
#define BLASTER_NPC_VEL_CUT			0.5f
#define BLASTER_NPC_HARD_VEL_CUT	0.7f
#define BLASTER_DAMAGE				20
#define	BLASTER_NPC_DAMAGE_EASY		6
#define	BLASTER_NPC_DAMAGE_NORMAL	12 // 14
#define	BLASTER_NPC_DAMAGE_HARD		16 // 18
etc...

and correction to @boothand, is g_weapon.CPP not .C hee, and there is no .bat files to generate "QVM's", because SP uses only jk2gamex86.dll and jk2mp.exe, so u need compile with visual studio only to generate them :D

an easy way to make it customizable is creating a cvar for it, like:

Code: Select all

#define BRYAR_PISTOL_DAMAGE			g_bryar_pistol_damage.integer //original value 14
so u can manage via the "g_bryar_pistol_damage" ingame

so, if u want edit them (or make it customizable) u need generate ur own files.

Re: Altering the damage values of weapons (SP)

Posted: 18 Jan 2016, 23:13
by Boothand
Ah, I guess I only have the multiplayer source. Will look into it!

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 08:43
by Boothand
[Topic moved to Modding discusson]

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 10:07
by ouned
If I remember correctly, there is a tutorial in the original jk2 source which explains exactly that.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 10:15
by Kazuka
ouned wrote:If I remember correctly, there is a tutorial in the original jk2 source which explains exactly that.
Yep, in this tutorial/example they changed the rocket velocity.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 10:32
by Boothand
Was that for singleplayer though? Can't seem to find this in my Tools folder, but I remember such a guide.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 10:38
by Kevin
Boothand wrote:Was that for singleplayer though? Can't seem to find this in my Tools folder, but I remember such a guide.
No, but the concept is the same :)

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 10:39
by Kazuka
The example I was talking about is located here:

code/MakeAMod_readme.txt.

This example was for the multiplayer part.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 14:57
by imrightyourleft
Thank you so much for the responses and discussions to this.

Your replies have fulfilled my worst fears though - editing the source code etc. which I'm not confident in doing. Indeed I would greatly appreciate if boothand or anyone could compile me a short step by step guide on how to do this - just for single player though.

Thanks again.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 15:55
by imrightyourleft
Okay so I've got the JK2 source code, and I've found the g_weapon.cpp file.

If I change the damage values of the weapons to my liking, my question is how do I then implement those changes in to the SP game? In which folder of the GameData itself do I save the source code alterations for my changes to take effect?

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 16:03
by Tr!Force
imrightyourleft wrote:Okay so I've got the JK2 source code, and I've found the g_weapon.cpp file.

If I change the damage values of the weapons to my liking, my question is how do I then implement those changes in to the SP game? In which folder of the GameData itself do I save the source code alterations for my changes to take effect?
i recommend u to use OpenJK for jk2 SP, i will try, if works, i will make a tutorial for u :P

i DONT recomend u to use original JK2 SP source, because u will get lot of problems to compile the final files, ive tried yet, and the only way for me was running a windowsXP machine with visual c++6 (really old). u need to understand (in basic words) the whole jk2 SP source is like the jk2sp.exe unpacked, u need "compile" to get the jk2sp.exe modified and ready to test.

openJK one's already have a lot of improvements specially in jk2 sp code.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 16:05
by ouned
openJK one's already have a lot of improvements specially in jk2 sp code.
+ bugs which make the game crash in some places.

I'd rather fix the compiler problems... shouldn't be too hard

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 18:25
by imrightyourleft
^^ This.

I've already tried, unsuccesfully, to run JK2 SP using OpenJK and it seemed buggy and unstable.

Until an official final version of OpenJK is released for SP JO, is there another way around this?

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 18:36
by Boothand
I've started cleaning up the SP code so it can be compiled on VS 2015: https://github.com/Boothand/jedioutcast ... f60d2cd1db

The errors that remain (at least until it compiles further) are a bit out of my league apparently. Now it's you guys' turn (looking at all the coders of jk2.info) :D

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 18:44
by Daggolin
I've played around with the OpenJK version of SP for jk2 in April 2013 and I didn't run into too many issues I think. I think the best approach would be to fix remaining issues in the OpenJK version for JK2SP (assuming there aren't too many). That way one wouldn't end up with too many codebases and JK2SP would benefit from the OpenJK fixes and changes.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 18:54
by Boothand
Though that requires people to get JKA just to play JK2, right? Been a while since I tried the OpenJK approach.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:16
by Daggolin
No. The OpenJK single player binaries (compiled in jk2-mode) are simply put into your jk2 game data and you play with your normal jk2 assets (at least the last time I checked). ;)

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:18
by imrightyourleft
I desperately need to learn how to code just for JK2 lol but it seems impossibly daunting for a beginner.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:40
by Tr!Force
imrightyourleft wrote:^^ This.
I've already tried, unsuccesfully, to run JK2 SP using OpenJK and it seemed buggy and unstable.
Until an official final version of OpenJK is released for SP JO, is there another way around this?
there is no current builds executables for JK2 SP, if u got one from the openJK builds, these are for JKA only. for jk2 u need generate it manually
Daggolin wrote:No. The OpenJK single player binaries (compiled in jk2-mode) are simply put into your jk2 game data and you play with your normal jk2 assets (at least the last time I checked). ;)
thats right, i compiled and tested, no JKA requiried,
imrightyourleft wrote:I desperately need to learn how to code just for JK2 lol but it seems impossibly daunting for a beginner.
im making an small tutorial for JK2 SP (OpenJK Version), i will post here this night! dont worry :lol:

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:44
by Boothand
Well, then :D Some good experience either way, hacking and slashing at that code.

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:45
by imrightyourleft
Tr!Force wrote:im making an small tutorial for JK2 SP (OpenJK Version), i will post here this night! dont worry :lol:
Fabulous! That's very helpful of you, thanks :)

However, I honestly am not sure how to manually make a jk2sp executable file... :?

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:47
by Boothand
It's all about opening a solution file in a program and hitting the 'Compile' button, then receiving builds in a folder that can replace your JK2sp.exe (and dll's and other files) :D

Re: Altering the damage values of weapons (SP)

Posted: 19 Jan 2016, 19:51
by imrightyourleft
Boothand wrote:It's all about opening a solution file in a program and hitting the 'Compile' button, then receiving builds in a folder that can replace your JK2sp.exe (and dll's and other files) :D
Ah I see, that makes sense now you put it that way... So basically it's going in to the jk2sp.exe, altering whatever you want to alter, applying it and then making a new jk2sp.exe with the new values applied... right, I get it now. Well, I get the basic concept, that is - but not how to actually do it, just yet :lol: