Help - Percentage.
Moderator: Team Members
-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Help - Percentage.
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.
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.
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
- Zcoretri
- Team Member
- Posts: 1642
- Joined: Fri Jul 27, 2007 12:55 pm
- Location: SoCal
Re: Help - Percentage.
Its just a matter of getting the Max Health of the target and multiplying it with the percent value.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.
Maybe something like this?
Code: Select all
CurrentHP = GetMaxHP(Target)
MinHeal = CurrentHP * (MinVal / 100)
MaxHeal = CurrentHP * (MaxVal / 100)
SpellHeal("Heal", MinHeal, MaxHeal)-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
Ill give that a try once the servers working again thanks.Zcoretri wrote:Maybe something like this?Code: Select all
CurrentHP = GetMaxHP(Target) MinHeal = CurrentHP * (MinVal / 100) MaxHeal = CurrentHP * (MaxVal / 100) SpellHeal("Heal", MinHeal, MaxHeal)
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
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
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.
Can someone do that for me or tell me how to do it myself? thanks.
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
- thefoof
- Retired
- Posts: 630
- Joined: Wed Nov 07, 2012 7:36 pm
- Location: Florida
Re: Help - Percentage.
Can you explain what you're trying to do here? I can probably help just want to know why you need it first.Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
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'sthefoof wrote:Can you explain what you're trying to do here? I can probably help just want to know why you need it first.Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
Unless we can marry the x to x heal with a percent heal but im sure that wouldn't work.
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
- thefoof
- Retired
- Posts: 630
- Joined: Wed Nov 07, 2012 7:36 pm
- Location: Florida
Re: Help - Percentage.
How about I just add a function so you can get the spell name and check it?Dello0000 wrote: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'sthefoof wrote:Can you explain what you're trying to do here? I can probably help just want to know why you need it first.Dello0000 wrote:Having one lua for the skill wont apply because after the first two they move to a different function.
Unless we can marry the x to x heal with a percent heal but im sure that wouldn't work.
- thefoof
- Retired
- Posts: 630
- Joined: Wed Nov 07, 2012 7:36 pm
- Location: Florida
Re: Help - Percentage.
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-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
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]
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.
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" thenI cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
- thefoof
- Retired
- Posts: 630
- Joined: Wed Nov 07, 2012 7:36 pm
- Location: Florida
Re: Help - Percentage.
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.
-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
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?
Wont you need the code in there to make it randomize the min / max values tho?
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
- thefoof
- Retired
- Posts: 630
- Joined: Wed Nov 07, 2012 7:36 pm
- Location: Florida
Re: Help - Percentage.
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.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?
-
Dello0000
- Posts: 175
- Joined: Fri May 30, 2014 9:18 am
- EQ2Emu Server: MHM Laneth
- Characters: Dello - Dellos
- Location: Scotland!
- Contact:
Re: Help - Percentage.
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.
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.
I cant see it killing the server but it may have an incorrect tooltip. Muhahaha 
Who is online
Users browsing this forum: No registered users and 0 guests