Auto Regen / Refresh

hakusho
Posts: 49
Joined: Wed Nov 07, 2012 1:01 pm

Auto Regen / Refresh

Post by hakusho » Mon Nov 12, 2012 7:06 am

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.

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Auto Regen / Refresh

Post by whasf » Mon Nov 12, 2012 7:58 am

so you want some sort of permanent status effect?
-- Whasf

hakusho
Posts: 49
Joined: Wed Nov 07, 2012 1:01 pm

Re: Auto Regen / Refresh

Post by hakusho » Mon Nov 12, 2012 8:09 am

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!

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Auto Regen / Refresh

Post by whasf » Mon Nov 12, 2012 12:46 pm

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.
-- Whasf

bluekirby0
Developer
Posts: 707
Joined: Sun Jul 22, 2012 12:11 am

Re: Auto Regen / Refresh

Post by bluekirby0 » Mon Nov 12, 2012 1:31 pm

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 :P etc) or make it trigger on something that is in every combat zone in the game (i.e. Goblin Footprint)

hakusho
Posts: 49
Joined: Wed Nov 07, 2012 1:01 pm

Re: Auto Regen / Refresh

Post by hakusho » Mon Nov 12, 2012 3:47 pm

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...

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Auto Regen / Refresh

Post by kjLotus » Tue Nov 13, 2012 2:00 pm

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

hakusho
Posts: 49
Joined: Wed Nov 07, 2012 1:01 pm

Re: Auto Regen / Refresh

Post by hakusho » Wed Nov 14, 2012 3:09 pm

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!

mvd1987
Posts: 112
Joined: Wed Oct 17, 2012 8:36 am

Re: Auto Regen / Refresh

Post by mvd1987 » Mon Nov 19, 2012 4:50 am

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
Owner/GMLeader mvd1987/michaelvandun Fantasy World International Server

Vicrelant
Posts: 7
Joined: Sun Nov 11, 2012 5:03 pm

Re: Auto Regen / Refresh

Post by Vicrelant » Wed Nov 21, 2012 2:55 am

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!

Post Reply