Darwin

Member
Hello. I'm experimenting with getting a skill to provide an inherent AOS property bonus. I'm trying to get meditation to provide an lmc bonus that goes beyond cap. I sort of based the code off the sdi bonus provided from inscription. However, I must have something wrong with my math because when I log in game, no bonus is given. The mana cost remains the same with or without the skill. The code was written as it is to give the mobile with meditation skill a 1% LMC bonus for every 10 skill points. Does anyone see what I'm doing wrong and/or have any suggestions to fix it?

public virtual int GetNewLMC(int bonus, int dice, int sides, double scalar, Mobile caster)
{

int totallmc = Utility.Dice(dice, sides, bonus) * 100;
int lowermanacostBonus = 0;

int MeditationSkill = GetMeditationFixed(m_Caster);
int MeditationLMCBonus = (MeditationSkill + (1000 * (MeditationSkill / 1000))) / 200;
lowermanacostBonus += MeditationLMCBonus;

MeditationLMCBonus += Spell.GetlmcBonus(m_Caster);

totallmc = AOS.Scale(totallmc, 100 + MeditationLMCBonus);

totallmc = AOS.Scale(totallmc, (int)(scalar * 100));

return totallmc / 100;
}

public static int GetlmcBonus(Mobile caster)
{
int lmcBonus = AosAttributes.GetValue(caster, AosAttribute.LowerManaCost);
return lmcBonus;
}
 
Need to see more code. Where are you calling the GetNewLmc function from?
My code is a part of the Spell.cs script of the Server.Spells namespace. the GetMeditationFixed is from

public virtual int GetMeditationFixed(Mobile m)
{
return m.Skills[SkillName.Meditation].Fixed;
}
[doublepost=1506052309][/doublepost]I just realized that I forgot to edit the lmc part of the script that reads

int lmc = AosAttributes.GetValue(m_Caster, AosAttribute.LowerManaCost);

if (lmc > 40)
{
lmc = 40;
}
scalar -= (double)lmc / 100;

return (int)(mana * scalar);

So I just added

int lmc = AosAttributes.GetValue(m_Caster, AosAttribute.LowerManaCost);

if (lmc > 40)
{
lmc = 40;
}

lmc += GetNewLMC(m_Caster);

scalar -= (double)lmc / 100;

return (int)(mana * scalar);

To it, and now the skill is giving me a lower mana cost affect, but it's giving me 100% lmc and not taking any mana at all.
[doublepost=1506052528][/doublepost]edit: I just tried casting without my ring that has 40 lmc on it, and now the spell is working as if I have 0 lmc. So my guess is that I messed up with my math somewhere and it's multiplying the effect of my lowermanacost mod. The meditation skill still isn't affecting the lowermanacost at all.
[doublepost=1506052763][/doublepost]edit, just tried with 1 lmc from mods + no meditation skill and it worked as if i had like 5-15%. Now I'm trying with 5 lmc and it's working as if I have something like 20%. With meditation skill at 120 it's doing the same thing.
[doublepost=1506060151][/doublepost]Okay, I got it all figured out. I was trying to do it the way the inscribe code is written, but I realized that it was much simpler than that. All I had to do was something like "lmc += GetSpiritSpeakFixed(m_Caster) / 100;" at the part where the lmc cap is established.
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back