|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
08-01-2009, 10:19 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Maxlevel in addition to NPC level
This will add a maxlevel field for NPCs you want to scale dynamically to level. Currently, it does everything except set HP automatically. That will have to be set manually but can be changed by server admins. It also allows ATK to be calculated for NPCs with 0 attack also regardless of settings, and it sets generic stats for NPCS if they are 0.
If you set the field to 0, it will do nothing, so it does not affect anything past what is currently there. If someone wants to make their own formulas for generating NPCs, tweak npc.cpp. By default all stats are 75 so i'd say if you want NPCs to have custom stats, go for it or set it manually in the database, as it only checks for if stats are 0.
The minlevel field itself chooses a random number between level and maxlevel, so if you have maxlevel as 10 and level as 1, it will choose a random number between 1 and 10. There's existing calculations for min/max dmg, so I left them there.
Required SQL:
Code:
ALTER TABLE `npc_types` ADD COLUMN `maxlevel` tinyint NOT NULL DEFAULT 0;
Diff @ rev 830:
Code:
Index: beacon.cpp
===================================================================
--- beacon.cpp (revision 830)
+++ beacon.cpp (working copy)
@@ -45,7 +45,7 @@
:Mob
(
NULL, NULL, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
),
remove_timer(lifetime),
spell_timer(0)
Index: client.cpp
===================================================================
--- client.cpp (revision 830)
+++ client.cpp (working copy)
@@ -137,7 +137,8 @@
0,
0,
0, // qglobal
- 0 //Drakelord: slow_mitigation
+ 0, //Drakelord: slow_mitigation
+ 0 //Secrets: Maxlevel
),
//these must be listed in the order they appear in client.h
@@ -933,6 +934,7 @@
void Client::ChannelMessageSend(const char* from, const char* to, int8 chan_num, int8 language, int8 lang_skill, const char* message, ...) {
if ((chan_num==11 && !(this->GetGM())) || (chan_num==10 && this->Admin()<80)) // dont need to send /pr & /petition to everybody
return;
+
va_list argptr;
char buffer[4096];
Index: mob.cpp
===================================================================
--- mob.cpp (revision 830)
+++ mob.cpp (working copy)
@@ -96,7 +96,8 @@
sint16 in_hp_regen,
sint16 in_mana_regen,
int8 in_qglobal,
- float in_slow_mitigation //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ float in_slow_mitigation, //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ int8 in_maxlevel
) :
attack_timer(2000),
@@ -214,6 +215,7 @@
mana_regen = in_mana_regen;
oocregen = RuleI(NPC, OOCRegen); //default Out of Combat Regen
slow_mitigation = in_slow_mitigation;
+ maxlevel = in_maxlevel;
invisible = false;
invisible_undead = false;
invisible_animals = false;
Index: mob.h
===================================================================
--- mob.h (revision 830)
+++ mob.h (working copy)
@@ -389,7 +389,8 @@
sint16 in_hp_regen,
sint16 in_mana_regen,
int8 in_qglobal,
- float in_slow_mitigation //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ float in_slow_mitigation, //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ int8 in_maxlevel
);
virtual ~Mob();
@@ -1082,6 +1083,7 @@
sint16 mana_regen;
sint32 oocregen; //Out of Combat Regen, % per tick
float slow_mitigation; //Allows for a slow mitigation based on a % in decimal form. IE, 1 = 100% mitigation, .5 is 50%
+ int8 maxlevel;
Buffs_Struct buffs[BUFF_COUNT];
StatBonuses itembonuses;
StatBonuses spellbonuses;
Index: npc.cpp
===================================================================
--- npc.cpp (revision 830)
+++ npc.cpp (working copy)
@@ -103,7 +103,8 @@
d->hp_regen,
d->mana_regen,
d->qglobal,
- d->slow_mitigation ),
+ d->slow_mitigation,
+ d->maxlevel),
attacked_timer(CombatEventTimer_expire),
swarm_timer(100),
classattack_timer(1000),
@@ -125,7 +126,18 @@
NPCTypedata_ours = NULL;
respawn2 = in_respawn;
swarm_timer.Disable();
-
+
+ // sanity check for lazy people
+ if(maxlevel < moblevel) {
+ int8 tmp = moblevel;
+ maxlevel = tmp;
+ }
+ //maxlevel stuff
+ if(maxlevel)
+ {
+ level = (MakeRandomInt(moblevel, maxlevel));
+ }
+
taunting = false;
proximity = NULL;
copper = 0;
@@ -249,6 +261,25 @@
accuracy_rating = d->accuracy_rating;
ATK = d->ATK;
+ //defaults for maxlevel
+
+ if (!ATK || ATK == 0)
+ ATK = (moblevel * 5); // attack is typically higher than stats, should make this a rule because it can and will change depending on server
+ if (!STR || STR == 0)
+ STR = 75; // these need to be reworked, till then use it on trash mobs
+ if (!STA || STA == 0)
+ STA = 75;
+ if (!DEX || DEX == 0)
+ DEX = 75;
+ if (!AGI || AGI == 0)
+ AGI = 75;
+ if (!INT || INT == 0)
+ INT = 75;
+ if (!WIS || WIS == 0)
+ WIS = 75;
+ if (!CHA || CHA == 0)
+ CHA = 75;
+
CalcMaxMana();
SetMana(GetMaxMana());
@@ -308,19 +339,20 @@
FR = d->FR;
PR = d->PR;
- if (!MR)
+ if (!MR || MR == 0)
MR = (moblevel * 11)/10;
- if (!CR)
+ if (!CR || CR == 0)
CR = (moblevel * 11)/10;
- if (!DR)
+ if (!DR || DR == 0)
DR = (moblevel * 11)/10;
- if (!FR)
+ if (!FR || FR == 0)
FR = (moblevel * 11)/10;
- if (!PR)
+ if (!PR || PR == 0)
PR = (moblevel * 11)/10;
npc_aggro = d->npc_aggro;
+
AI_Start();
d_meele_texture1 = d->d_meele_texture1;
Index: PlayerCorpse.cpp
===================================================================
--- PlayerCorpse.cpp (revision 830)
+++ PlayerCorpse.cpp (working copy)
@@ -198,7 +198,7 @@
in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
in_npc->GetTexture(),in_npc->GetHelmTexture(),
0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0),
+ 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(in_decaytime),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(0)
@@ -294,6 +294,7 @@
0,
0,
0, // qglobal
+ 0,
0 //Drakelord: slow_mitigation
),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
@@ -403,7 +404,7 @@
: Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,
- 0,0,0,0,0,0,0,0),
+ 0,0,0,0,0,0,0,0,0),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS))
Index: zonedb.cpp
===================================================================
--- zonedb.cpp (revision 830)
+++ zonedb.cpp (working copy)
@@ -1065,7 +1065,8 @@
"npc_types.see_improved_hide,"
"npc_types.ATK,"
"npc_types.Accuracy,"
- "npc_types.slow_mitigation";
+ "npc_types.slow_mitigation,"
+ "npc_types.maxlevel";
MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
@@ -1229,6 +1230,7 @@
tmpNPCType->ATK = atoi(row[r++]);
tmpNPCType->accuracy_rating = atoi(row[r++]);
tmpNPCType->slow_mitigation = atoi(row[r++]);
+ tmpNPCType->maxlevel = atoi(row[r++]);
// If NPC with duplicate NPC id already in table,
// free item we attempted to add.
Index: zonedump.h
===================================================================
--- zonedump.h (revision 830)
+++ zonedump.h (working copy)
@@ -111,6 +111,7 @@
bool findable; //can be found with find command
bool trackable;
float slow_mitigation; //Drakelord: Slow mitigation % in decimal form.
+ int8 maxlevel;
};
struct ZSDump_Spawn2 {
|
|
|
|
08-01-2009, 11:03 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
I have a solution to the HP issue introduced with this code: Adding a random HP field! This allows for random HP between values.
If defined in the database, hp will be a minimum value and hpmax will be a maxhp value, in a similar fashion that level works by choosing a random number. That way fights are a wee bit more dynamic. I don't know if this is stepping too far into the custom realm where it should be posted in custom code, but..
Diff will be uploaded after I test this change.
|
|
|
|
08-01-2009, 11:44 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Ok, here's the diff for hpmax. You will need this SQL:
ALTER TABLE `npc_types` ADD COLUMN `hpmax` tinyint NOT NULL DEFAULT 0;
And here's the diff, including the previous post. All of this is done on r830.
Code:
Index: beacon.cpp
===================================================================
--- beacon.cpp (revision 830)
+++ beacon.cpp (working copy)
@@ -45,7 +45,7 @@
:Mob
(
NULL, NULL, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
),
remove_timer(lifetime),
spell_timer(0)
Index: client.cpp
===================================================================
--- client.cpp (revision 830)
+++ client.cpp (working copy)
@@ -137,7 +137,9 @@
0,
0,
0, // qglobal
- 0 //Drakelord: slow_mitigation
+ 0, //Drakelord: slow_mitigation
+ 0, //Secrets: Maxlevel
+ 0 //Secrets: HPMax
),
//these must be listed in the order they appear in client.h
@@ -933,6 +935,7 @@
void Client::ChannelMessageSend(const char* from, const char* to, int8 chan_num, int8 language, int8 lang_skill, const char* message, ...) {
if ((chan_num==11 && !(this->GetGM())) || (chan_num==10 && this->Admin()<80)) // dont need to send /pr & /petition to everybody
return;
+
va_list argptr;
char buffer[4096];
Index: mob.cpp
===================================================================
--- mob.cpp (revision 830)
+++ mob.cpp (working copy)
@@ -96,7 +96,9 @@
sint16 in_hp_regen,
sint16 in_mana_regen,
int8 in_qglobal,
- float in_slow_mitigation //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ float in_slow_mitigation, //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ int8 in_maxlevel,
+ sint32 in_hpmax
) :
attack_timer(2000),
@@ -214,6 +216,8 @@
mana_regen = in_mana_regen;
oocregen = RuleI(NPC, OOCRegen); //default Out of Combat Regen
slow_mitigation = in_slow_mitigation;
+ maxlevel = in_maxlevel;
+ hpmax = in_hpmax;
invisible = false;
invisible_undead = false;
invisible_animals = false;
Index: mob.h
===================================================================
--- mob.h (revision 830)
+++ mob.h (working copy)
@@ -389,7 +389,9 @@
sint16 in_hp_regen,
sint16 in_mana_regen,
int8 in_qglobal,
- float in_slow_mitigation //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ float in_slow_mitigation, //Drakelord: Allows for mobs to mitigate how much they are slowed.
+ int8 in_maxlevel,
+ sint32 in_hpmax
);
virtual ~Mob();
@@ -1082,6 +1084,8 @@
sint16 mana_regen;
sint32 oocregen; //Out of Combat Regen, % per tick
float slow_mitigation; //Allows for a slow mitigation based on a % in decimal form. IE, 1 = 100% mitigation, .5 is 50%
+ int8 maxlevel;
+ sint32 hpmax;
Buffs_Struct buffs[BUFF_COUNT];
StatBonuses itembonuses;
StatBonuses spellbonuses;
Index: npc.cpp
===================================================================
--- npc.cpp (revision 830)
+++ npc.cpp (working copy)
@@ -103,7 +103,9 @@
d->hp_regen,
d->mana_regen,
d->qglobal,
- d->slow_mitigation ),
+ d->slow_mitigation,
+ d->maxlevel,
+ d->hpmax),
attacked_timer(CombatEventTimer_expire),
swarm_timer(100),
classattack_timer(1000),
@@ -125,7 +127,30 @@
NPCTypedata_ours = NULL;
respawn2 = in_respawn;
swarm_timer.Disable();
-
+ // sanity check for lazy people
+ if(hpmax < max_hp) {
+ sint32 tmp = max_hp;
+ hpmax = tmp;
+ }
+
+ // sanity check for lazy people
+ if(maxlevel < moblevel) {
+ int8 tmp = moblevel;
+ maxlevel = tmp;
+ }
+ //maxlevel stuff
+ if(maxlevel)
+ {
+ level = (MakeRandomInt(moblevel, maxlevel));
+ }
+ if(hpmax)
+ {
+ max_hp = (MakeRandomInt(max_hp, hpmax));
+ base_hp = max_hp;
+ cur_hp = max_hp;
+ }
+
+
taunting = false;
proximity = NULL;
copper = 0;
@@ -249,6 +274,25 @@
accuracy_rating = d->accuracy_rating;
ATK = d->ATK;
+ //defaults for maxlevel
+
+ if (!ATK || ATK == 0)
+ ATK = (moblevel * 5); // attack is typically higher than stats, should make this a rule because it can and will change depending on server
+ if (!STR || STR == 0)
+ STR = 75; // these need to be reworked, till then use it on trash mobs
+ if (!STA || STA == 0)
+ STA = 75;
+ if (!DEX || DEX == 0)
+ DEX = 75;
+ if (!AGI || AGI == 0)
+ AGI = 75;
+ if (!INT || INT == 0)
+ INT = 75;
+ if (!WIS || WIS == 0)
+ WIS = 75;
+ if (!CHA || CHA == 0)
+ CHA = 75;
+
CalcMaxMana();
SetMana(GetMaxMana());
@@ -308,19 +352,20 @@
FR = d->FR;
PR = d->PR;
- if (!MR)
+ if (!MR || MR == 0)
MR = (moblevel * 11)/10;
- if (!CR)
+ if (!CR || CR == 0)
CR = (moblevel * 11)/10;
- if (!DR)
+ if (!DR || DR == 0)
DR = (moblevel * 11)/10;
- if (!FR)
+ if (!FR || FR == 0)
FR = (moblevel * 11)/10;
- if (!PR)
+ if (!PR || PR == 0)
PR = (moblevel * 11)/10;
npc_aggro = d->npc_aggro;
+
AI_Start();
d_meele_texture1 = d->d_meele_texture1;
Index: PlayerCorpse.cpp
===================================================================
--- PlayerCorpse.cpp (revision 830)
+++ PlayerCorpse.cpp (working copy)
@@ -198,7 +198,7 @@
in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
in_npc->GetTexture(),in_npc->GetHelmTexture(),
0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0),
+ 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(in_decaytime),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(0)
@@ -294,6 +294,8 @@
0,
0,
0, // qglobal
+ 0,
+ 0,
0 //Drakelord: slow_mitigation
),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
@@ -403,7 +405,7 @@
: Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,
- 0,0,0,0,0,0,0,0),
+ 0,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS))
Index: zonedb.cpp
===================================================================
--- zonedb.cpp (revision 830)
+++ zonedb.cpp (working copy)
@@ -1065,7 +1065,9 @@
"npc_types.see_improved_hide,"
"npc_types.ATK,"
"npc_types.Accuracy,"
- "npc_types.slow_mitigation";
+ "npc_types.slow_mitigation,"
+ "npc_types.maxlevel,"
+ "npc_types.hpmax";
MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
@@ -1229,6 +1231,8 @@
tmpNPCType->ATK = atoi(row[r++]);
tmpNPCType->accuracy_rating = atoi(row[r++]);
tmpNPCType->slow_mitigation = atoi(row[r++]);
+ tmpNPCType->maxlevel = atoi(row[r++]);
+ tmpNPCType->hpmax = atoi(row[r++]);
// If NPC with duplicate NPC id already in table,
// free item we attempted to add.
Index: zonedump.h
===================================================================
--- zonedump.h (revision 830)
+++ zonedump.h (working copy)
@@ -111,6 +111,8 @@
bool findable; //can be found with find command
bool trackable;
float slow_mitigation; //Drakelord: Slow mitigation % in decimal form.
+ int8 maxlevel;
+ sint32 hpmax;
};
struct ZSDump_Spawn2 {
This will not affect any previous mobs. The only thing it will effect is things with the hpmax field. Same goes for maxlevel.
|
|
|
|
08-02-2009, 12:06 AM
|
|
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
Quote:
Originally Posted by Secrets
I don't know if this is stepping too far into the custom realm where it should be posted in custom code, but..
|
Not at all, this will help world builders for both legit and custom servers alike.
|
08-03-2009, 06:42 PM
|
Sarnak
|
|
Join Date: Mar 2009
Location: none
Posts: 30
|
|
Wouldn't it make more sense if the level and HP were based on the same random number so that higher level mobs have more HP and vice versa.
Code:
max_hp = max_hp + ((level - moblevel)/(maxlevel - moblevel))*(hpmax - max_hp)
|
08-03-2009, 10:54 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Quote:
Originally Posted by Wesell
Wouldn't it make more sense if the level and HP were based on the same random number so that higher level mobs have more HP and vice versa.
Code:
max_hp = max_hp + ((level - moblevel)/(maxlevel - moblevel))*(hpmax - max_hp)
|
I wanted the fields to be independant of each other.
|
08-04-2009, 12:55 AM
|
Sarnak
|
|
Join Date: Mar 2009
Location: none
Posts: 30
|
|
Oh, in that case you still have a problem with HP not being adjusted for level which will have a profound effect at lower levels.
|
08-05-2009, 02:49 AM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Quote:
Originally Posted by Wesell
Oh, in that case you still have a problem with HP not being adjusted for level which will have a profound effect at lower levels.
|
Yeah, very true. Some custom servers might find this useful, I guess. I don't know of the calculation for mob HP though, or if there even was one on live.
Otherwise i'd do that. That maxlevel feature is something that could be useful if given defaults.
|
|
|
|
08-05-2009, 06:55 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Just an FYI; Going forward, we are not putting names into the actual source code comments anymore. We have even been going through and removing some that are already in there. The names will go into the changelog like normal, and that is the best place to keep track of who did what. Just making note of that for future submissions.
Here is the code from the #spawn command that autocalculates MaxHPs:
Code:
//Calc MaxHP if client neglected to enter it...
if (!sep.IsNumber(4)) {
//Stolen from Client::GetMaxHP...
int8 multiplier = 0;
int tmplevel = atoi(sep.arg[2]);
switch(atoi(sep.arg[5]))
{
case WARRIOR:
if (tmplevel < 20)
multiplier = 22;
else if (tmplevel < 30)
multiplier = 23;
else if (tmplevel < 40)
multiplier = 25;
else if (tmplevel < 53)
multiplier = 27;
else if (tmplevel < 57)
multiplier = 28;
else
multiplier = 30;
break;
case DRUID:
case CLERIC:
case SHAMAN:
multiplier = 15;
break;
case PALADIN:
case SHADOWKNIGHT:
if (tmplevel < 35)
multiplier = 21;
else if (tmplevel < 45)
multiplier = 22;
else if (tmplevel < 51)
multiplier = 23;
else if (tmplevel < 56)
multiplier = 24;
else if (tmplevel < 60)
multiplier = 25;
else
multiplier = 26;
break;
case MONK:
case BARD:
case ROGUE:
// case BEASTLORD:
if (tmplevel < 51)
multiplier = 18;
else if (tmplevel < 58)
multiplier = 19;
else
multiplier = 20;
break;
case RANGER:
if (tmplevel < 58)
multiplier = 20;
else
multiplier = 21;
break;
case MAGICIAN:
case WIZARD:
case NECROMANCER:
case ENCHANTER:
multiplier = 12;
break;
default:
if (tmplevel < 35)
multiplier = 21;
else if (tmplevel < 45)
multiplier = 22;
else if (tmplevel < 51)
multiplier = 23;
else if (tmplevel < 56)
multiplier = 24;
else if (tmplevel < 60)
multiplier = 25;
else
multiplier = 26;
break;
}
sprintf(sep.arg[4],"%i",5+multiplier*atoi(sep.arg[2])+multiplier*atoi(sep.arg[2])*75/300);
}
Though, that probably isn't very useful for this feature unless mobs all used this same formula and they don't.
We could always just scale HPs (and possibly other stats) based on the mob's actual level vs the level set in the database. So, if the level is set to 10, and max level is set to 12, that would mean mob stats/hps could scale up 20% from what they are set to in the DB. So, a level 11 NPC would scales it's hps by 1.1, which would mean a 100HP level 10 NPC would have 110HPs at level 11. and 120HPs at level 12. This scaling would probably work well in most cases. The formula for that should be pretty easy. Something like this should work:
Code:
maxhp += (maxhp * ((moblevel / level) - 1));
Where moblevel is the level of the NPC after it has been spawned and set to one of the levels in it's range, and level is the base level set in the database.
If we wanted to be more flexible, though, we could add another field for scaling rates. The default for the scaling field would be 100. So, if we wanted a particular NPC's stats to scale at a faster rate as levels increase, we could set the scale rate to 200 (double scaling rate), or if we wanted it's stats to scale slower as levels increase, we could set it to 50 (half scaling rate). The formula for that would be something like this:
Code:
maxhp += (maxhp * (((moblevel / level) - 1) * (scale_rate / 100)));
This should allow for decent automatic scaling with lots of flexibility so it can be adjusted on a per-NPC basis. Of course, all other stats such as resists, normal stats and such could also be factored into this scaling system. Here is an example:
Code:
STR += (STR * (((moblevel / level) - 1) * (scale_rate / 100)));
Just something to consider. The main difference from what Secrets has posted and this is that there wouldn't be a need for a maxhp field, and instead there would be a scaling_rate field. I really like the idea of the whole random level NPC thing, no matter how it gets put in. We might as well work out all of the details now before it is committed so the system doesn't need to be adjusted afterward. It can be a pain to make adjustments after people have already started using a new system like this. Any thoughts?
Last edited by trevius; 08-06-2009 at 06:36 AM..
|
|
|
|
08-05-2009, 09:03 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
It's kind of the same idea edge did. We had a % modifier on stats, and the stats would scale to level. I would totally be for that, if only for making custom content easier.
The main issue a lot of server ops have in balancing NPCs is making it so their stats are challenging for the level they are at. Otherwise, you have level 98 mobs one shotting people because they think "higher level is better". If you have a generic scaling for NPCs, it would make it a ton easier to scale to custom content, and encounters in general. I would love a variable like this for creating almost anything.
If this system was implemented, i'd also remove the hpmax submission.
|
08-05-2009, 10:20 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
If I get time, I might try to work out the details to get the new maxlevel and scaling stuff added in. And after that, there is always the possibility of making use of that system through quest commands later.
Is anyone apposed to the idea of the scaling system to go with the new maxlevel system idea? Or are there any suggestions on how to handle it in a better way?
EDIT: Corrected my formulas above so they would actually work as intended.
Last edited by trevius; 08-06-2009 at 06:35 AM..
|
08-12-2009, 03:18 PM
|
Sarnak
|
|
Join Date: Mar 2009
Location: none
Posts: 30
|
|
Looking at the data in this post it would seem the live HP scaling was a bit of a hack. It would appear that 20 HP is added to base HP for each additional level. Obviously this may and probably did change if they continued to use scaling code in expansion releases.
|
08-12-2009, 05:06 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
This has already been added to the SVN. The scaling we use is based on percentages of current stats depending on the relative level of the spawned NPC vs it's base level and base stats.
|
08-12-2009, 05:22 PM
|
Sarnak
|
|
Join Date: Mar 2009
Location: none
Posts: 30
|
|
Yeah, I noticed. I just thought that this would be an interesting little bit of info for anyone who was following this thread. Maybe bumping this server code submissions thread was not the most appropriate way to highlight this info.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:52 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|