Jump to content
  • 0

addtimer Problem


Linkin Park

Question


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

I have this script where premium accounts can only enter 5minutes per day but when I warped into the room, I got warped out after a few seconds only.


mapname,119,159,4 script Premium Account::premiummap 422,{
if( isPremium() == 0 ) goto NotPremium;
mes "[Gatekeeper]";
mes "Where do you want to go?";
switch(select("Private Drop Event"))
{
case 1:
if( #Daily == gettime(5) ) {
mes "You can only enter once a day";
close;
}
set #Daily,gettime(5);
addtimer 300000,strnpcinfo(3)+"::OnTimeLimit";
warp "new_zone04",60,179;

}


OnTimeLimit:
message strcharinfo(0),"Time's Up.";
sleep2 3000;
warp "SavePoint",0,0;
end;

NotPremium:
mes "[Gatekeeper]";
mes "You are not a Premium Account Holder!";
close;

OnInit:
while( 1 ){
if( getmapusers("new_zone04") )
makeitem 969,1,"new_zone04",rand(8,31),rand(168,191);
sleep 100;
}
end;
}

Can anyone help?

Fixed, I just forgot the close; part lol. -_-"

This part however is not working


OnInit:
while( 1 ){
if( getmapusers("new_zone04") )
makeitem 969,1,"new_zone04",rand(8,31),rand(168,191);
sleep 100;
}

Edited by RaGERO
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

My guess is that the 'addtimer' command, is ending the moment the player warps to a new map, since it technically is ending that script instance.

But that's just my guess, since, addtimer is supposed to continue.... But meh, never know what might happen.

mapname,119,159,4	script	Premium Account::premiummap	422,{
if( !isPremium() ){goto NotPremium;}
mes "[Gatekeeper]";
mes "Where do you want to go?";
menu "Private Drop Event",-;
if( #Daily == gettime(5) ){mes "You can only enter once a day"; close;}
close2;
set #Daily,gettime(5);
doevent strnpcinfo(3)+"::OnTimeLimit";
warp "new_zone04",60,179;
end;
OnTimeLimit:
sleep2 300000;
dispbottom "Your Time is up";
warp "savepoint",0,0;
end;
NotPremium:
mes "You are not a Premium account holder!";
close;
}

Edited by GmOcean
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

I don't think this will work, I need to attach the character so that he'll be the only one to be warped out and leave the other players who has still time inside the map.

This is where I copied the script and modified it

http://pastebin.com/raw.php?i=qZkjxip5

Fixed, I just forgot the close; part lol. -_-"

This part however is not working


OnInit:
while( 1 ){
if( getmapusers("new_zone04") )
makeitem 969,1,"new_zone04",rand(8,31),rand(168,191);
sleep 100;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

forgot close in every label lol

that's why I always said need to put close; or end; in every labels ... make this a habit

because we can make this kind of silly mistake if this isn't make as a habit

2nd one

my treasure chest event script has used the

while ( checkcell( "guild_vs5", set( .@x, rand(0,400) ), set( .@y, rand(0,400) ), cell_chknopass ) );

so this will only spawn the npc on a walkable cell

suppose to say you can also use this in your *makeitem script command

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

How can I make it so that whenever there's a player inside the map, it will continuously makeitem? and if there's no one inside the map, it'll stop from makeitem?

OnInit:
while( 1 ){
if( getmapusers("new_zone04") )
while ( checkcell( "new_zone04", set( .@x, rand(8,31) ), set( .@y, rand(168,191) ), cell_chknopass ) );
makeitem 969,1,"new_zone04",rand(8,31),rand(168,191);
sleep 100;
}
end;

Still there's no item dropping.

THis is the area where I want the items to randomly drop

09Cun.jpg

Edited by RaGERO
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

prontera,155,186,5    script    dksjfskdfj    100,{
   warp "guild_vs2", 49,49;
   if ( getmapusers("guild_vs2") == 0 )
       atcommand "@cleanmap";
   end;
OnInit:
   while (1) {
       if ( getmapusers("guild_vs2") ) {
           while ( checkcell( "guild_vs2", set( .@x, rand(0,250) ), set( .@y, rand(0,250) ), cell_chknopass ) );
           makeitem 501, 1, "guild_vs2", .@x, .@y;
       }
       sleep 100;
   }
   end; // MAKE THIS A HABIT !!! I know it doesn't reach here ... but when you read script, your mind will think differently
}

like this ?

actually your method is already correct ... though, I don't see why your script doesn't work

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

It still doesn't drop :(

Here's the whole script. Does it matter if I'm testing using an Admin account?

new_pront,119,159,4 script Premium Account::premiummap 422,{
if( isPremium() == 0 ) goto NotPremium;
mes "[Gatekeeper]";
mes "Where do you want to go?";
switch(select("Private Drop Event"))
{
case 1:
if( #Daily == gettime(5) ) {
mes "You can only enter once a day";
close;
}
set #Daily,gettime(5);
addtimer 300000,strnpcinfo(3)+"::OnTimeLimit";
warp "new_zone04",60,179;
close;
}

OnTimeLimit:
message strcharinfo(0),"Time's Up.";
sleep2 3000;
warp "SavePoint",0,0;
end;

NotPremium:
mes "[Gatekeeper]";
mes "You are not a Premium Account Holder!";
close;

OnInit:
while (1) {
if ( getmapusers("new_zone04") ) {
while ( checkcell( "new_zone04", set( .@x, rand(8,31) ), set( .@y, rand(168,191) ), cell_chknopass ) );
makeitem 501, 1, "new_zone04", .@x, .@y;
}
sleep 100;
}
end;
}

new_zone04 mapflag noskill
new_zone04 mapflag nowarp
new_zone04 mapflag nowarpto
new_zone04 mapflag noreturn
new_zone04 mapflag nobranch

I replaced that part with yours so I'm using the guild_vs2, and it worked.

I guess I have a problem with this part

while ( checkcell( "new_zone04", set( .@x, rand(8,31) ), set( .@y, rand(168,191) ), cell_chknopass ) );

I don't know how to properly check the x and y coords for a map

Edited by RaGERO
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

to figure out the possible X&Y cooridinates of your map, go to the bottom left corner, and write down what your coordinates are, then go to the top right corner, and record those coordinates. Now you can just rand(bottom_left X, top_right X), and rand(bottom_left Y, top_right Y).

That should give you a range for your entire map.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

btw, to really make it a daily variable

should use gettimestr("%Y%m%d", 9) instead of gettime(5)

http://www.eathena.ws/board/index.php?s=&showtopic=243105&view=findpost&p=1325171

what happens if the user can only online once per week , or once per month =/

prontera,156,186,4	script	Premium Account::premiummap	422,{
//	if( isPremium() == 0 ) goto NotPremium; // just testing
mes "[Gatekeeper]";
mes "Where do you want to go?";
switch(select("Private Drop Event"))
{
case 1:
	if( atoi( gettimestr("%Y%m%d", 9) ) == #Daily ) {
		mes "You can only enter once a day";
		close;
	}
	#Daily = atoi( gettimestr("%Y%m%d", 9) );
//		addtimer 5000,strnpcinfo(3)+"::OnTimeLimit";
	addtimer 300000,strnpcinfo(3)+"::OnTimeLimit";
	warp "new_zone04",60,179;
	close;
}

OnTimeLimit:
message strcharinfo(0),"Time's Up.";
sleep2 3000;
warp "SavePoint",0,0;
end;

NotPremium:
mes "[Gatekeeper]";
mes "You are not a Premium Account Holder!";
close;

OnInit:
while (1) {
	if ( getmapusers("new_zone04") ) {
		while ( checkcell( "new_zone04", set( .@x, rand(48,168) ), set( .@y, rand(71,191) ), cell_chknopass ) );
		makeitem 501, 1, "new_zone04", .@x, .@y;
	}
	sleep 500;
}
end; // doesn't read
}

new_zone04	mapflag	noskill
new_zone04	mapflag	nowarp
new_zone04	mapflag	nowarpto
new_zone04	mapflag	noreturn
new_zone04	mapflag	nobranch


new_zone04	mapflag	nosave	SavePoint	// make sure you have this <.< ... addtimer timer will lost if player log out
new_zone04	mapflag	nomemo

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

actually your method is already correct ... though, I don't see why your script doesn't work

Actually, I believe he is just setting the wrong coordinates.

In his script, he is randomizing a value from 8 to 31 as X coordinate, while his position (centre of the map) has X = 60.

His position is 10 cells far from the wall, so the item will be not generated in the area where he is.

OnInit:
while(1) {
if( getmapusers("new_zone04") )
	makeitem 969,1,"new_zone04",rand(50,70),rand(170,190);
sleep 100;
}
end;

I believe this code actually works fine, if the item 969 does actually exist.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

Thanks, it's working now. :)

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