Jump to content
  • 0

If idle in lhz_dun04 for 1 minute. do @die.


Question

13 answers to this question

Recommended Posts

Posted

If idle in lhz_dun04 for 1 minute. do @die. only in lhz_du04 :)

-    script    lkjhgfd    -1,{

OnPCLoadMapEvent:
   if( strcharinfo(3) == "lhz_dun04" ) {
       addtimer 30000, strnpcinfo(3)+"::On30secs";
       @afkinbio4 = 0;
   }
   end;

On30secs:
   if( strcharinfo(3) != "lhz_dun04" ) end;
   getmapxy .@mp$,.@x,.@y,0;
   if( .@x != @xbio4 || .@y != @ybio4 )
       @afkinbio4 = 0;
   else if( @afkinbio4 == 3 )
       percentheal -100,-100;
   @xbio4 = .@x;
   @ybio4 = .@y;
   @afkinbio4++;
   addtimer 30000, strnpcinfo(3)+"::On30secs";
   end;
}
lhz_dun04    mapflag    loadevent

  • Upvote 1
Posted (edited)

-	script	kjdshksdfjhsd	-1,{
OnPCLoadMapEvent:
if ( strcharinfo(3) != "lhz_dun04" ) end;
while (1) {
	getmapxy .@map$, .@x, .@y, 0;
	if ( .@map$ != "lhz_dun04" )
		end;
	else if ( .@x == .@afkinbio4_x && .@y == .@afkinbio4_y ) {
		.@afkinbio4++;
//			dispbottom "AFK for "+ .@afkinbio4 +" seconds";
		if ( .@afkinbio4 == .afk ) {
			unitkill getcharid(3);
			end;
		}
	}
	else {
//			dispbottom "AFK reset";
		.@afkinbio4 = 0;
		.@afkinbio4_map$ = .@map$;
		.@afkinbio4_x = .@x;
		.@afkinbio4_y = .@y;
	}
	sleep2 .sleeploop;
}
end;
OnInit:
.sleeploop = 1000; // every 1 second
.afk = 60; // loop 60 times of 1 second == 1 minute
end;
}
lhz_dun04	mapflag	loadevent

huhuhu ... its fun when I have a challenger xD

EDIT:

addtimer 30000, strnpcinfo(3)+"::On30secs";
.....        
else if( @afkinbio4 == 3 )
.....
@afkinbio4++;

I believe it should be @afkinbio4 == 2 there

because @afkinbio4++ is execute later

either put @afkinbio4++ before the execution of that condition to make it 3, or put it later to make it 2

Edited by AnnieRuru
Posted (edited)

Challenge accepted ! So as a challenger, I will comment your script XD

Let's go :

.@map$ = "lhz_dun04";
while ( .@map$ == "lhz_dun04" ) {

I think this condition will ALWAYS be true lol. Well it works, why not

   	 if ( .@afkinbio4 == .afk ) {
			unitkill getcharid(3);
			end;
		}

It means the loop will end here. If the player revive (resurrection skill or else), he should walk wherever he wants and afk without any risk !

Also we both do a mistake : if the player use teleport in the same map, the server will create multi instance/loop without any restriction.

I believe it should be @afkinbio4 == 2 there

because @afkinbio4++ is execute later

either put @afkinbio4++ before the execution of that condition to make it 3, or put it later to make it 2

In the beginning of the loop, it's true that there are 4 loops before dying. After that, it's one minute (it's a bit screw up I know - and my explanation...).

Edit : You're right >.<

Here my script after correction

-    script    lkjhgfd    -1,{

OnPCLoadMapEvent:
   if( strcharinfo(3) == "lhz_dun04" && !@afkinbio4 ) {
       addtimer 30000, strnpcinfo(3)+"::On30secs";
       @afkinbio4 = 1;
       getmapxy .@map$,.@x,.@y,0;
       @afkinbio4_x = .@x;
       @afkinbio4_y = .@y;
   }
   end;

On30secs:
   // dispbottom ""+gettime(1);
   if( strcharinfo(3) != "lhz_dun04" ) {
       @afkinbio4 = 0;
       end; }
   @afkinbio4++;
   getmapxy .@map$,.@x,.@y,0;
   if( .@x != @afkinbio4_x || .@y != @afkinbio4_y )
       @afkinbio4 = 0;
   else if( @afkinbio4 == 3 )
       percentheal -100,-100;
   @afkinbio4_x = .@x;
   @afkinbio4_y = .@y;
   addtimer 30000, strnpcinfo(3)+"::On30secs";
   end;
}
lhz_dun04    mapflag    loadevent

Edited by Capuche
  • Upvote 1
Posted

wahahaha XD

its been awhile someone wants to play with me like this XD

you are right about teleport/ressurection

I've forgotten this map doesn't have nowarp/nowarpto/noteleport/nosave mapflag

-> its a non-event map

so here I try again XD

-    script    kjdshksdfjhsd    -1,{
OnPCLoadMapEvent:
   if ( strcharinfo(3) != "lhz_dun04" || @afkinbio4_start ) end;
   @afkinbio4_start = 1;
OnLoop:
   while (1) {
       getmapxy .@map$, .@x, .@y, 0;
       if ( .@map$ != "lhz_dun04" )
           break;
       else if ( .@x != .@afkinbio4_x || .@y != .@afkinbio4_y || !hp ) {
           dispbottom "AFK reset";
           .@afkinbio4 = 0;
           .@afkinbio4_map$ = .@map$;
           .@afkinbio4_x = .@x;
           .@afkinbio4_y = .@y;
       }
       else if ( .@x == .@afkinbio4_x && .@y == .@afkinbio4_y ) {
           .@afkinbio4++;
           dispbottom "AFK for "+ .@afkinbio4 +" seconds";
           if ( .@afkinbio4 == .afk ) {
               addtimer .sleeploop, strnpcinfo(0)+"::OnLoop"; // when you die on 1st time, the script execution ends
               unitkill getcharid(3);
               end; // doesn't read here on 1st death
           }
       }
       sleep2 .sleeploop;
   }
   @afkinbio4_start = 0;
   end;
OnInit:
   .sleeploop = 1000; // every 1 second
   .afk = 60; // loop 60 times of 1 second == 1 minute
   end;
}
lhz_dun04    mapflag    loadevent

btw your script

-    script    lkjhgfd    -1,{

OnPCLoadMapEvent:
   if( strcharinfo(3) == "lhz_dun04" && !@afkinbio4 ) {
       addtimer 1000, strnpcinfo(3)+"::On30secs";
       @afkinbio4 = 1;
       getmapxy .@map$,.@x,.@y,0;
       @afkinbio4_x = .@x;
       @afkinbio4_y = .@y;
   }
   end;

On30secs:
   // dispbottom ""+gettime(1);
   if( strcharinfo(3) != "lhz_dun04" ) {
       @afkinbio4 = 0;
       end; }
   @afkinbio4++;
//    dispbottom "AFK for "+ @afkinbio4 +" seconds"; // <-- after you die, this message isn't execute
   getmapxy .@map$,.@x,.@y,0;
   if( .@x != @afkinbio4_x || .@y != @afkinbio4_y )
       @afkinbio4 = 0;
   else if( @afkinbio4 == 5 )
       percentheal -100,-100;
   @afkinbio4_x = .@x;
   @afkinbio4_y = .@y;
   addtimer 1000, strnpcinfo(3)+"::On30secs";
   end;
}
lhz_dun04    mapflag    loadevent

there is an intended bug in SVN when you die, the script execute is forced to end

it is an intended behavior so when the player die cannot talk to npc anymore

in other words if you are ressurected (@alive), they can afk for as long as they want with your script

Posted

nope, if the user use wing of fly or teleportation skill ( acolyte skill or from skill given by creamy card )

the coordinate of the user will change, the script will continue execute as player has walk

Posted (edited)

Ah, I thought the script end upon warp, but I suppose that only applies with the script warp command.

Anyway, isn't it much much easier to just warp the character to town? aside from being able to get ressurected :P.

Edited by Jeroen
Posted

there is an intended bug in SVN when you die, the script execute is forced to end

it is an intended behavior so when the player die cannot talk to npc anymore

in other words if you are ressurected (@alive), they can afk for as long as they want with your script

You're right !

I make the script with an old version (~r16820), the script didn't stop so I didn't see that. I forgot it works like that in new version.

Well I have nothing to complain about your script this time ^_^

Anyway, isn't it much much easier to just warp the character to town? aside from being able to get ressurected :P.

Why make things easy ? XD

  • Upvote 1

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