Page 1 of 1
Help - Percentage.
Posted: Fri Jun 13, 2014 6:11 am
by Dello0000
Hey
Looking at the script for
Mend I and
Mend III i see they use the same script. Will we need another script made up for percent based values?
As it stands now the tier 1 and 2 Mend spells heal for more than the tier 3 because the percent numbers come out as 9.5 health instead of 9.5% of total hp.
If i can get an idea of the code i should be able to fix a few other percent based ability's.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 7:55 am
by Zcoretri
Dello0000 wrote:Hey
Looking at the script for
Mend I and
Mend III i see they use the same script. Will we need another script made up for percent based values?
As it stands now the tier 1 and 2 Mend spells heal for more than the tier 3 because the percent numbers come out as 9.5 health instead of 9.5% of total hp.
If i can get an idea of the code i should be able to fix a few other percent based ability's.
Its just a matter of getting the Max Health of the target and multiplying it with the percent value.
Maybe something like this?
Code: Select all
CurrentHP = GetMaxHP(Target)
MinHeal = CurrentHP * (MinVal / 100)
MaxHeal = CurrentHP * (MaxVal / 100)
SpellHeal("Heal", MinHeal, MaxHeal)
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 9:45 am
by Dello0000
Zcoretri wrote:Maybe something like this?
Code: Select all
CurrentHP = GetMaxHP(Target)
MinHeal = CurrentHP * (MinVal / 100)
MaxHeal = CurrentHP * (MaxVal / 100)
SpellHeal("Heal", MinHeal, MaxHeal)
Ill give that a try once the servers working again thanks.
And im guessing it would apply to to other things? Just need to change the functions.
Anyway thanks for that if i can get it working

Re: Help - Percentage.
Posted: Fri Jun 13, 2014 2:17 pm
by Dello0000
How do you make a new blank .lua? I need one called MendPercent.lua (Having one lua for the skill wont apply because after the first two they move to a different function.)
Can someone do that for me or tell me how to do it myself? thanks.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 2:22 pm
by thefoof
Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
Can you explain what you're trying to do here? I can probably help just want to know why you need it first.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 4:31 pm
by Dello0000
thefoof wrote:Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
Can you explain what you're trying to do here? I can probably help just want to know why you need it first.
The monk heal ability is a simple X - X heal for the first two tiers. At Mend III however it changes into a percent based heal so the "one script for all tiers" method wont work in this case causing us to use two lua's
Unless we can marry the x to x heal with a percent heal but im sure that wouldn't work.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 4:42 pm
by thefoof
Dello0000 wrote:thefoof wrote:Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
Can you explain what you're trying to do here? I can probably help just want to know why you need it first.
The monk heal ability is a simple X - X heal for the first two tiers. At Mend III however it changes into a percent based heal so the "one script for all tiers" method wont work in this case causing us to use two lua's
Unless we can marry the x to x heal with a percent heal but im sure that wouldn't work.
How about I just add a function so you can get the spell name and check it?

Re: Help - Percentage.
Posted: Fri Jun 13, 2014 5:08 pm
by thefoof
Code: Select all
function cast(Caster, Target, MinVal, MaxVal, CureLvls)
local spell_name = GetSpellName()
if spell_name ~= "Mend" and spell_name ~= "Mend II" then
local max_hp = GetMaxHP(Target)
MinVal = (max_hp * (MinVal / 100))
MaxVal = (max_hp * (MaxVal / 100))
end
-- Heals target for 21 - 25
-- This effect cannot be critically applied.
-- The healing of this spell cannot be modified except by direct means
SpellHeal("Heal", MinVal, MaxVal, 0, 2, 1)
-- Dispels 7 levels of noxious hostile effects on target
CureByType(CureLvls, 3);
end
This function isn't committed yet but will be tonight. I went ahead and put this script up, just posting here so you can see what I mean =p
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 5:09 pm
by Dello0000
I don't think im following lol. In fact i know im not!
Adding an empty MendPercent.lua file for me to edit would be good. Let me explain abit more.
Mend I and
Mend II are heals which (like a direct damage) have a minimum and maximum value to draw its ingame number from. However
Mend III (If you look at the description) is also a minimum and maximum type heal but it is based on the casters total hp value, meaning the script that works for
Mend I and
Mend II will not work for
Mend III because altho 50hp is less than 10% of 1000 the script treats the 9.0 - 10.0 as it would the "50"
So basically we need a new script to continue the Mend spell line.
I hope that clears it up lol :p
[EDIT]
Code: Select all
local spell_name = GetSpellName()
if spell_name ~= "Mend" and spell_name ~= "Mend II" then
Hmm, That could work, maybe. So have the usual script at the bottom and add that up the top and after "then" have your alternate heal spell.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 5:14 pm
by thefoof
Just to explain my script, if the spell that was cast not named either "Mend" or "Mend II", then the MinVal and MaxVal variables get changed into the correct values based on percentage. If not then the values are exactly as passed to the script.
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 5:20 pm
by Dello0000
Yeah that kind of makes sense lol. Its probably a good idea that your doing it and not me tho
Wont you need the code in there to make it randomize the min / max values tho?
Re: Help - Percentage.
Posted: Fri Jun 13, 2014 5:22 pm
by thefoof
Dello0000 wrote:Yeah that kind of makes sense lol. Its probably a good idea that your doing it and not me tho
Wont you need the code in there to make it randomize the min / max values tho?
The server takes care of that, you have the option of leaving the max val as 0 which was just left in to keep backwards compatibility with old scripts. But if you give it the min and max values then the server will do the roll for you.
Re: Help - Percentage.
Posted: Sat Jun 14, 2014 3:20 am
by Dello0000
Oh ok, well that might be useful for later use lol.
So, for the spell its self, it occurs to that we would we need something like:
(heal) Min Max and cure, followed by your new call for spell name code and if its Mend III, IV or V follow that by the percent based heal and cure?
We will need both types of heal in the script for this to function under both conditions for both types of heals.