Jump to content
  • 0

moveable / placeable NPC is it possible ?


Question

Posted

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.

9 answers to this question

Recommended Posts

Posted

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
Posted

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]);
}

Posted (edited)
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
Posted

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

Posted (edited)

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

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