Jump to content
  • 0
Sign in to follow this  
hadiesyafiq

How to make npc move direction?

Question

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

 

Image01.jpg

Image02.jpg

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

First, about npc directions

 

Quote

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.

Example:
	setnpcdir(DIR_WEST);

or

 

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

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

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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