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!

How to accurately calculate character stats in-game?

Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
hi, does anyone know how the stats of each char are calculated?
for example: when you create a char, he will start at (example) 100hp, but when you login, it will be 300hp.. i tried to find out how the client multiplies to get the maximum health but i couldnt find the right way because its always different for all races, classes and level...
or if you take strength and physical damage. if you do 27 (strength) x2,7 (1strength ~ 2,7 damage) you get the desired damage value but 25x2,7 will result in a wrong damage value(different than ingame) ...

i tried many different ways with different classes, race and level but i couldnt find out because everytime, it gets calculated differently by the game...

could someone look into the source and tell me how to do it? i cant find it x.x

i would really like to display the stats of a char on my website (like the official server has) xD
 
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
yea i know but its only for lvl1 characters(?).. i want to find out how to calculate the stats for each level etc..
 
Upvote 0
Newbie Spellweaver
Joined
Aug 7, 2015
Messages
73
Reaction score
29
oh sorry i was thinking you dont have include this stat to your calcule, i'm sorry i don't have looking how its calculate, if i find something i say you
 
Upvote 0
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
great i found the calc functions but wow... only GetMaxHP(); has like 10 different functions inside it... lets see if i really need all of those just to calculate maxhp omfg...
:mad:
 
Upvote 0
Newbie Spellweaver
Joined
Aug 7, 2015
Messages
73
Reaction score
29
yep ive watched, i have watched something like tformula was used in some fonction, maybe it giving some rate,
lot was because of skill, or if you are die you lost some of maxhp... its lot of calcule...
i'm happy if you have find something good
 
Upvote 0
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
maxhp is too much for me for the start so i tried with getcon (endurance of a char) but im so confused right now..

Code:
FLOAT CTObjBase::GetCON(BYTE bPure, WORD wBaseMIN){	FLOAT fCON = GetBaseStatValue(3, wBaseMIN);//MTYPE_CON	if(!bPure){		//CalcAfterMath(fCON);		fCON += CalcItemAbility(2);//ABILITY_CON		DWORD dwCON = (DWORD)fCON;		fCON += CalcAbilityValue(dwCON, 3); //MTYPE_CON	}	return fCON;}

i dont really know c++ but it looks like the basestatvalue gets added to the calcitemability and calcabilityvalue and the result (fcon) will be returned BUT

Code:
FLOAT CTObjBase::GetBaseStatValue(BYTE bType, WORD wBaseMIN){	WORD wBase = 1;//BASE_STAT	switch(bType){		case MTYPE_STR: wBase += m_pTRACE->m_wSTR + m_pTCLASS->m_wSTR; break;		case MTYPE_DEX: wBase += m_pTRACE->m_wDEX + m_pTCLASS->m_wDEX; break;		case MTYPE_CON: wBase += m_pTRACE->m_wCON + m_pTCLASS->m_wCON; break;		case MTYPE_INT: wBase += m_pTRACE->m_wINT + m_pTCLASS->m_wINT; break;		case MTYPE_WIS: wBase += m_pTRACE->m_wWIS + m_pTCLASS->m_wWIS; break;		case MTYPE_MEN: wBase += m_pTRACE->m_wMEN + m_pTCLASS->m_wMEN; break;	}	FLOAT fValue = max(wBaseMIN, wBase) * pow(GetFormulaRateX(FTYPE_1ST), m_bLevel-1);//FTYPE_1ST = 34	return fValue;}

base + race_con + class_con
example:
1 + 9 + 13 = 23
fvalue = 23 * (34 ^ 9-1) = ~41

so if i add 41 (basestatvalue) + result of calcitemability + result of calcabilityvalue i would get a number over 9999 (joke) ...
this cant be the base con (endurance) ...
this is so weird hey ..

and btw: the result should actually be 31 on a lvl 9 feline warrior without any accessories and buffs after calculating all functions and adding the results so the 41 alone wont be good either...
 
Last edited:
Upvote 0
Newbie Spellweaver
Joined
Oct 3, 2016
Messages
66
Reaction score
4
Hi everyone, i have another problem in my server with stats.. I want to change the start MP of my character when i create a new one, i tried to change MP in TChartTable but when i log to game the table in navicat restore the original value.. So how can i change this stat?? I'm sure i can edit function TCreateChar but i'm not very expert! :D Thanks everyone :p
 
Upvote 0
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
tgame functions > tcreatechar
edit

Code:
SET @dwMP = 2	SET @dwHP = 2	SELECT TOP 1 @dwHP = @dwHP + wCON, @dwMP = @dwMP + wMEN FROM TCLASSCHART WHERE bClassID = @bClass	SELECT TOP 1 @dwHP = @dwHP + wCON, @dwMP = @dwMP + wMEN FROM TRACECHART WHERE bRaceID = [USER=1333348209]bra[/USER]ce	SET @dwHP = 7 * @dwHP + 1	SET @dwMP = 9 * @dwMP + 1

or

Code:
INSERT INTO TCHARTABLE	(		dwUserID,		bSlot,		szNAME,		bRace,		bCountry,		bOriCountry,		bSex,		bRealSex,		bClass,		bLevel,		bHair,		bFace,		bBody,		bPants,		bHand,		bFoot,		dwEXP,		dwHP,		dwMP,		wSkillPoint,		dwGold,		dwSilver,		dwCooper,		wMapID,		wSpawnID,		wTemptedMon,		bAftermath,		fPosX,		fPosY,		fPosZ,		wDIR	) 	VALUES	(		@dwUserID,	-- dwUserID		@bSlot,		-- bSlot		@szNAME,	-- szNAME	 [USER=1333348209]bra[/USER]ce,	-- bRace		@bCountry,	-- bCountry		@bOriCountry,		@bSex,		-- bSex		@bRealSex,	-- bRealSex		@bClass,	-- bClass		@bLevel,	-- bLevel		@bHair,		-- bHair		@bFace,		@bBody,		@bPants,		@bHand,		@bFoot,		@dwExp,		@dwHP,		@dwMP,		@wSkillPoint,		0,		0,		0,		2010,		@wSpawnID,		0,		0,		@fPosX,		@fPosY,		@fPosZ,		@wDIR	)

edit @dwMP
 
Upvote 0
Newbie Spellweaver
Joined
Oct 3, 2016
Messages
66
Reaction score
4
So ''SET @dwMP = 2000'' and i will have 2000 Mp when i create ea new char?? :D
 
Upvote 0
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
try it but i think if you create a char with more current mp than max mp (you can only change max mp in the source), the current mp will be set to the max mp at login.
so for a lvl 1 char, it would be around 300 i guess xd

and i personally wouldnt change "set @dwmp" because this is the base of a calculation.. if you set it to 2000, the mp will be set to over 14k ^^ just change @dwmp at the "VALUES" from my second code.
 
Upvote 0
Junior Spellweaver
Joined
Mar 14, 2018
Messages
159
Reaction score
13
you can change the current mp at char creation in the tcreatechar func and the maxmp in the source ^^
 
Upvote 0
Newbie Spellweaver
Joined
Aug 7, 2015
Messages
73
Reaction score
29
all is calculate on source, you can't really "change MP value for 1 character" (or you need to use options like endurance, and Spirit)
if you edit on source you edit all calculate life in game.

all is recalculate when your login or change something in your character.
 
Upvote 0
Back
Top