With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

Few CVars to money system

Postby Lucky Bro » Mon Jun 08, 2009 10:25 am

Hello.

Here is a short patch I made for SG. Actually it was supposed to be much bigger but I just don't have time to code right now :(
So I decided to release this one now and release any further as soon as I'll done them. If I will ever done them :)

Purpose of the patch:
I just want to make current SG code more flexible (configurable by server admins) by adding a few variables to money system (actually it is almost replacing current defenitions with CVars).
I didn't invent anything and didn't change a thing in current money system logic. Only a possibility to configure some values.
So, the patch should be easy to read and understand.
The patch is adding a few CVar values for money system to SG:
To general money system:
g_moneyMax - Maximum of money a player may have. (200)
g_moneyMin - Minimum of money a player may have. (20)
g_moneyDUMin - Minimum of money a player may have in DUEL mode. (20)
g_moneySocialHelp - social help money a player will get after dying 3 times in a row. (28)
g_moneyLose - money a player will lose in case of Team Kill (TK). (7)
g_moneyForRobber - money a robber will get when grab a money bag in BR mode. (10)
To team money system:
g_moneyMaxReward (renamed m_maxreward) - max reward a win team may get. (20)
g_moneyTeamWin (renamed m_teamwin) - money a win team will get. (16)
g_moneyTeamLose (renamed m_teamlose) - money a lose team will get. (10)
And few money system related values:
g_moneyRespawn is renamed to g_moneyRespawnMode - will make money lose mode for TK to work. (0)
g_countSocialHelp - count of dies to get social help. (3)

My implementation notes:
All general money system values are declared in the following way:
{ &g_moneyMax, "g_moneyMax", "200", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 1, qtrue }

I'm not sure if it is proper way to declare them, so feel free to change/fix it before perform merge.
I was trying to accomplish the following things by such declaration: they are all server info variables, so server should change client copies of these. And there should be notice for players when any of these are changed.
And I've added the new input variable MaxMoney (int) to BG_CanItemBeGrabbed function in bg_misc.c to keep the ability to check if player is able to take money when he has maximum of allowed money.
Seems there should be some restrictions to these new variables (like upper and lower boundaries). But they are absent now :(
And the changes in misc/win32/cleanvm.bat are not related to money system at all. I just didn't like its behaviour when it removes my whole build directory when it should remove only build/vm and build/asm directories if they are present.

How to apply the patch:
1. Download the patch file from [url=http://www.mediafire.com/?sharekey=2b325e4bf05ded0907258ee67c679e4ae04e75f6e8ebb871[/url]. "Now with mediashare!" :))
2. Using any SVN client apply the patch to 1.1 branch.

How to check the patch:
1. Compile VMs from code with the patch applied.
2. Put new VMs to new pk3 file under vm directory. (pk3 is a zip file with zero compression)
3. Rename this new pk3 file to something like sg_pak1.pk3.
4. Put the file to smokinguns subdirectory of the game.
5. Launch the game.
6. Check that new CVars are present.

P.S. The patch could be easily adapted to 1.0 code. But I think it is just not required.
Last edited by Lucky Bro on Sat Jul 11, 2009 8:40 am, edited 2 times in total.
"You should know that the lies won't hide your flaws/No sense in hiding all of yours/You gave up on your dreams along the way" (c) "Fake it" by Seether
P.S. English isn't my native language.
User avatar
Lucky Bro
Gunslinger
 
Posts: 143
Joined: Mon Mar 09, 2009 4:12 pm



Postby mLy! » Mon Jun 08, 2009 8:12 pm

nice work, but I would have preferred CVARS to change the cost of certain weapons :)
My Latest fragmovies:
Winning BB cup
User avatar
mLy!
Gunslinger
 
Posts: 218
Joined: Wed Feb 11, 2009 8:46 pm



Postby ReD NeCKersoN » Tue Jun 09, 2009 2:22 am

Always nice to see new contributions. Thanks Lucky Bro. 8)
Image
User avatar
ReD NeCKersoN
SG Team
 
Posts: 3245
Joined: Wed Mar 27, 2002 6:22 am
Location: VA, USA



Postby moRtem » Tue Jun 09, 2009 7:16 pm

mLy! wrote:nice work, but I would have preferred CVARS to change the cost of certain weapons :)


i underline this :-)

--

great work though, Bro .. also nice additions

And there should be notice for players when any of these are changed.


when serverside cvars are added to the config with "sets " as prefix, the server will broadcast the values of those cvars and clients can have a look at the settings by pressing ESC and entering "serverinfo" (also 3rd-party gamebrowsers list those broadcasted settings) -- i guess it's possible to declare cvars with 'sets' within the sourcecode aswell

(watch out though: adding a lot of 'sets'-cvars will cause an overflow)



/quit
User avatar
moRtem
Gunslinger
 
Posts: 284
Joined: Sun Mar 15, 2009 5:56 pm



Postby Lucky Bro » Fri Jun 12, 2009 2:49 pm

Thank you guys too, for the game and games :)
everyone wrote:nice work, but I would have preferred CVARS to change the cost of certain weapons

Humm.. Me too :)
Actually, I just stuck somewhere in the beginning with it. But I'm still trying to get it work sometime. Lack of Q3 engine knowledge :(
I'll let you know if I'll ever make some progress with it :)

moRtem wrote:when serverside cvars are added to the config with "sets " as prefix, the server will broadcast the values of those cvars and clients can have a look at the settings by pressing ESC and entering "serverinfo" (also 3rd-party gamebrowsers list those broadcasted settings) -- i guess it's possible to declare cvars with 'sets' within the sourcecode aswell

Humm.. thank you for the info. Will check.

moRtem wrote:(watch out though: adding a lot of 'sets'-cvars will cause an overflow)

Seems I already got this %) Where have you been?? ;)
"You should know that the lies won't hide your flaws/No sense in hiding all of yours/You gave up on your dreams along the way" (c) "Fake it" by Seether
P.S. English isn't my native language.
User avatar
Lucky Bro
Gunslinger
 
Posts: 143
Joined: Mon Mar 09, 2009 4:12 pm



Postby moRtem » Fri Jun 12, 2009 9:06 pm

Lucky Bro wrote:Where have you been?? ;)


you had been the one offline :-P

i am online on an almost daily base :-)

(to warn you: will be away from wednesday until sunday upcoming week)


/quit
User avatar
moRtem
Gunslinger
 
Posts: 284
Joined: Sun Mar 15, 2009 5:56 pm




Return to Code

Show Sidebar
Show Sidebar

User Control Panel

cron