Random area appearance of an NPC

dfabsgwapings

New member
Messages
165
Points
0
Github
dfabsgwapings
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.

 
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

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

  •  
 
Last edited by a moderator:
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!  
default_smile.png


 
Last edited by a moderator:
Back
Top