Jump to content
  • 0

Question

Posted

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;
}

 

2 answers to this question

Recommended Posts

Posted

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 ;

    

}

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