Page 1 of 2

[Resolved] SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Fri Dec 04, 2009 9:07 am
by bolly
Hey all,

Trying to do a buff here with: SetMaxHP(Target, GetMaxHP(Target) + 50)

But it's not updating straight away so i'm having fun trying to figure out if it's working or not. Is there a way of having this operate similar to how mana updates when casting, giving an immediate update on the character profile sheet?

Here's my entire script incase you notice anything (it has quite a long duration etc in the db as you'd expect for a buff)

Code: Select all

--[[
	This is the EQ2Emu generic spell damage script written in LUA.
	These functions are shared, so don't save any character data in them.
	If you have any questions be sure to read the readme.txt file located in this directory
--]]

--main process function
function cast(Caster, Target, DamageType, Damage)
	SetMaxHP(Target, GetMaxHP(Target) + 50)
end

function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)

end

function remove(Caster, Target)
	SetMaxHP(Target, GetMaxHP(Target) - 50)
end

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Fri Dec 04, 2009 6:56 pm
by Zcoretri
Well I was told a long time ago that you can't do it that way, otherwise I would have made Buff spells already.

I have been waiting patiently for server support for Spells (excluding damage type spells that already work), also been trying to learn how to code it my self, but I need MUCHO help in that regard :cry:

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sat Dec 05, 2009 1:43 pm
by John Adams
Zcoretri wrote:I have been waiting patiently for server support for Spells
Yes, Zcoretri has waited almost a calendar year now for spells enhancements - and hopefully once LE is done maximizing his brain, the TODO list I made will continue (including Spells).

That said, I have asked repeatedly what exactly LE needs to implement, and I don't think I've ever gotten a reply. We'll split this delay 50/50 then ;)

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sat Dec 05, 2009 3:34 pm
by bolly
yeah it's no worries, i just figured i could get going whatever was in there at the moment and it does help inform you guys what might not be working right

atm players want loot (got working with summonitem()), things to wear (seem to be working great) and spells (heal, dd, dot working) and then things to stab along the way (goes without saying)!

atm its pretty functional if you can have a regular reboot to workaround some unknown issues. I guess death is a major problem as far as loot vanishing but i've seen some players just ignore it and carry on till they ding/zone

all in all, really happy and would love to get buffs going to pop the cherry on the top till beta comes!

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sat Dec 05, 2009 7:32 pm
by LethalEncounter
Are you having problems with the loot system that was implemented? You shouldn't need to use summonitem.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sat Dec 05, 2009 7:34 pm
by John Adams
I am still bewildered that people are "playing" on an Alpha emulator, with any expectations whatsoever...

Happy, yes... but a little surprised.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sat Dec 05, 2009 7:57 pm
by LethalEncounter
bolly wrote:Hey all,

Trying to do a buff here with: SetMaxHP(Target, GetMaxHP(Target) + 50)

But it's not updating straight away so i'm having fun trying to figure out if it's working or not. Is there a way of having this operate similar to how mana updates when casting, giving an immediate update on the character profile sheet?

Here's my entire script incase you notice anything (it has quite a long duration etc in the db as you'd expect for a buff)

Code: Select all

--[[
	This is the EQ2Emu generic spell damage script written in LUA.
	These functions are shared, so don't save any character data in them.
	If you have any questions be sure to read the readme.txt file located in this directory
--]]

--main process function
function cast(Caster, Target, DamageType, Damage)
	SetMaxHP(Target, GetMaxHP(Target) + 50)
end

function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)

end

function remove(Caster, Target)
	SetMaxHP(Target, GetMaxHP(Target) - 50)
end

If your spell's duration is set then it should work. If the spells duration is greater than 0 it show apply the icon to the casters maintained spells list as well as the targets active spell list. I might need to make some tweeks here and there, but the buff system should work right now at least as far as I can remember (it has been a while). Could you guys try it out and see if it is working and if not, what isn't working? I know I need to handle the right click cancel option, but please let me know other than that.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 1:09 am
by bolly
Just to confirm the spell appears fine and casts etc and the buff icon appears, it's more down to the hp change that's the issue. The duration1 and 2 atm are set at 100 to give it a quick whirl and no change appears to occur immediately. I zoned to try to see if it was a packet not being sent (which is how we found the bug with the hp and power being swapped) - just waiting on the svn to push over at 11 gmt then I can give you some more info hopefully!

i guess my spell tables entries could be of use, i don't understand the use of all the fields yet so if i missed something (which wouldn't be a suprise!) then forgive me!

Code: Select all

INSERT INTO `spells` (`id`,`type`,`cast_type`,`name`,`description`,`icon`,`icon2`,`icontype`,`class_skill`,`mastery_skill`,`min_class_skill_req`,`duration_until_cancel`,`target_type`,`success_message`,`fade_message`,`interruptable`,`lua_script`,`spell_visual`,`effect_message`,`spell_book_type`,`can_effect_raid`,`affect_only_group_members`,`display_spell_tier`,`friendly_spell`,`group_spell`,`is_active`) VALUES 
 (12,2,0,'Flaming Embrace','Raises your base HP by 200',274,13,65535,0,0,0,0,0,'You are smothered in lava','',1,'flamingembrace.lua',154,'%t is surrounded by a living shield of lava!',256,0,0,0,1,0,0);

INSERT INTO `spell_tiers` (`id`,`spell_id`,`tier`,`hp_req`,`hp_req_percent`,`hp_upkeep`,`power_req`,`power_req_percent`,`power_upkeep`,`req_concentration`,`cast_time`,`recovery`,`recast`,`radius`,`max_aoe_targets`,`min_range`,`range`,`duration1`,`duration2`,`resistibility`,`hit_bonus`,`call_frequency`,`unknown9`) VALUES 
 (13,12,1,0,0,0,50,0,0,0,200,50,3,0,0,0,35,100,100,0,0,10,0);

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 1:30 am
by bolly
John Adams wrote:I am still bewildered that people are "playing" on an Alpha emulator, with any expectations whatsoever...

Happy, yes... but a little surprised.
I was in Vanguard Beta... this is tame!

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 9:23 am
by John Adams
I know there is also some horrid 5 second+ delay from the World bumping your health to the client seeing it (or at least there used to be). Could that be your problem? You buff, but don't immediately see the HP increase?

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 9:31 am
by bolly
bumped the duration to 30 secs and nope no hp increase

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 12:15 pm
by LethalEncounter
I see the problem, it IS increasing your HP for a split second and then it is reverting back to normal whenever bonuses are calculated. What I am going to need to do is change some things around. I'm going to need the following:

1. I'll add AddSpellBonus(Spawn, type, value) and RemoveSpellBonus(Spawn) that when called in the spells cast and remove functions will cause the bonuses for that spell to be added or removed as appropriate. Since the bonuses will stick around until removed, you could do things like give someone extra HP or str/sta/etc until they zoned by creating a spell that had a zero duration so it didn't appear on their spell lists and in the spells cast function call the AddSpellBonuses function but not call the RemoveSpellBonuses function in the spell's remove function. Whenever they zoned, only the spell effects that were on them at that time would be applied. Alternatively you could do traditional buffs by calling the AddSpellBonus/RemoveSpellBonus functions from the cast/remove functions.

2. This next one would be for permanently changing someones stats - I'll add new functions with Base on the end for all the SetAgi/Str/HP/etc functions to set the BASE value for that field. IE SetMaxHPBase would set the base value for the players Max HP. The existing SetAgi/Str/HP/etc functions will be changed to set the bonus system I mentioned in number 1 above. Just remember that if you don't set the base or give them a spell that appears in their spell effect window, the values will be reverted when they zone.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 3:49 pm
by LethalEncounter
OK, I have your script working just as you have it now without any modifications, but I wanted to show you some examples of the new AddSpellBonus command as well:

Code: Select all

function cast(Caster, Target, DamageType, Damage)
   AddSpellBonus(Target, 203, 5)
end

function remove(Caster, Target)
   RemoveSpellBonus(Target)
end
This will add 5 to the characters heat resistance and then remove it when the spell wears off. If I wanted it to last until the player zoned I could have removed the RemoveSpellBonus(Target) from the remove function. You can add as many bonuses as you want, but the RemoveSpellBonus(Target) will remove all of them when it is removed. Where do you get the 203 you might ask? Open Items.h and look for ITEM_STAT_VS_HEAT. You will notice that it is defined as 203. The only values currently enabled are Sta, Sta, Agi, Wis, Int, Slash, Crush, Pierce, Heat, Cold, Magic, Mental, Divine, Disease, Poison, Health, Power, and Concentration. Others can be added when needed.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 4:19 pm
by LethalEncounter
kk bolly, could you grab the latest and give it a try? I went ahead and uploaded it to public svn.

Re: SetMaxHP(Target, GetMaxHP(Target) + 50)

Posted: Sun Dec 06, 2009 6:27 pm
by bolly
woot!!!!!! *checks out immediately*