Jump to content
  • 0

moveable / placeable NPC is it possible ?


sorax

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   1
  • Joined:  01/31/12
  • Last Seen:  

1.

is it possble to create the script that let the user to adjust npc position without change it in script.

and the make npc remember it new position. ( via database or permanent global var )

2.

is there anyway to do something like "NPC Scroll" when user use the scroll -> place npc to that location.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

the npc CAN move outside the map with unitwarp + getnpcid

prontera,155,187,5	script	dsasda	100,{
.@map$ = strnpcinfo(4);
npctalk "I am currently in "+ .@map$;
sleep 1000;
if ( .@map$ == "prontera" )
	unitwarp getnpcid(0), "morocc",156,93;
else if ( .@map$ == "morocc" )
	unitwarp getnpcid(0), "prontera", 156,191;
end;
}

move to script support btw

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

An NPC can move anywhere within a map, but not outside of it -- you need duplicates for that.

	// Generic 'movenpc' command.
movenpc strnpcinfo(0),x,y;

// Script command.
{ getmapxy(.@map$,.@x,.@y,0); if (.@map$ == "your_map") movenpc "NPC Name",.@x,.@y; }

// Store NPC location permanently.
getmapxy(.@map$,.@x,.@y,1);
set $move_npc_loc$, .@map$+"|"+.@x+"|"+.@y;
end;

// Load NPC location OnInit.
OnInit:
if ($move_npc_loc$ != "") {
	explode(.@loc$,$move_npc_loc$,"|")
	movenpc strnpcinfo(0),.@loc$[0],atoi(.@loc$[1]),atoi(.@loc$[2]);
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   6
  • Joined:  02/05/12
  • Last Seen:  

or you can use this: http://www.eathena.ws/board/index.php?showtopic=270648

maybe it needs an update... I found errors with NPCs that use the OnInit label with this command (maybe it can't duplicate OnInit labels, i don't know)

but it's a very useful command in many ways.

( btw, maybe someone can confirm the bug and fix it... ^^ )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   1
  • Joined:  01/31/12
  • Last Seen:  

thanks you everyone . i'll try it. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

the npc CAN move outside the map with unitwarp + getnpcid

I learned something new today!

If it's that easy, we should change movenpc to allow "map",x,y :D

Edit: I searched /npc and it's only used in 1 script, so the main issue would be notifying users of the change so they can update their custom scripts.

Search "movenpc" (2 hits in 1 file)
 D:\svn\rathena\trunk\npc\pre-re\other\arena\arena_room.txt (2 hits)
Line 762: 							movenpc "#arena_"+$@arenapic+"",96,28;
Line 1025: 	movenpc "#arena_"+$@arenapic+"",1,1;

Edited by Brian
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I believe there are certain kinds of tricks here shouldn't be adding into SVN

like while(!getmapxy) or attachrid-all-accounts

there is a limit of npc can be having on a map

#define MAX_NPC_PER_MAP 512
doing something like this is just like a trick

as this is able to bypass the numbers of npc having on a map

example, when try @mapinfo,

if you have 1 npc original from prontera, and 1 npc move from morocc into prontera

@mapinfo in prontera tells you only having 1 npc, but actually having 2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  70
  • Reputation:   4
  • Joined:  04/26/12
  • Last Seen:  

can we make the npc move only with in a specified cell range? i mean sm thing like we set a cage and it will move only within those coordinates not outside those specified coordinates.

Edited by fbrulz
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  70
  • Reputation:   4
  • Joined:  04/26/12
  • Last Seen:  

*bump* 

 

any 1 please??

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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