Page 1 of 2
Auto Regen / Refresh
Posted: Mon Nov 12, 2012 7:06 am
by hakusho
Hello everyone,
I'm new to the community and just built my own private server with some basic tweaks (thanks to the very comprehensive wiki!) to complement soloing and duoing.
In order to avoid constant downtime or deaths I was thinking about implementing a potent regen / refresh status that ideally would constantly be active or at least had a very, very long duration.
The problem is, I have absolutely no idea how I could pull this off.
I found the lua scripts for regen and refresh and I suppose I could modify the hp/mp values and duration to my liking but I'm not entirely sure how I would trigger these spell effects without having to actually casting them (like talking to certain NPCs to activate the effects or even something that doesn't require much travelling).
I hope this request is not too much of an inconvenience. Even pointing me in the right direction would be appreciated.
Re: Auto Regen / Refresh
Posted: Mon Nov 12, 2012 7:58 am
by whasf
so you want some sort of permanent status effect?
Re: Auto Regen / Refresh
Posted: Mon Nov 12, 2012 8:09 am
by hakusho
If possible, yes. Ideally I'd want this effect applied to players as soon as they log on to the server for the first time or by turning in the Adv. Coupon.
Like I said, I'd also settle for a way to apply the effects to players with a very long status effect duration.
Thanks for taking the time to reply, whasf!
Re: Auto Regen / Refresh
Posted: Mon Nov 12, 2012 12:46 pm
by whasf
I don't think there's anything right now that does something like that. My only suggestion is to look at the statusEffectContainer class and see if you can code something up.
Re: Auto Regen / Refresh
Posted: Mon Nov 12, 2012 1:31 pm
by bluekirby0
You can figure out a trigger for yourself, but applying any status effect with a duration of 0 should make it last indefinitely. From there you have 2 options: Alter the flags in the database so the effect works like signet (basically it never wears off regardless of zoning/death/taxes
etc) or make it trigger on something that is in every combat zone in the game (i.e. Goblin Footprint)
Re: Auto Regen / Refresh
Posted: Mon Nov 12, 2012 3:47 pm
by hakusho
I had an idea.
The easiest way to get the effect of Regen without casting the spell is drinking a jug of Selbina Milk.
To make the effect more potent I edited the value and this is what it looks like now:
Code: Select all
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
if(target:hasStatusEffect(EFFECT_REGEN) == false) then
target:addStatusEffect(EFFECT_REGEN,30,3,86400);
else
target:messageBasic(423);
end
end;
Now I'm not sure if there is an actual limit to the duration value so I just converted the lenght of a day to seconds. Would 0 work here to make the effect last indefinitely?
It would also be more convenient to use an item that is stackable to 99 but this will do for now.
Next I'll have to see if it works for Refresh but it shouldn't be a problem if I apply the same logic to it.
Any thoughts on how i could improve this? I like the Signet flag idea but I don't know how I would pull this off. I'm still very new to all this so a little hint would be appreciated.
Thanks for the input guys!
/edit: Since food doesn't stack, would it be possible to apply Regen and Refresh by consuming only one food item? If so, how would the syntax look like? Can I just paste the Refresh lines under the second to last "end"?
/edit2: I figured it out. I just added the following line:
Code: Select all
target:addStatusEffect(EFFECT_REFRESH,30,3,86400);
I feel stupid for even asking about this topic in the first place, now that I've figured it out. It probably was too obvious...
Re: Auto Regen / Refresh
Posted: Tue Nov 13, 2012 2:00 pm
by kjLotus
hakusho wrote:Now I'm not sure if there is an actual limit to the duration value so I just converted the lenght of a day to seconds. Would 0 work here to make the effect last indefinitely?
ya
alternatively you can add some lines in traits.sql to give every job permanent auto-regen/refresh
Re: Auto Regen / Refresh
Posted: Wed Nov 14, 2012 3:09 pm
by hakusho
I took a peek in the traits SQL table but didn't know what I was supposed to edit or add so I just set the Selbina Milk duration to 0.
Thanks for all your inputs, guys!
Re: Auto Regen / Refresh
Posted: Mon Nov 19, 2012 4:50 am
by mvd1987
there is a easyer way like i did.
just make the regen and refresh on the fov fieldsupport to last for ever or for a long time like i did.
players can always go to the fov to get refresh and regen.
tabs are easy to get and when you set the tab rate high enough they can always get regen and refresh.
and you can change how much a tic it gives on hp and mp.
greetings michael
Re: Auto Regen / Refresh
Posted: Wed Nov 21, 2012 2:55 am
by Vicrelant
back on this topic is there anything for when the player equips a piece of armor that has refresh and or regen on it?
OnItemCheck and OnItemUse
These two do not work this clause; suggestions on how this would work would be great!
Here is what i did find for LUA but this also does not do what it says.
Code: Select all
function OnItemCheck(target)
if (target:getEquipID(SLOT_HEAD) == 11811) then
target:addStatusEffectEx(EFFECT_AUTO_REFRESH,0,1,3,0,11811);
target:addStatusEffectEx(EFFECT_AUTO_REGEN,0,1,3,0,11811);
else
target:delStatusEffect(EFFECT_AUTO_REFRESH,0,1,3,0,11811);
target:delStatusEffect(EFFECT_AUTO_REGEN,11811);
end
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
end;
-----------------------------------
-- onEffectTick Action
-----------------------------------
function onEffectTick(target,effect)
target:addHP(effect:getPower());
target:addMP(effect:getPower());
end;
Thanks!