Now the below function shows how this is done, which to me looks like it would run into overhead problems, especially if the player has a large inventory. I am considering just writing a variable on the player when the players login/levelup/rest instead so that inventory loops can be avoided as much as possible. Like I said, from reviewing this function and seeing how frequently it is used in almost every spell makes me cringe at how much overhead this must take. I for one have huge inventories on some of my higher level characters to item swap a lot for tougher areas, including a couple dozen bags of holding. I can only imagine how gameplay would improve if this were to be done another way.
I thought I would just ask the community what they thought in hopes of possibly finding yet an even better method to achieve the same results.
// Applies post 40 bonus to nNumber based on xp of oPlayer
int Level40PlusMagicBuff(int nNumber, object oPlayer)
{
if ( GetHitDice( oPlayer ) >= 40 )
{
int nBonus;
float fBonus;
int nXP = GetXP(oPlayer);
int nLevel = FloatToInt(( sqrt(( IntToFloat( nXP ) * 20 ) + 2500 ) / 100 ) + 0.5 );
effect eBuff;
nBonus = ( nLevel - 40 );
fBonus = IntToFloat( nBonus ) / 100.0;
//Checks to see if Player has a Level 4 Magic Rune
if (GetItemPossessedBy(oPlayer, "av_itm_magerune4") != OBJECT_INVALID )
{
fBonus *= 2.0; //2% bonus per post40 lvl
}
//Checks to see if Player has a Level 3 Magic Rune
else if (GetItemPossessedBy(oPlayer, "av_itm_magerune3") != OBJECT_INVALID )
{
fBonus *= 1.75; //1.75% bonus per post40 lvl
}
//Checks to see if Player has a Level 2 Magic Rune
else if (GetItemPossessedBy(oPlayer, "av_itm_magerune2") != OBJECT_INVALID )
{
fBonus *= 1.5; //1.5% bonus per post40 lvl
}
//Checks to see if Player has a Level 1 Magic Rune
else if (GetItemPossessedBy(oPlayer, "av_itm_magerune1") != OBJECT_INVALID )
{
fBonus *= 1.25; //1.25% bonus per post40 lvl
}
nNumber = FloatToInt( IntToFloat( nNumber ) * ( fBonus + 1.0 ));
}
return nNumber;
}
I am also interested in any feedback you all have on a good way of hooking in NPC increases here, I was thinking of just using a variable on particular boss mobs specifically, but an extra bonus for normal mobs at lvl 60 caster level would be nice too.
Modifié par SKIPPNUTTZ, 27 novembre 2011 - 08:12 .





Retour en haut






