Jump to content
  • 0

[Event] Hooray or Kaboom!


Question

Posted

Hi, 

I just had something in mind, how do I make multiple npc (duplicates) spawn in a map in a random coordinates every 5 seconds? 

I want to make something like random map with 20~50 multiple npc which when a player walks on it, it gives them item or kaboom! Kills them.  Then npcs dissappear upon walking through but 5~10 new ones spawns every 5 secs for a span of 1min secs. 

dead players will be respawned in the map but will get slowed down by curse for 5 secs. 

Map will disable use of item/equipment/pots/skills

Sorry for bad English construction, this idea just came to me spontaneously. 

2 answers to this question

Recommended Posts

  • 0
Posted

This isn't a full representation of what you want, but it's a start. I can't even remember if OnTouch works with moving NPCs.

function	script	fWalkable	{
	.@map$ = getarg(0);
	freeloop(1);
	do {
		.@rXr = rand(getarg(1));
		.@rYr = rand(getarg(2,getarg(1)));
	}
	while (checkcell(.@map$,.@rXr,.@rYr,cell_chkwall)
	|| checkcell(.@map$,.@rXr,.@rYr,cell_chkcliff)
	|| checkcell(.@map$,.@rXr,.@rYr,cell_chknopass)
	|| checkcell(.@map$,.@rXr,.@rYr,cell_chknoreach));

	return (.@rXr<<12)+.@rYr;
}

-	script	Kaboom	111,{
end;
OnTouch:
	if( rand(100) < 50 )
		atcommand "@nuke " + strcharinfo(0);
	else
		getitem 501,1;
	disablenpc strnpcinfo(0);
	movenpc strnpcinfo(0), 0, 0;
	end;
	
S_MoveNPC:
	explode(.@tmp_ary$,strnpcinfo(2),"|");
	.@walkable_xy = fWalkable(strnpcinfo(4), atoi(.@tmp_ary$[0]), atoi(.@tmp_ary$[1]));
	.@y = .@walkable_xy & 4095;
	.@x = .@walkable_xy >> 12;
	movenpc strnpcinfo(0), .@x, .@y;
	enablenpc strnpcinfo(0);
	sleep 60000;
	callsub S_MoveNPC;
	
OnInit:
	disablenpc strnpcinfo(0);
	if( strnpcinfo(2) != "" )
		callsub S_MoveNPC;
}
prontera,0,0,0	duplicate(Kaboom)	Kaboom 1#300|300	111,4,4

 

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