Jump to content
  • 0
Sign in to follow this  

How to make npc move direction?


How to make npc move direction when we touch the npc?

Like this

Before touch normal after touch the direction will follow where you are




Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

First, about npc directions



Facing is a direction the NPC sprite will face in. Not all NPC sprites
have different images depending on the direction you look from, so for
some facing will be meaningless. Facings are counted counterclockwise in
increments of 45 degrees, where 0 means facing towards the top of the map.
(So to turn the sprite towards the bottom of the map, you use facing 4,
and to make it look southeast it's facing 5.)



*setnpcdir({<name>, }<direction>)

Set npc direction. If npc name missing, will be used attached npc.




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


// This will move Bugga from to the coordinates 100,20 (if those
// coordinates are legit).
	movenpc("Bugga", 100, 20);

One will probably need to decide what direction npc should be facing. If thats the last invoking npc direction, fetching the coordinates and deciding by math on coordinates or other way how to do it.

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.

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.

Sign in to follow this  

  • Create New...

Important Information

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