Jump to content

Recommended Posts

Posted

Monster Counting Game


A mini event where a numbers of monsters will be spawned within a specified area. Players have to count for the monsters that exist within that area and tell the NPC to win the event.

Btw, this is just a new version of event based on my previous Flower Counting Event.

Thank you @AnnieRuru for delivering me the idea of using "live" monsters.

Configuration:

	OnInit:		// how many rounds		.max_round = 3;				// minute each round		.max_duration = 3;				// dummy mob id represent wall		.wall_mob_id = 1085;				// ( x1,y1,x2,y2 ) area for event		setarray .xy_area,			151,169,		// ( x1,y1 )			161,179;		// ( x2,y2 )					// monster list used in event		setarray .monster,			1002,			1031,			1836,			1595;

Preview :

Feel free to share your idea/opinions to improve this.


 

  • Upvote 4
Posted

is it possible to warp player that are inside the cell to some where else?

Oh, forgotten that xD

 

Updated script to v1.1.

  • Upvote 1
Posted

Woa awesome script! *5/5*

 

thank you so much for such amazing script o:!

 

Edit:

may i ask, ho to make it to start when clicked? or by pm? o:!

Posted

@Kido

OnWhisperGlobal:
	if( getgmlevel() < 99 ) end;
	detachrid;
OnMinute00:	// start every hour

find and add..

 

Thank you so much it's working awsm o:! dunno why, players can kill the mushrooms D:

Posted

@Moofie91

it seem fine for me, my map-server didnt crash even though i try to answer using your way.

JVVXRZT.jpg

 

 

anyway, updated script to avoid this kind of "answer" which exploit the event behaviours.

  • Upvote 1
  • 2 weeks later...
Posted

im trying to add the spam protection from Emistry flower counting, can you  verify if this is ok?  Thanks :D

prontera,155,181,5	script	Monster Counting Game	757,{
mes "This is a Monsters Counting Game";
mes "I will summon some Monsters here, and you have to count the Correct Amount of Monsters i summoned.";
mes "^FF0000Only Count for the Monsters i mentioned^000000";
next;
switch( select( "Information",
				( getgmlevel() < .GMLevel || .status )?"":"^FF0000[GM]^000000 Start Game",
				( getgmlevel() < .GMLevel || !.status )?"":"^FF0000[GM]^000000 End Game" )){
				
case 1:
	mes "When the Event Start, i will summon some Monsters at a small area, and players have to count the amount of the flowers.";
	mes "Whoever tell me the correct amount of Monsters i mentioned, he/she win the game.";
	break;
	
case 2:
	mes "Event will begin right now.";
	close2;
	donpcevent strnpcinfo(0)+"::OnStartEvent";
	end;

case 3:
	deletepset 1;
	npctalk "Counting Game Cancelled.";
	mes "Game Cancelled.";
	killmonster .map$,"All";
	setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,0;
	setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
	.status = 0;
	delwaitingroom;
	break;
}
close;

OnSpammed:
	.@Spam = 0;
	end;

iSpam:
	if( getgmlevel() > 90 ) end;
	set @Spam,@Spam + 1;
	if( @Spam >= .Spam ){	// 3 Continuos Answer will trigger...
		set @SpamDelay,gettimetick(2) + .Spam;
		dispbottom "SPAM Detected, your answer within next "+.Spam+" Seconds will be Ignored.";
	}
	deltimer strnpcinfo(0)+"::OnSpammed";
	addtimer ( .Spam * 1000 ),strnpcinfo(0)+"::OnSpammed";
	end;

OnRight:
		.@Spam = 0;
		deltimer strnpcinfo(0)+"::OnSpammed";
		getmapxy( .@map$,.@x,.@y,0 );
		if ( .status == 0 ) {
			dispbottom "[Counting Game] Event isnt running.";
		}
		else if ( .status == 1 ) {
			dispbottom "[Counting Game] Please wait for the round to start.";
		}
		else if ( distance( .npc_x,.npc_y,.@x,.@y ) > 14 ) {
			dispbottom "[Counting Game] You're too far away.";
		}
		else if( @SpamDelay > gettimetick(2) ){
			message strcharinfo(0),"SPAM Protection : Remain "+( @SpamDelay - gettimetick(2) )+" seconds.";
		}
		else {
			npctalk "Bravo!! "+strcharinfo(0)+" is correct!!";
			
			// rewards
			getitem 512,1;
			getitem 512,2;
			getitem 512,3;
			
			specialeffect2 EF_POTION_CON;
			awake .npc_name$;
		}
		end;


	function xy_wall;
	end;
	
	OnInit:
		//	Min. GM Level to access GM Panel
		.GMLevel = 80;
		.Spam = 3;
		.Delay = 10;
		.max_round = 3;
		.max_duration = 3;
		.wall_mob_id = 1085;
		setarray .xy_area,
			151,169,
			161,179;
		setarray .monster,
			PORING,
			DROPS,
			MARIN,
			POPORING;
			
		.monster_size = getarraysize( .monster );
		.npc_name$ = strnpcinfo(0);
		getmapxy( .map$,.npc_x,.npc_y,1 );
		setmapflag .map$,mf_monster_noteleport;
		end;
		
	OnMinute00:
	OnStartEvent:
		if ( !.status ) {
			areawarp .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],.map$,.npc_x,.npc_y;
			killmonster .map$,.npc_name$+"::OnDied";
			killmonster .map$,.npc_name$+"::OnWallDied";
			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,1;
			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
			.status = 1;
			
			for( .@i = .xy_area[0]; .@i <= .xy_area[2]; .@i++ ){
				xy_wall( .@i,.xy_area[1] );
				xy_wall( .@i,.xy_area[3] );
			}
			for( .@i = .xy_area[1]; .@i <= .xy_area[3]; .@i++ ){
				xy_wall( .xy_area[0],.@i,0 );
				xy_wall( .xy_area[2],.@i );
			}
			
			do{
				.@round++;
				npctalk "Round # "+.@round;
				sleep 5000;
				
				.status = 2;
				.@mob = .monster[ rand( .monster_size ) ];
				.@amount = rand( 20,50 );
				// add-on size influence ?
				areamonster .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],"",.@mob,.@amount,.npc_name$+"::OnDied";
			
				deletepset 1;
				defpattern 1,"([^:]+):.*"+.@amount+".$", "OnRight";
				defpattern 1,"([^:]+):.*.*", "iSpam";

				activatepset 1;
				waitingroom "How many's there?",0;
				npctalk "Tell me the correct amount of monster in there.";
				// debugmes " > "+.@amount+" "+getmonsterinfo( .@mob,MOB_NAME );
				
				sleep ( .max_duration * 60000 );
				
				killmonster .map$,.npc_name$+"::OnDied";
				delwaitingroom;
				deletepset 1;
				.status = 1;
				sleep 5000;
				
			}while( .@round < .max_round );
			
			npctalk "That's the Last, thank you for participating.";
			emotion e_thx;
			
			killmonster .map$,.npc_name$+"::OnDied";
			killmonster .map$,.npc_name$+"::OnWallDied";
			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,0;
			setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
			.status = 0;
		}
		end;
		
	OnDied: 
	OnWallDied: 
		end;


		
	function	xy_wall	{
		.@x = getarg(0); 
		.@y = getarg(1);
		monster .map$,.@x,.@y,"",.wall_mob_id,1,.npc_name$+"::OnWallDied";
		setcell .map$,.@x,.@y,.@x,.@y,cell_walkable,0;
		// setcell .map$,.@x,.@y,.@x,.@y,cell_basilica,1;
		return;
	}

}
  • 1 month later...
  • 2 months later...
  • 2 weeks later...
Posted

I'd rename the text file you download from "Monster Counting Game 1.2.txt" to "monstercounting.txt"

After that, put the script inside your npc/ folder. Probably inside npc/custom/

Then inside your same npc/ folder, look for the file called scripts_custom.conf and add a line to it saying

npc: npc/custom/monstercounting.txt 

Or whatever you ended up naming the text file.

Once that's done all you need to do is log in as a GM with sufficient powers, and type in @reloadscript and the script will be loaded onto the server.

Or you can restart the server as well, either works.

  • 5 months later...
  • 1 year later...
Posted
On 8/22/2015 at 10:08 PM, qabakrall said:

Please Tell me how to make so that one player takes no more than 3 answers for 1 round?

.Spam = 3;

 

1 hour ago, BreezyRO said:

I assume its where the npc is located

yes

  • 4 weeks later...
  • 2 months later...
Posted (edited)

hello, I was testing this script and i found a few glitches. 

  • The wall of mushrooms are killable
  • The mobs in the area are killable with aoes
  • npc wont hear your answer unless the answer follows a space 

    not sure maybe setcell basilica changed ? maybe using a setmapflag skilldamage 2 to disable mob killing ? 

its a fun minigame. not sure if anyone else noticed these.

 

Edited by mirabell
fix post
  • 2 weeks later...
Posted (edited)
On 4/10/2017 at 2:56 AM, mirabell said:

hello, I was testing this script and i found a few glitches. 

  • The wall of mushrooms are killable
  • The mobs in the area are killable with aoes
  • npc wont hear your answer unless the answer follows a space 

    not sure maybe setcell basilica changed ? maybe using a setmapflag skilldamage 2 to disable mob killing ? 

its a fun minigame. not sure if anyone else noticed these.

 

Experienced the same problem. How to make mushrooms and monsters invulnerable?

Edit: Got mine working properly.

map.c

Quote

switch( cell ) {
case CELL_WALKABLE: map[m].cell[j].walkable = flag; break;
case CELL_SHOOTABLE: map[m].cell[j].shootable = flag; break;
case CELL_WATER: map[m].cell[j].water = flag; break;
 
case CELL_NPC: map[m].cell[j].npc = flag; break;
case CELL_BASILICA: map[m].cell[j].basilica = flag; break;
case CELL_LANDPROTECTOR: map[m].cell[j].landprotector = flag; break;
case CELL_NOVENDING: map[m].cell[j].novending = flag; break;
case CELL_NOCHAT: map[m].cell[j].nochat = flag; break;
default:
ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
break;
}

Looks like set_cell function type is case sensitive.

Also, I put the set_cell line at OnMinute59: 

Edited by akosivinmark

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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