Jump to content
  • 0

Heal Delay


jayriku12

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   0
  • Joined:  06/25/12
  • Last Seen:  

How can i make the NPC have a delay when players get hp and/or sp?

 

 

//===== eAthena Script =======================================

//= Healer Script (/w payments)
//===== By: ==================================================
//= Yor & abunch of other people
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
//= Any Athena Version
//===== Description: =========================================
//= NPC heals/regenerates people against zenys
//===== Additional Comments: =================================
//= alternative dog with payment.
//= each HP need 1 zeny
//= each SP need (baselevel / 5) zenys
//= calculation is done at start of the script
//= Added Duplicates And Correct payon Loc [Darkchild]
//= Some modifications. Added NPC locations. [massdriller]
//= Removed Duplicates [silent]
//============================================================
 
- script ::Healer2 -1,{
set @tempHp, MaxHp-Hp;
set @tempSpReal, MaxSp-Sp;
set @tempSp, ((MaxSp-Sp) * BaseLevel) / 5;
if (@tempHp > 0) goto WOUNDED;
if (@tempSpReal > 0) goto ONLY_REGENERATION;
 
mes "[Healer]";
mes "Oh?";
mes "You do not look like a person in pain.";
close;
 
WOUNDED:
if (@tempSp > 0) goto WITH_REGENERATION;
mes "[Healer]";
mes "Oh dear, you look really hurt,";
mes "I can cure you for: "+@tempHp+" z)";
mes "Do you want me to cure you?";
next;
menu "Healings ("+@tempHp+"z)",HEALINGS,"No, thanks",CANCEL;
 
WITH_REGENERATION:
mes "[Healer]";
mes "Do you want only your HP to be healed? ("+@tempHp+" z)";
mes "Do you want only your SP to be healed? ("+@tempSp+" z)?";
mes "Or Would you like both? ("+(@tempHp+@tempSp)+" z)";
next;
menu "Only HP ("+@tempHp+"z)",HEALINGS,"Only SP ("+@tempSp+"z)",REGENERATION,"Both HP & SP ("+(@tempHp+@tempSp)+"z)",HEALINGS_AND_REGEN,"Nothing, thanks",CANCEL;
 
ONLY_REGENERATION:
mes "[Healer]";
mes "So, you only want your SP to heal? ("+@tempSp+" z)";
mes "I need to make a living...";
next;
menu "Regeneration ("+@tempSp+"z)",REGENERATION,"No, thanks",CANCEL;
 
HEALINGS:
if (Zeny < @tempHp) goto NO_ZENYS;
set Zeny, Zeny-@tempHp;
heal @tempHp,0;
goto FIN;
 
REGENERATION:
if (Zeny < @tempSp) goto NO_ZENYS;
set Zeny, Zeny-@tempSp;
heal 0,@tempSpReal;
goto FIN;
 
HEALINGS_AND_REGEN:
if (Zeny < (@tempHp+@tempSp)) goto NO_ZENYS;
set Zeny, Zeny-(@tempHp+@tempSp);
heal @tempHp,@tempSpReal;
goto FIN;
 
NO_ZENYS:
mes "[Healer]";
mes "Oh dear, you don't look like you have enough zeny.";
mes "Sorry, i can't help you.";
close;
 
FIN:
mes "[Healer]";
mes "You are Completely Healed.";
close;
 
CANCEL:
mes "[Healer]";
mes "Allright. Please come again if you need anything.";
close;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

There is no need to use that Variable for getting character HP & SP, you should use a NPC scope variable. (.@)

The script command Sleep2 (milliseconds) should allow the healer to delay healing for a certain time frame.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  71
  • Reputation:   25
  • Joined:  11/23/11
  • Last Seen:  

What question do I have to use to replace this one?

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



    set .@delay, 5 * 60;    // delay (seconds).



    set .@t0, gettimetick ( 2 ) - delay;

    set .@t1, .@delay - .@t0;

    if ( .@t < .@delay )

        mes "You have to wait "+ .@t1 +" seconds before heal again";

    else

    {

        if ( HP + SP == MaxHP + MaxSP )

            mes "You do not look like a person in pain.";

        else

        {

            while ( .@i < 3 )

            {

                set .@hp, MaxHP - HP;

                set .@sp, ((MaxSP - SP) * BaseLevel) / 5;

                set .@cost, .@hp + .@sp;

                if ( .@hp > 0 )

                    mes "Heal price: ^ff0000"+ .@hp +"^000000 z";

                if ( .@sp > 0 )

                    mes "SP Restoration price: ^0000ff"+ .@sp +"^000000 z";

                if ( .@cost > .@hp || .@cost > .@sp )

                    mes "Both: ^00ff00"+ .@cost +"^000000 z";

                next ;

                set .@i, select ( ( (.@hp > 0) ? ( (.@o & 1) ? "^00ff00" : "^ff0000")Heal" ? "" ) +":"+ ( (.@sp > 0) ? ( (.@o & 2) ? "^00ff00" : "^ff0000")SP Restoration" ? "" ):Heal ("+ ( (zeny < .@c)?"^ff0000":"^0000ff") + .@c +" zeny):Exit");

                set .@o, .@o | .@i;

                set .@c, ((.@o & 1) * .@hp) + ((.@o&2) * .@sp);

            }

            if ( .@i == 3 )

            {

                if ( zeny < .@c )

                    mes "You don't have enough zeny";

                else

                {

                    percentheal 100 * (.@o & 1), 100 * (.@o & 2);

                    set zeny, zeny - .@c;

                    set delay, gettimetick ( 2 );

                }

            }

        }

    }

    close ;

    

}
Link to comment
Share on other sites

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.

×
×
  • Create New...