Jump to content
  • 0

Random area appearance of an NPC


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

You can search for jumper event, it is almost similar 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Yes it is. To be specific you can use this command

*movenpc "<NPC name>",<x>,<y>{,<dir>};

This command looks like the NPCWalkToxy function,but is a little different.

While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which 
sometimes gives problems if the path isn't a straight line without objects), 
this command just moves the NPC. It basically warps out and in on the current 
and given spot. Direction can be used to change the NPC's facing direction.

Example:

// This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
	moveNPC "Bugga",100,20;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

actually @Cyro I already tried to use the jumper event but it seems like its not working with my script

also @Ninja I already tried the movenpc and still not working.

This is how my npc works.

  • NPC will hide and will announce where map he is hiding (maps are fields)
  • Players should find the NPC and chat the Word and Number combination given on its PUB
  • First player to chat the combination wins
-	script	Seek and Crack	-1,{
end;

StartEvent:	// Start time (every hour)

	set .Map$,.Maps$[rand(getarraysize(.Maps$))];
	killmonster .Map$,"All";
	announce "[ System ] : So let's start !!!",0;

	sleep 5000;
	//if (.Map$ == "2@mir"){ enablenpc "2@mir"; donpcevent "2@mir::OnStart"; }
	announce "System : 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
	end;

iCorrect:
	callfunc "SnC_rewards";
	end;
	
OnInit:
	setarray .Maps$[0],"2@mir","1@mir"; // Possible maps
	bindatcmd "snc",strnpcinfo(3)+"::OnAtcommand",99,99;
	setarray .@codes$[0],"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";
	for (.@i = 0; .@i< 3; .@i++) {
		.@ch$ = .@codes$[rand(getarraysize(.@codes$))];
		.@gen$[.@i] = (rand(2)?strtoupper(.@ch$):.@ch$);
	}
	set .crack$,implode(.@gen$); //returns "This is a test"
	defpattern 1, "([^:]+):.*\\s"+.crack$+".*", "iCorrect";
	activatepset 1;
	while( 1 ){
		delwaitingroom;
		waitingroom .crack$,0;
		end;
	}
	end;	

OnAtcommand:
	goto StartEvent;
	end;
}

Im hoping someone help be able to fix this for me. Thanks alot.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

well first of all you have to duplicate that script to an npc that is located where nobody can see him. for example

prontera,1,1,1 duplicate(Seek and Crack) GMAthena# 1002

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

I forgot to mention. Yeah it was randomly appearing to the specified map. However 1 last problem the waitingroom is not appearing on NPC's head. Does anyone knows how to fix this?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

it is because it is located in your OnInit part. You should put it after you've moved your NPC somewhere. I think NPC waiting rooms disappear when they are moved to another place unless you used WalkToXy.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

@Ninja

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