Jump to content
  • 0

Whispering NPC: Full info inside


xienne15

Question


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

Hello again!~

I want to request a npc that when you whisper it will do revive to the whisperer when he got apple in his/her inventory(only checks not delete if has apple)

-    script    apple    -1,{
 

Messages:
No apple whisperer: You need to have an apple in your inventory.

end;

With apple whisperer but not dead: You don't require resurrection at this moment.

end;

with apple whisperer but dead: Your Acolytes are now praying in Prontera, please wait 10 seconds for the final judgement.

sleep2:10000

#revive the "whisperer with apple but dead"

And NPC will say "You have #amount of revive left for this hour") ///maximum of 3 revive per hour


The
NPC will only revive 3x per hour, so if the player with apple used all
the revive in less than hour, the player will not be able to get
resurrected
and the npc will say "You can only be revived 3x every hour.



Every successful revive the npc will say You only have " #number of available resurrection" left.
 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

-	script	apple	-1,{

OnWhisperGlobal:

set .@item_id, 512; // Apple

if (countitem(.@item_id)) {

if (Hp) {

dispbottom "You don't require resurrection at this moment.";

} else {

set .@count, callsub(S_getrevivecount);

// if they have less than 3 revives this hour

if (.@count < 3) {

callsub S_setrevivecount, .@count +1;

dispbottom "Your Acolytes are now praying in Prontera, please wait 10 seconds for the final judgement.";

sleep2 10000;

recovery 0;

dispbottom "You have "+(3 - (.@count+1))+" revives left for this hour.";

} else {

dispbottom "You can only be revived 3x every hour.";

}

}

} else {

dispbottom "You need to have a "+getitemname(.@item_id)+" in your inventory.";

}

end;

S_getrevivecount:

set .@now_hour, atoi(gettimestr("%y%m%d%H",9)); // YYMMDDHH

if (atoi(delchar(revive+"",8)) < .@now_hour)

return 0; // if their last revive was not this hour, then they have used 0 revives this hour

else

return atoi(charat(revive+"",8));

S_setrevivecount:

set revive, atoi(gettimestr("%y%m%d%H",9) + getarg(0));

return;

}

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

-	script	apple	-1,{
OnWhisperGlobal:
	set .@item_id, 512; // Apple
	
	if (countitem(.@item_id)) {
		if (Hp) {
			dispbottom "You don't require resurrection at this moment.";
		} else {
			set .@count, callsub(S_getrevivecount);
			// if they have less than 3 revives this hour
			if (.@count < 3) {
				callsub S_setrevivecount, .@count +1;
				dispbottom "Your Acolytes are now praying in Prontera, please wait 10 seconds for the final judgement.";
				sleep2 10000;
				recovery 0;
				dispbottom "You have "+(3 - (.@count+1))+" revives left for this hour.";
			} else {
				dispbottom "You can only be revived 3x every hour.";
			}
		}
	} else {
		dispbottom "You need to have a "+getitemname(.@item_id)+" in your inventory.";
	}
	end;


S_getrevivecount:
	set .@now_hour, atoi(gettimestr("%y%m%d%H",9)); // YYMMDDHH
	if (atoi(delchar(revive+"",8)) < .@now_hour)
		return 0; // if their last revive was not this hour, then they have used 0 revives this hour
	else
		return atoi(charat(revive+"",8));
S_setrevivecount:
	set revive, atoi(gettimestr("%y%m%d%H",9) + getarg(0));
	return;
}

Thanks~ but i am having error on line 15 saying

 

parse_line: need ';'

 

line 15:

				recovery 0;

it says

recovery '0';

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

recovery is update since r17321

a trick to replace this one

-     recovery 0;
+     getmapxy .@map$, .@x, .@y, 0;
+     warp .@map$, .@x, .@y;
+     percentheal 100,100;
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

Thanks~

 

Can i add something? like when i whisper the npc it will say

dispbottom "Do you want to be revive?";

whisper "YES" =

recovery 0;

whisper "NO" =

dispbottom "Take care~.";
end;
Edited by xienne15
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


if (.@count < 3) {

+ if ( select( "Revive", "Leave" ) == 2 ) {

+ dispbottom "Take care~.";

+ end;

+ }

callsub S_setrevivecount, .@count +1;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

Thank you~

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