Jump to content
  • 0

Auto Killer


Lenya

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

Hello rA !

 

Today I tried to make a autokiller script for my 5 MvP rooms.

 

This script should kill all monsters in the map if no player is there with a 5 minute timer.

 

Example:

 

I summon a gloom under night -> I'm gonna leave the room with @go 0 or logout. -> The script should start automaticly and if 5 minutes are over all monsters in the area should be killed.

 

 

What I know:

 

- I need a timer function

- I need a player on map checker

- I need a killmonster2 trigger after 5 minutes

 

thanks in advance  /lv

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


prontera,150,150,4 script mmmh 58,{

.@s = select( implode( .map_mvp$, ":" ) ) -1;

warp .map_mvp$[.@s], 0, 0;

while( .timer_clean ) {

sleep 5000;

if( getmapusers( .map_mvp$[.@s] ) )

.@count = 0;

else {

.@count++;

if( .@count == .timer_clean * 12 ) goto L_clean;

}

}

L_clean:

killmonsterall .map_mvp$[.@s];

end;

OnInit:

setarray .map_mvp$, "prontera","geffen","payon";

.timer_clean = 5; // in minutes

end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

Do the timer stop if a player join into the room?

 

I waited 5 Minutes but the mvp wasn't deafeated :o

 

Look:

 

//========================================
// Auto Cleaner ==========================
//========================================
-	script	DBArenaCleaner	-1,{

	.@s = select( implode( .map_mvp$, ":" ) ) -1;
	warp .map_mvp$[.@s], 0, 0;

	while( .timer_clean ) {
		sleep 5000;
		if( getmapusers( .map_mvp$[.@s] ) )
			.@count = 0;
		else {
			.@count++;
			if( .@count == .timer_clean * 12 ) goto L_clean;
		}
	}
L_clean:
	killmonsterall .map_mvp$[.@s];
	end;
OnInit:
	setarray .map_mvp$, "dbarena1","dbarena2","dbarena3","dbarena4","dbarena5";
	.timer_clean = 5; // Hier stellt man den Timer ein.
	end;
}
Edited by Lenya
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

No it's not the good way to use my script  /swt

 

Something must start the loop and in my example, it was a player who chose the map, then he is warped on the map and he starts the loop which check if there is someone on the map

 

 

 

This way, the loop start when a player warp on the map

//========================================
// Auto Cleaner ==========================
//========================================
-	script	DBArenaCleaner	-1,{
OnPCLoadMapEvent:
	if( !compare( .map_checker$, strcharinfo(3) ) ) end; // check if a player is on a map in the setting
	.@m$ = strcharinfo(3);
	if( getd( "."+ .@m$ +"$" ) ) end; // check if already a loop for the map
	setd "."+ .@m$ +"$", 1;
	while( .timer_clean ) {
		sleep 5000;
		if( getmapusers( .@m$ ) )
			.@count = 0;
		else {
			.@count++;
			if( .@count == .timer_clean * 12 ) goto L_clean;
		}
	}
L_clean:
	setd "."+ .@m$ +"$", 0;
	killmonsterall .map_mvp$[.@s];
	end;
OnInit:
	setarray .map_mvp$, "dbarena1","dbarena2","dbarena3","dbarena4","dbarena5";
	.map_checker$ = implode( .map_mvp$, "|" );
	for( ; .@i < getarraysize( .map_mvp$ ); .@i++ )
		setmapflag .map_mvp$[.@i], mf_loadevent;
	.timer_clean = 5; // Hier stellt man den Timer ein.
	end;
}
Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

Thank you, it works fine!

 

But what's this? :o

 

 

post-14488-0-18494800-1362897998_thumb.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

    if( getd( "."+ .@m$ +"$" ) =="1") end; // check if already a loop for the map
    setd "."+ .@m$ +"$", "1";

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

Problem:

 

The Timer don't stop if a player go to the map in the 5 MINUTES Please help x.x

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

goto will clean   this type of var  .@s

 

find this line

 

if( .@count == .timer_clean * 12 ) goto L_clean;

change to

 

if( .@count >= .timer_clean * 12 ){
  setd "."+ .@m$ +"$", "";
  killmonsterall .map_mvp$[.@s];
}
Edited by QQfoolsorellina
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

It didn't work. Scripts stacks and kill monsters every 5 minutes without timer stop when a player joins to the room x.x

 

//========================================
//Auto Cleaner ===========================
//========================================
-	script	DBArenaCleaner	-1,{
OnPCLoadMapEvent:
	if( !compare( .map_checker$, strcharinfo(3) ) ) end; // Checkt ob ein Player auf der Map ist
	.@m$ = strcharinfo(3);
	if( getd( "."+ .@m$ +"$" ) =="1") end; // Checkt ob bereits ein Loop für die Map erstellt wurd
    setd "."+ .@m$ +"$", "1";
	while( .timer_clean ) {
		sleep 5000;
		if( getmapusers( .@m$ ) )
			.@count = 0;
		else {
			.@count++;
//			if( .@count == .timer_clean * 12 ) goto L_clean;
			if( .@count == .timer_clean * 12 ){
				setd "."+ .@m$ +"$", "";setd "."+ .@m$ +"$", "";
			killmonsterall .map_mvp$[.@s];
}
		}
	}
L_clean:
	setd "."+ .@m$ +"$", 0;
	killmonsterall .map_mvp$[.@s];
	end;
OnInit:
	setarray .map_mvp$, "dbarena1","dbarena2","dbarena3","dbarena4","dbarena5";
	.map_checker$ = implode( .map_mvp$, "|" );
	for( ; .@i < getarraysize( .map_mvp$ ); .@i++ )
		setmapflag .map_mvp$[.@i], mf_loadevent;
	.timer_clean = 5; // Hier stellt man den Timer ein.
	end;
}
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

There was a mistake in killmonsterall, sorry

//========================================
// Auto Cleaner ==========================
//========================================
-	script	DBArenaCleaner	-1,{
OnPCLoadMapEvent:
	if( !compare( .map_checker$, strcharinfo(3) ) ) end; // check if a player is on a map in the setting
	.@m$ = strcharinfo(3);
	if( getd( "."+ .@m$ ) ) end; // check if already a loop for the map
	setd "."+ .@m$, 1;
	while( .timer_clean ) {
		sleep 5000;
		if( getmapusers( .@m$ ) )
			.@count = 0;
		else {
			.@count++;
			if( .@count == .timer_clean * 12 ) goto L_clean;
		}
	}
L_clean:
	setd "."+ .@m$, 0;
	killmonsterall .@m$;
	end;
OnInit:
	// setarray .map_mvp$, "prontera","geffen","payon";
	setarray .map_mvp$, "dbarena1","dbarena2","dbarena3","dbarena4","dbarena5";
	.map_checker$ = implode( .map_mvp$, "|" );
	for( ; .@i < getarraysize( .map_mvp$ ); .@i++ )
		setmapflag .map_mvp$[.@i], mf_loadevent;
	.timer_clean = 5; // Hier stellt man den Timer ein.
	end;
}
  • Upvote 1
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...