Jump to content
  • 0

Dynamic Time Lucky Pick Event


Question

Posted (edited)

How to change the dynamic time?

I want to make the script run minimum every 1 hours + randomly minute.

//http://rathena.org/board/topic/53877-lucky-pick-event/
//emistry script

- script AutoFunEvent -1,{
OnInit:
OnClock0000:
set .LuckyTime,rand(24);
OnMinute60:
if( gettime(3) == .LuckyTime ){
set .DelayMin,rand(60);
sleep ( .DelayMin * 60000 );
while(1){
 query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
 attachrid .@aid;
 if( CheckVending() ){
  DetachRID();
  continue;
  }
 announce strcharinfo(0) +" won 500 Cash in Lucky Pick Event", 0,0x00FF00;
 set #CASHPOINTS,#CASHPOINTS+500;
 dispbottom "you got 500 cash point";
 break;
}
}
end;
}

Thanks :)

Edited by zenz90

19 answers to this question

Recommended Posts

  • 1
Posted

this script sux big time

use mine

http://rathena.org/board/topic/72927-the-prize-is-not-given-to-players/#entry149317

update this script

-	script	AutoFunEvent	-1,{
OnInit:
while (1) {
	freeloop 1;
	.@rand = rand(2000000000);
	.@count = 0;
	while ( getusers(1) > .@count ) {
		.@nb = query_sql("select account_id from `char` where online = 1 order by rand("+ .@rand +") limit 128 offset "+ .@count, .@aid );
		.@i = 0;
		while ( .@i < .@nb ) {
			if ( attachrid(.@aid[.@i]) ) {
				if ( getgmlevel() < 60 && !checkvending() ) { // only normal players and non-vending players
					announce strcharinfo(0) +" won 500 Cash in Lucky Pick Event", 0,0x00FF00;
					#cashpoints = #cashpoints + 500;
					dispbottom "you got 500 cash point";
					break;
				}
			}
			.@i++;
		}
		if ( .@i < .@nb )
			break;
		.@count += 128;
	}
	freeloop 0;
	sleep 3600000 + rand(3600000); // 1 hour + random minutes within 1 hour
}
end;
}

  • Upvote 1
  • 0
Posted

Sorry for a noob question i search everywhere about this script and i found out only modifications i tried the original link but not found by emistry i know how to put NPC's but this is an automated event and npc is not needed (i dont know im still new here)so how can i run/execute this? where to put? thank you

  • 0
Posted
On 12/23/2019 at 1:58 AM, kalabasa said:

Sorry for a noob question i search everywhere about this script and i found out only modifications i tried the original link but not found by emistry i know how to put NPC's but this is an automated event and npc is not needed (i dont know im still new here)so how can i run/execute this? where to put? thank you

Just load it like you would any other NPC. Also you shouldn't necro really old topics like this there is more than enough information out there about loading in NPCs.

  • 0
Posted
On 12/28/2019 at 12:02 PM, Skorm said:

Just load it like you would any other NPC. Also you shouldn't necro really old topics like this there is more than enough information out there about loading in NPCs.

i am sorry for you thinking that way i was currently getting useful scripts here to be tested soon and im still new in here sorry again for misunderstood

  • 0
Posted
2 hours ago, kalabasa said:

i am sorry for you thinking that way i was currently getting useful scripts here to be tested soon and im still new in here sorry again for misunderstood

here
edit
onlock and onminute
 

prontera,150,150,4	script	Event	998,{

OnInit:
OnClock0000:
set .LuckyTime,rand(24);
OnMinute60:
if( gettime(3) == .LuckyTime ){
set .DelayMin,rand(60);
sleep ( .DelayMin * 60000 );
while(1){
 query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
 attachrid .@aid;
 if( CheckVending() ){
  DetachRID();
  continue;
  }
 announce strcharinfo(0) +" won 500 Cash in Lucky Pick Event", 0,0x00FF00;
 set #CASHPOINTS,#CASHPOINTS+500;
 dispbottom "you got 500 cash point";
 break;
}
}
end;
}

 

Posted (edited)

Thanks for reply Emistry !

so the script edited like this ?

//http://rathena.org/board/topic/53877-lucky-pick-event/
//emistry script

- script AutoFunEvent -1,{
OnInit:
OnClock0000:
set .LuckyTime,rand(24);
OnMinute00:
if( gettime(3) == .LuckyTime ){
set .DelayMin,rand(60);
sleep ( rand(60) * 1000 );
while(1){
 query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
 attachrid .@aid;
 if( CheckVending() ){
  DetachRID();
  continue;
  }
 announce strcharinfo(0) +" won 500 Cash in Lucky Pick Event", 0,0x00FF00;
 set #CASHPOINTS,#CASHPOINTS+500;
 dispbottom "you got 500 cash point";
 break;
}
}
end;
}

Edited by zenz90
Posted (edited)

@AnnieRuru

is that script works on 3CeAM ?

btw thanks for reply :D

* Imitate the voice of AnnieRuru *

No it doesn't ! (lol)

It works only on rAthena

Edited by Capuche
  • Upvote 1
Posted (edited)

change

set #CASHPOINTS,#CASHPOINTS+500;

to

getitem 512,1000;

refer getitem or getitem2

thanks emistry how about the one Annie did?

ill change this

 #cashpoints = #cashpoints + 500;

to this

getitem 512,1000;

??

and can i use 2 same lucky pick script at the same time with different item reward set on it?

also does afk players are excluded meaning afk dont have a chance to pick by the script and get rewards?

Edited by jigsgfx
Posted

@Emistry

The dynamic time doesn't work, it still run every 12-24 hour

I want make it to one hour + randomly minute.

any suggestion?

Thanks,

//http://rathena.org/board/topic/53877-lucky-pick-event/
//emistry script

-	script	AutoFunEvent	-1,{
OnInit:
OnClock0000:
set .LuckyTime,rand(24);

OnMinute00:
if( gettime(3) == .LuckyTime ){
set .DelayMin,rand(60);
sleep ( rand(60) * 1000 );
while(1){
 query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
 attachrid .@aid;
 if( CheckVending() ){
  DetachRID();
  continue;
  }
 announce strcharinfo(0) +" won 500 cash in Lucky Pick Event ", 0,0x00FF00;
 set #CASHPOINTS,#CASHPOINTS+500;
 dispbottom "You got 500 cash point";
 break;
}
}
end;
}

Posted

remove these if you want it to work every hours.


OnInit:
OnClock0000:
set .LuckyTime,rand(24);
........................
if( gettime(3) == .LuckyTime ){

Posted
sleep 3600000 + rand(3600000); // 1 hour + random minutes within 1 hour
I thought mine already comply your request ?

 

If I want it to be every 6 hours do I need to multiply 3600000 to 6 ? and remove + rand(3600000) ? Thanks!

Posted

Yes

sleep 3600000 * 6; // 1 Hour in Milliseconds * 6
21600000 / 1000 = 21600 //seconds

21600 / 60 = 360 //Minutes

360 / 60 = 6 //Hours

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