Jump to content
  • 0
Sign in to follow this  
Begin

Modify reward script

Question

Hi All,
May I request for a Hourly Point NPC with a Target Hours before you get the reward?
There is a menu with Start, Stop and Pause button for logging out/offline purpose.
I already tried my best to edit a hourlypoint script but I failed.
Thanks in advance!

---Solved. Already found it. Sorry for not patiently testing all the topics that I saw.


Hi All,

Can you help me edit this script? Need to change the settings. You must not get the reward once you talked. You must only get the reward if you only reached the target time.

In the photo attached, I talked to NPC in the first time and the NPC already gave the reward. I want if possible, you will only get the reward when you stayed online for 5 hours straight without logging out/disconnect/offline.

Also a menu with Start, Stop and Pause for a player if he will logout of the game.

Thank you.

reward.PNG

 

prontera,155,160,5	script	Reward NPC	4_F_FAIRYKID4,{
	.@npc_name$ = "[P NPC]";
	for (.@i = 0; .@i < getarraysize($ip_reward$); .@i+=2) {
		if ($ip_reward$[.@i] != getcharip()) continue;
		.@delays = atoi($ip_reward$[.@i+1]) + .delay;
		if (.@delays > gettimetick(2)) {
			mes .@npc_name$;
			mes "Do you want a surprise item from me?";
			mes "You have to wait for "+callfunc("Time2Str", .@delays);
			mes "To claim the reward!";
			close;
		}
		.@index = .@i+1;
		break;
	}
	mes .@npc_name$;
	mes "Hello "+strcharinfo(0)+",I";
	mes "am here to give you a daily";
	mes "Surprise Reward. Do you want to have it?";
	next;
	switch (select("-Yes, sure!:-No, bye!:-Cancel")) {
		case 1:
			mes .@npc_name$;
			for (.@j = 0; .@j < getarraysize(.reward); .@j+=2)
				getitem .reward[.@j], .reward[.@j+1];
			mes "Okay have fun with it!";
			if (.@index) $ip_reward$[.@index] = gettimetick(2);
			else {
				.@index = getarraysize($ip_reward$);
				$ip_reward$[.@index] = getcharip();
				$ip_reward$[.@index+1] = gettimetick(2);
			}
			close;
		default:
			mes .@npc_name$;
			mes "Okay goodbye!";
			close;
	}

OnInit:
	setarray .reward, 601, 1; // <item id>, <item amount>{, <item id>, <item amount>,...}
	.delay = 60; // Delay time before reward can be re-claimed. time set in second, default 24 Hours = 86400 seconds
	end;
}

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

what's the point of Pause button if when you say you will only get the reward when you stayed online for 5 hours straight without logging out/disconnect/offline ?

Share this post


Link to post
Share on other sites
  • 0

Ahh, you're right Ms. Annie. Pause must be excluded. Do you think Stop must be included in the script? Because the event will only trigger when you select the Start option.

I think an end or stop on the timer when you get the reward will do. You can only do the event/talk to NPC 1x a day not every after you complete 5 hours.

Thank you.

 

Anyone? :(

Share this post


Link to post
Share on other sites
  • 0

You should use the @ variable if you want them to be online the whole time, because it is cleared when a player logs out.

So e.g. @Reward = gettimetick(2); this value will only exist so long as they don't log out.

Share this post


Link to post
Share on other sites
  • 0

@Begin

prontera,155,180,5	script	Reward NPC	4_F_FAIRYKID4,{
//	$ip_reward_daytime = 0;
	mes "["+ strnpcinfo(NPC_NAME) +"]";
	if ( $ip_reward_daytime != atoi( gettimestr("%Y%m%d", 20 ) ) ) {
		$ip_reward_daytime = atoi( gettimestr("%Y%m%d", 20 ) );
		deletearray $ip_reward$;
	}
	.@size = getarraysize( $ip_reward$ );
	while ( getcharip() != $ip_reward$[.@i] && .@i < .@size ) { ++.@i; }
	if ( .@i < .@size ) {
		mes "You have claimed the reward with this IP address.";
		close;
	}
	if ( @ip_reward && @ip_reward + .countdown <= gettimetick(2) ) {
		mes "Here is the surprise reward";
		getitem Poring_Coin, 1;
		$ip_reward$[ getarraysize( $ip_reward$ ) ] = getcharip();
		close;
	}
	if ( @ip_reward ) {
		mes "Countdown timer...";
		.@timeleft = @ip_reward + .countdown - gettimetick(2);
		mes .@timeleft /3600 +" hour "+ .@timeleft %3600/60 +" min "+ .@timeleft %60 +" sec left";
		close;
	}
	mes "Hello "+ strcharinfo(PC_NAME) +", I am here to give you a daily Surprise Reward. Do you want to have it?";
	next;
	select "Yes, sure !!";
	mes "["+ strnpcinfo(NPC_NAME) +"]";
	mes "You can claim the reward in 5 hours time.";
	close2;
	addtimer .countdown *1000, strnpcinfo(NPC_NAME) +"::OnClaimReward";
	@ip_reward = gettimetick(2);
	end;
OnClaimReward:
	dispbottom "You can claim Daily Login Reward now.";
	end;
OnInit:
	.countdown = 5*60*60; // 5 hours
//	.countdown = 5;
}

Share this post


Link to post
Share on other sites
  • 0

Hello Ms. Annie! It works nicely! I just want to ask something because I can't read those codes.

Is this the the lines that is needed before you can do the quest again?

	if ( $ip_reward_daytime != atoi( gettimestr("%Y%m%d", 20 ) ) ) {
		$ip_reward_daytime = atoi( gettimestr("%Y%m%d", 20 ) );
		deletearray $ip_reward$;
	}

Can you also add a message that "You need to wait 5 hours (24hrs cooldown after your complete the quest) hours before talking to me again"

Sorry for asking for more Ms. Annie. I already satisfied with the script you've provided if the additional message is not possible.

Thank you very much.

Edited by Begin

Share this post


Link to post
Share on other sites
  • 0

that line was ....

On 5/22/2018 at 0:16 AM, Begin said:

You can only do the event/talk to NPC 1x a day not every after you complete 5 hours.

and you suddenly say you want it can redo every 5 hours

make your stand ...
1. you want it to do every 5 hours (5 hours counting + 5 hours cooldown) ...
 -- OR --
2. you want it to do 1x per day (reset at 12am ... which was done in the way your posted lines)

 

EDIT: yeah I did it as a daily ...

Share this post


Link to post
Share on other sites
  • 0

@Begin
the script was already done with reset at 12am every day

however due to the information that meko said ...
I'm going to revise this script ...

prontera,155,180,5	script	Reward NPC	4_F_FAIRYKID4,{
	.@date = atoi( gettimestr("%Y%m%d", 20 ) );
	mes "["+ strnpcinfo(NPC_NAME) +"]";
	if ( #reward_daytime == .@date ) {
		mes "You have claimed the reward today.";
		close;
	}
	if ( @reward_timestamp && @reward_timestamp + .countdown <= gettimetick(2) ) {
		mes "Here is the surprise reward";
		getitembound Poring_Coin, 1, 1;
		#reward_daytime = .@date;
		close;
	}
	if ( @reward_timestamp ) {
		mes "Countdown timer...";
		.@timeleft = @reward_timestamp + .countdown - gettimetick(2);
		mes .@timeleft /3600 +" hour "+ .@timeleft %3600/60 +" min "+ .@timeleft %60 +" sec left";
		close;
	}
	mes "Hello "+ strcharinfo(PC_NAME) +", I am here to give you a daily Surprise Reward. Do you want to have it?";
	next;
	select "Yes, sure !!";
	mes "["+ strnpcinfo(NPC_NAME) +"]";
	mes "You can claim the reward in 5 hours time.";
	close2;
	addtimer .countdown *1000, strnpcinfo(NPC_NAME) +"::OnClaimReward";
	@reward_timestamp = gettimetick(2);
	end;
OnClaimReward:
	dispbottom "You can claim Daily Login Reward now.";
	end;
OnInit:
//	.countdown = 5*60*60; // 5 hours
	.countdown = 5;
}

no longer use IP address, but use account bound items
so that means, this script will give out the reward every day, reset on 12am, and the item give out is account bound
.... probably the better way for not abuse the reward than the script I posted earlier

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.