Jump to content
  • 0
Yugosh

[ Req ] Npc Reward Player online

Question

master can i req script / npc player online?

ex. player online 1 or 2 hours get this item.

but player online more than 6 hour get this item.

a different reward thanks

sory my bad english :(

Share this post


Link to post
Share on other sites

28 answers to this question

Recommended Posts

  • 0

Has been awhile since I wrote my last script but here it is:

http://pastebin.com/DimazGWd

Haven't tested it though, if any error pops up, just post here and I'll fix it.

 

Hi Pan, just want to ask if the reward will go directly to players inventory? or I still need to create NPC to call the script you made.

Share this post


Link to post
Share on other sites
  • 0

It will go directly.

getitem .item_reward[lrs_prize], .item_reward_qt[lrs_prize];
Any errors just post c:

Share this post


Link to post
Share on other sites
  • 0

Thanks. Can you explain this set .time_lapse,60*60*2; how it works. Sorry I can't test right now, will test later.

 

+1

Edited by Hadeszeus

Share this post


Link to post
Share on other sites
  • 0

It's fairly simple, this variable is measured in seconds, so 60 would be a minute.

60 -> A minute60*60 -> A minute*60 -> A hour60*60*2 -> 2 hours

Share this post


Link to post
Share on other sites
  • 0

Here it is: http://pastebin.com/3RmAGytY

Just change .time_lapse[0], it works exactly the same as before.

setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;
If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c:

 

EDIT:

Don't forget that every time a time_lapse is met the time is set to zero.

setarray .time_lapse[0],60*60*2,60*60*3,0;
A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours.

 

EDIT2:

New version with new config options:

// Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;
Set to false if you want that those players don't receive any prize.

http://pastebin.com/QaGfva8H

Edited by pan

Share this post


Link to post
Share on other sites
  • 0

 

Here it is: http://pastebin.com/3RmAGytY

Just change .time_lapse[0], it works exactly the same as before.

setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;
If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c:

 

EDIT:

Don't forget that every time a time_lapse is met the time is set to zero.

setarray .time_lapse[0],60*60*2,60*60*3,0;
A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours.

Thank you again! I'll test it later and give you feedback.. 

Share this post


Link to post
Share on other sites
  • 0

Sir thank you its working now.. I'll let you know if I find anything unusual. 

 

 

Sir One more thing. Can you please create one timelapse 

 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

 

setarray .time_lapse[0],60*60*2,60*60*3,0;

Edited by Hadeszeus

Share this post


Link to post
Share on other sites
  • 0

If I'm not mistaken:

 

1 minute = 1, and so on for the rest of minutes.

You are absolutely right c:

Sir thank you its working now.. I'll let you know if I find anything unusual. 

 

 

Sir One more thing. Can you please create one timelapse 

 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

 

setarray .time_lapse[0],60*60*2,60*60*3,0;

For 1 minute for first prize and 3 for the second:
setarray .time_lapse, 1, 2, 0;
Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3.
.time_lapse[0]+.time_lapse[1] = REAL time lapse [1]

Share this post


Link to post
Share on other sites
  • 0

 

If I'm not mistaken:

 

1 minute = 1, and so on for the rest of minutes.

You are absolutely right c:

>Sir thank you its working now.. I'll let you know if I find anything unusual. 

 

 

Sir One more thing. Can you please create one timelapse 

 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

 

setarray .time_lapse[0],60*60*2,60*60*3,0;

For 1 minute for first prize and 3 for the second:
setarray .time_lapse, 1, 2, 0;
Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3.
.time_lapse[0]+.time_lapse[1] = REAL time lapse [1]

 

got it! Thank you so much!  :rolleyes:

Share this post


Link to post
Share on other sites
  • 0

Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards.

And can I make reward totally unable to change the owner including dropping, trading and vending.

Edited by PcNy

Share this post


Link to post
Share on other sites
  • 0

You can modify the behavior of the script by using checkvending() or checkidle() if you want not to reward idle players. See how they work here: doc/script_commands.txt#L3797

 

 

*checkvending({"<Player Name>"})
*checkchatting({"<Player Name>"})
 
Checks if the player is vending or in a chatroom.
Name is optional, and defaults to the attached player if omitted.
 
Return values for 'checkvending' are
0 = not vending
1 = normal vending
2 = vending using @autotrade
 
'checkchatting' returns 1 if they are in a chat room, 0 if they are not.
 
Examples:
//This will check if Aaron is vending, and if so, put a message in
//front of the attached player saying Aaron is vending.
if (checkvending("Aaron"))
mes "Aaron is currently vending!";
 
//This will check if the attached player in a chat room or not.
if (checkchatting())
mes "You are currently in a chat room!";
 
---------------------------------------
 
*checkidle({"<Player Name>"})
 
Returns the time, in seconds, that the specified player has been idle.
Name is optional, and defaults to the attached player if omitted.

Share this post


Link to post
Share on other sites
  • 0

try not to use attachnpctimer unnecessary

attachnpctimer I only use them in 1 scenario

which use in botkiller script to kick players which doesn't answer in a certain time period

means, only use in a npc dialog script

 

because if this script already uses attachnpctimer,

if there is other script use attachnpctimer again, the timer wouldn't run anymore

 

 

for this kind of script, I rather use sleep2

http://rathena.org/board/topic/90989-hourly-points-help/?p=238289

Share this post


Link to post
Share on other sites
  • 0

try not to use attachnpctimer unnecessary

attachnpctimer I only use them in 1 scenario

which use in botkiller script to kick players which doesn't answer in a certain time period

means, only use in a npc dialog script

 

because if this script already uses attachnpctimer,

if there is other script use attachnpctimer again, the timer wouldn't run anymore

 

 

for this kind of script, I rather use sleep2

http://rathena.org/board/topic/90989-hourly-points-help/?p=238289

Thank you, I wasn't aware of that.

Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards.

And can I make reward totally unable to change the owner including dropping, trading and vending.

I added new configurations:
// Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;
Set to false if you want that those players don't receive any prize.

http://pastebin.com/aJV6beP8

Share this post


Link to post
Share on other sites
  • 0

lol

		if(    ( checkvending() == 2 && !.autotrade )	// Autotrade			&& ( checkidle() && !.idle )				// Idle			&& ( checkchatting() && !.chat )			// Chat			)			sleep2 1000;		set lrs_passed, lrs_passed+1;		set lrs_passed_total, lrs_passed_total+lrs_passed;
where is the else statement ?

this script means ... if the user is vending/idle/chatroom, the script will just delay execute by 1 sec ..

but still continue to count the variables below

 

the whole things below needs to be inside else { }

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

lol

		if(    ( checkvending() == 2 && !.autotrade )	// Autotrade			&& ( checkidle() && !.idle )				// Idle			&& ( checkchatting() && !.chat )			// Chat			)			sleep2 1000;		set lrs_passed, lrs_passed+1;		set lrs_passed_total, lrs_passed_total+lrs_passed;
where is the else statement ?

this script means ... if the user is vending/idle/chatroom, the script will just delay execute by 1 sec ..

but still continue to count the variables below

 

the whole things below needs to be inside else { }

 

 

Whoops, small mistake lol

http://pastebin.com/QaGfva8H

Share this post


Link to post
Share on other sites
  • 0

Hello everyone,

Based on Annie's notice

 

AnnieRuru, on 02 Feb 2014 - 11:32, said:

try not to use attachnpctimer unnecessary
attachnpctimer I only use them in 1 scenario
which use in botkiller script to kick players which doesn't answer in a certain time period
means, only use in a npc dialog script

because if this script already uses attachnpctimer,
if there is other script use attachnpctimer again, the timer wouldn't run anymore

for this kind of script, I rather use sleep2
http://rathena.org/board/topic/90989-hourly-points-help/?p=238289

 


Consequently, I tried to re-write a script I'm using so it doesn't use the "attachtimer" function but the "sleep" function instead.
Unfortunately it seems It's not as simple as putting "B" instead of "A"
My original script

- script hourlypoints -1,{

OnPCLoginEvent:
announce "You are now listed on the Hourly Reward System.",bc_self;
announce "Remain active for a continuous hour to be rewarded",bc_self;
announce "Being idle for 5 minutes disables your timer.",bc_self;
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;

OnTimer300000: // Check players status every 5 minutes
if( checkvending() || 4 < checkidle() || strcharinfo(3) == "sec_pri" )
{
announce "Your reward has been disabled because you were idle/Vending/Jailed.",bc_self;
announce "Re-log if you want to initiate your timer.",bc_self;
stopnpctimer;
end;
}
end;


OnTimer3600000:
set @minute, @minute + 1; //Check every 1 Minute
if(@minute == 60)
{
//Check if Vending (normal or @at)
if(checkvending() >= 1)
{
announce "Your reward has been disabled because you were vending. Please re-log if you wish to start again.",bc_self;
stopnpctimer;
end;
}
else
{
set @minute,0;
set .@point_amt, 1; //Points to get every hour (default: 1)
getitem 671,.@point_amt;
announce "You received "+.@point_amt+" for being active for a continuous hour.",bc_self;
set @consecutive_hour, @consecutive_hour + 1;
}
}

//Check for 12 hours consecutive
if(@consecutive_hour == 12)
{
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1)
{
announce
"Your reward has been disabled because you were idle. Please re-log if you wish to start again.",bc_self;
stopnpctimer;
end;
}
else
{
set @consecutive_hour,0;
set .@cpoint_amt, 10; //Points to get for 12 Consecutive hours (default: 10)
getitem 671,.@cpoint_amt;
announce "You received extra "+.@cpoint_amt+" for being active for 12 consecutive hours. Keep it up !",bc_self;
}
}
stopnpctimer;
initnpctimer;
end;
}


Can anyone help with the edits, please ?

Thanks :)

Edited by Adam

Share this post


Link to post
Share on other sites
  • 0

Thanks Annie.

Just a question tho, I can't see the jail check (anyone jailed shouldn't get rewarded); in your script. Should i use something like strcharinfo(3) == "sec_pri" as it was scripted in the original file ?

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

×
×
  • Create New...

Important Information

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