Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Sword Reload Fix, Multimonitor bug fix, Basic and crappy static spread code

Newbie Spellweaver
Joined
Jun 7, 2023
Messages
23
Reaction score
10
Hey guys,

I thought I should share these fixes with you guys as these bugfixes are ones that I personally think are essential to having a good playing experience, as these bugs are really annoying to most people and are pretty common in servers. Also I wanted to contribute some code to this forum, so you guys can have this crappy but simple static spread system. Keep in mind, I know that there are better ways to implement these, but my experience is pretty low as im pretty new to this community and I've basically learned C++ by messing around with the gunz source so don't expect anything from me.

Anyways, here is the code:

Sword Reload Fix:
Inside of the "Animation_Reload" Function, replace the line "SetAnimationUpper(ZC_STATE_UPPER_RELOAD);" to
if (GetItems()->GetSelectedWeapon()->isReloadable())
SetAnimationUpper(ZC_STATE_UPPER_RELOAD);



Multimonitor Bug Fix (When flicking your mouse, cursor can appear and go to your second monitor and tab you out) :

Find "SetCursorPos(pt.x, pt.y);" in ZGameInput::Update
Put under the line
RECT rc;
GetClientRect(g_hWnd, &rc);

POINT pt = { rc.left, rc.top };
POINT pt2 = { rc.right, rc.bottom };
ClientToScreen(g_hWnd, &pt);
ClientToScreen(g_hWnd, &pt2);
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);

ClipCursor(&rc);
Right under in the "else", right above "pMyCharacter->ReleaseButtonState();", add (Edit: Dont forget to add curly brackets for this part for the else)
ClipCursor(NULL);



Static Spread (Note: This code assumes your SHOTGUN_BULLET_COUNT is 12, and also the spread I put is just a random one, change the return values to change the spread) :

Right Above the "ZGame::OnPeerShot_Shotgun" function, add:
int fAngleShit = 0; //sorry im bad at naming variables ...
int fForceShit = 0;

float getfAngle() {
if (fAngleShit != 12)
fAngleShit++;
else
fAngleShit = 0;

switch (fAngleShit) {
case 1:
return 2.610;
case 2:
return 1.698;
case 3:
return 10.598;
case 4:
return 8.235;
case 5:
return 18.594;
case 6:
return 8.302;
case 7:
return 26.247;
case 8:
return 7.311;
case 9:
return 12.928;
case 10:
return 30.150;
case 11:
return 7.987;
case 12:
fAngleShit = 0;
return 32.136;
default:
mlog("couldnt get a spread for fAngle..?");
return 0.0;
}
}

float getfForce() {
if (fForceShit != 12)
fForceShit++;
else
fForceShit = 0;

switch (fForceShit) {
case 1:
return 0.064;
case 2:
return 0.065;
case 3:
return 0.027;
case 4:
return 0.036;
case 5:
return 0.043;
case 6:
return 0.068;
case 7:
return 0.060;
case 8:
return 0.012;
case 9:
return 0.022;
case 10:
return 0.051;
case 11:
return 0.057;
case 12:
fForceShit = 0;
return 0.099;
default:
mlog("couldnt get a spread for fForce..?");
return 0.0;
}
}

In "ZGame::OnPeerShot_Shotgun", replace both the fAngle and fForce floats to:
float fAngle = getfAngle();
float fForce = getfForce();

edit : holy crap the indentation got rekt lmfao rip sorry
 
Last edited:
Junior Spellweaver
Joined
Apr 23, 2021
Messages
106
Reaction score
15
Hey guys,

I thought I should share these fixes with you guys as these bugfixes are ones that I personally think are essential to having a good playing experience, as these bugs are really annoying to most people and are pretty common in servers. Also I wanted to contribute some code to this forum, so you guys can have this crappy but simple static spread system. Keep in mind, I know that there are better ways to implement these, but my experience is pretty low as im pretty new to this community and I've basically learned C++ by messing around with the gunz source so don't expect anything from me.

Anyways, here is the code:

Sword Reload Fix:
Inside of the "Animation_Reload" Function, replace the line "SetAnimationUpper(ZC_STATE_UPPER_RELOAD);" to




Multimonitor Bug Fix (When flicking your mouse, cursor can appear and go to your second monitor and tab you out) :

Find "SetCursorPos(pt.x, pt.y);" in ZGameInput::Update
Put under the line

Right under in the "else", right above "pMyCharacter->ReleaseButtonState();", add




Static Spread (Note: This code assumes your SHOTGUN_BULLET_COUNT is 12, and also the spread I put is just a random one, change the return values to change the spread) :

Right Above the "ZGame::OnPeerShot_Shotgun" function, add:


In "ZGame::OnPeerShot_Shotgun", replace both the fAngle and fForce floats to:


edit : holy crap the indentation got rekt lmfao rip sorry
i assume by random spread amount you can change whole generic dna of shotgun damages, reminds of unique from diablo 4 where you can do by wielding item 1-290% damage on weapon , but 100% from 290% chances are to do less than normal damage with that 1-100% you may roll. so this question is about if this changes game psychically or only by virtual static and strings?

i misunderstood lol. u spoke about putting random number, i thought u were saying the numbers are random now.
 
Last edited:
Be a kicker than cheater.
Joined
Dec 17, 2009
Messages
733
Reaction score
26
How to fix the Quest Crash (first playing quest/survival mode) = no problem.
but the 2nd of starting the game(quest), the game(gunz.exe) suddenly crashed after the loading, it never went to the stage game, only on loading screen..
 
Newbie Spellweaver
Joined
Jun 7, 2023
Messages
23
Reaction score
10
How to fix the Quest Crash (first playing quest/survival mode) = no problem.
but the 2nd of starting the game(quest), the game(gunz.exe) suddenly crashed after the loading, it never went to the stage game, only on loading screen..
?
 
Junior Spellweaver
Joined
Feb 2, 2012
Messages
163
Reaction score
56
How to fix the Quest Crash (first playing quest/survival mode) = no problem.
but the 2nd of starting the game(quest), the game(gunz.exe) suddenly crashed after the loading, it never went to the stage game, only on loading screen..
Your problem is with your scenario.xml, probably an invalid map or mob in the file. Had a similar issue when I made my own custom scenarios
 
Newbie Spellweaver
Joined
Jan 12, 2022
Messages
25
Reaction score
2
this generate a error:

if (GetItems()->GetSelectedWeapon()->isReloadable())
SetAnimationUpper(ZC_STATE_UPPER_RELOAD);

When using this source the person can no longer recharge the sword, by keeping the click pressed it no longer charges, it only gives swords xD
 
Newbie Spellweaver
Joined
Jun 7, 2023
Messages
23
Reaction score
10
this generate a error:



When using this source the person can no longer recharge the sword, by keeping the click pressed it no longer charges, it only gives swords xD
read carefully, you didnt put curly brackets after you put the multimonitor bug fix for the else......
 
Newbie Spellweaver
Joined
Jan 12, 2022
Messages
25
Reaction score
2
read carefully, you didnt put curly brackets after you put the multimonitor bug fix for the else......

I just saw it I will add it
By the way I also had an error here:
RECT rc;
GetClientRect(g_hWnd, &rc);

POINT pt = { rc.left, rc.top };
POINT pt2 = { rc.right, rc.bottom };
ClientToScreen(g_hWnd, &pt);
ClientToScreen(g_hWnd, &pt2);
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);

ClipCursor(&rc);

It told me that the "pt" line was already being used, what I did was change everything to "pt1" and it compiled
new source:

RECT rc;
GetClientRect(g_hWnd, &rc);

POINT pt1 = { rc.left, rc.top };
POINT pt2 = { rc.right, rc.bottom };
ClientToScreen(g_hWnd, &pt1);
ClientToScreen(g_hWnd, &pt2);
SetRect(&rc, pt1.x, pt1.y, pt2.x, pt2.y);

ClipCursor(&rc);
 
Elite Diviner
Joined
Sep 7, 2020
Messages
459
Reaction score
78
1713593103609 - Sword Reload Fix, Multimonitor bug fix, Basic and crappy static spread code - RaGEZONE Forums


what wrong i place ?

like HuGo579 said​

can't recharge the sword if keep click pressed it no charges, it only gives swords huh huh huh ha
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Jun 7, 2023
Messages
23
Reaction score
10
View attachment 259913

what wrong i place ?

like HuGo579 said​

can't recharge the sword if keep click pressed it no charges, it only gives swords huh huh huh ha
put... the... curly... brackets... for... the... else..................................................................................................................

I just saw it I will add it
By the way I also had an error here:


It told me that the "pt" line was already being used, what I did was change everything to "pt1" and it compiled
new source:
change the names
 
Back
Top