Jump to content
  • 0
Sign in to follow this  
dfabsgwapings

Random area appearance of an NPC

Question

H there everyone,


 


How can I make the appearance of an NPC randomly to a specific map?


 


This for the hide and seek event actually.


 


I tried to use this one but it seems not working


 



prontera,0,0,0 script Hide and Seek 123,{

"script area here"

}

The NPC is not showing. even if I tried to put it on a small map. No NPC appeared.


 


Need help guys. Thanks.


Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I believe you wish the npc to spawn in random locations on the map?

 

For this you would first define your npc, then disable it in OnInit, and when the event starts you would enable it and move it to the desired location.

 

If this does not work for you then please attach your full script here

Share this post


Link to post
Share on other sites
  • 0

@meko

 

This is my script please fix this for me.

 

prontera,150,150,5	script	Jump	123,{

	set .Map$,.Maps$[rand(getarraysize(.Maps$))];
	announce "Jumper Event : Go Find me!! I'm here in "+.Map$+"!!!",bc_yellow;
	goto OnStart;

OnStart:
	while(1) { //Initiate an infinite loop
		set $@jx,rand(0,300); //Set a randon X coordinate
		set $@jy,rand(0,300); //Set a random Y coordinate
		if(checkcell(""+.Map$+"",$@jx,$@jy,cell_chkpass)) break; //If cell is walkable break out of the loop
	}
	movenpc "GM Athena#"+.Map$+"",$@jx,$@jy; //move the NPC
	while( 1 ){
		delwaitingroom;
		waitingroom "Hello World",0;
		end;
	}
	end;

OnInit:
	setarray .Maps$[0],"prontera"; // Possible maps
end;
}

prontera,1,1,1	duplicate(Jump)	Jump#prt	123

NOTE:

The NPC is already jumping to a random walkable coordinates in a map however the waitingroom or pub of the NPC on top of its head is not showing.. please help me fix this one.

 

The only problem of this script is the waitingroom or pub.

  •  
Edited by dfabsgwapings

Share this post


Link to post
Share on other sites
  • 0

This works for me (thinking you mean this)

 

prontera,150,150,5	script	Jump	123,{

	set .Map$,.Maps$[rand(getarraysize(.Maps$))];
	announce "Jumper Event : Go Find me!! I'm here in "+.Map$+"!!!",bc_yellow;
	goto OnStart;

OnStart:
	while(1) { //Initiate an infinite loop
		set $@jx,rand(0,300); //Set a randon X coordinate
		set $@jy,rand(0,300); //Set a random Y coordinate
		if(checkcell(""+.Map$+"",$@jx,$@jy,cell_chkpass)) break; //If cell is walkable break out of the loop
	}
	unitwarp(getnpcid(0), .Map$, $@jx, $@jy);
	delwaitingroom;
	waitingroom "Hello World",0;
	end;
	
OnWhisperGlobal:
	if(!getgmlevel())
		end;
	dispbottom $@jx + " " + $@jy;
	end;
	
OnInit:
	setarray .Maps$[0],"prontera"; // Possible maps
end;
}

prontera,1,1,1	duplicate(Jump)	Jump#prt	123		

If you whisper "npc:Jump" as a GM you can get the coördinates of the location. I Didn't take any liberation on changing anything else other than the requested. 

 

Eitherway, goodluck!  :)

Edited by PB&JJ

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.