Jump to content
  • 0

Healer with timer


Question

Posted

Greetings!

I'm requesting a healer that'd act as usual, unless the player was level 70 or above. In the event the player is level 70 or above, it'd only do a 100% HP and SP every 5 minutes. If the player is below level 70, it'd be just a regular healer.

Thanks in advance.

11 answers to this question

Recommended Posts

Posted
prontera,100,100,4    Healer    100,{

   if ( BaseLevel < 70 || set ( .@t, gettimetick ( 2 ) - heal_delay ) >= (5 * 60) )
   {
       percentheal 100, 100;
       if ( BaseLevel >= 70 )
           set heal_delay, gettimetick ( 2 );
   }
   else
   {
       set .@m, .@t / 60;
       set .@s, .@t % 60;
       dispbottom "Please wait for "+ .@m +" min(s) "+ .@s ? .@s +" seconds" : "";
   }
   end ;

}

Posted (edited)

I tried this, but for some reason it does not work. Yes, I did relocate the NPC.

Thanks for your hardwork regardless.

edit: Ah, I added "script" between the name and the position and now it works. But it doesn't display a chatbox or anything, just says "X seconds." in the regular chat. X being the time since you last used the NPC.

Edited by AndrossiS
Posted

Forget 1 line.

prontera,100,100,4    script    Healer    100,{

   if ( BaseLevel < 70 || set ( .@t, gettimetick ( 2 ) - heal_delay ) >= (5 * 60) )
   {
       percentheal 100, 100;
       if ( BaseLevel >= 70 )
           set heal_delay, gettimetick ( 2 );
   }
   else
   {
       set .@t, (5 * 60) - .@t;
       set .@m, .@t / 60;
       set .@s, .@t % 60;
       dispbottom "Please wait for "+ .@m +" min(s) "+ .@s ? .@s +" seconds" : "";
   }
   end ;

}

  • Upvote 1
Posted (edited)

Hello and thank you for all your help.

The NPC now counts down, but only 60 and downwards. If there's longer than 60 seconds left, it'll just keep looking 60 seconds each minute.

Edited by AndrossiS
Posted

Hmm, i never would have though of using ' set ' in an ( if ) statement.. didn't think the system could proccess that lol. *Keeps an eye on you* I'm looking forward to seeing other things you'll do lol.

@AndrossiS - I really don't see any problem with the script...

Posted

It's not a problem per see. The NPC works wonderfully, if not for the timer. Instead of saying 300 seconds left, it says 60 seconds left, and just does it 5 times.

So players are a bit confused "wait, it said 60 seconds 60 seconds ago! and now it says it again!". But other than that, great job and I'm very thankful.

Posted

Hello and thank you for all your help.

The NPC now counts down, but only 60 and downwards. If there's longer than 60 seconds left, it'll just keep looking 60 seconds each minute.

Yeah, you have to put some brackets.

dispbottom "Please wait for "+ .@m +" min(s) "+ ( (.@s) ? .@s +" seconds" : "");

Hmm, i never would have though of using ' set ' in an ( if ) statement.. didn't think the system could proccess that lol. *Keeps an eye on you* I'm looking forward to seeing other things you'll do lol.

Do not forget that all commands are monitored by a source function, and regardless from what they do, they always have some values as return, most of them are booleans (true, false), another good part is integers or float/double (not in e/rAthena case as those kind of variables are not really implemented).

Posted

@Ryokem - Ahh, I see. That does make a bit more sense. I should have known this was possible since I can already retrieve information in an IF statement, it'd only make sense that the setting information would also be possible, since I can use: ' if( select) ' and the such.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...