Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Enemy & NPC like conversation

New Here ,
Jan 27, 2013 Jan 27, 2013

Hello, I was wondering how make an enemy that follows the character around, but the enemy is just in one position (horizon position let say) so it just follow the character left and right.

also is there any example or better explanation how to make a RPG npc like mechanism when character come close to it or hit key it will start talking.

Thank you.

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 27, 2013 Jan 27, 2013
Translate
LEGEND ,
Jan 27, 2013 Jan 27, 2013

For either case you want to know about, you need some form of continuous monitoring to keep track of things and make changes when certain changes occur.

To have the enemy follow the left and right movement of the character, any time the character moves you need to have the enemy horizontal property (x) changed to be equal to it.

To have a dialogue open due to proximity of two objects you need to constantly monitor the distance between them and define a limit that when exceeded will trigger the dialogue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

Hi, thank you for your reply.

I kind of worked out the enemy follow character:

if(char.x < enemy.x){

enemy.x -= enemySpeed;

{

thats how i did it, i know its not the best way of doing it but for beginner i think its good 😕 somehow.

On the dialogue can you give an example how to do it? I'm planning to trigger it when a key is pressed instead, and character will not able to move while the character is still talking to the npc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 27, 2013 Jan 27, 2013

If yiou are currently using a keyboard listener to control movement then you just need to include a text within the existing event handler function to check if the key that was used is the key to invoke the dialogue and if so, make the dialogue element appear.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

Yeah, it works if its just a pop-up text with single line, but i want it to be like a conversation then have choices like "Keep talking" , "Get quest" , "Don't want to talk" If you get what i meant.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 27, 2013 Jan 27, 2013

And what are you expecting someone to do for you to realize what you want?  Create a movieclip that has the features you want and assign keyboard controls for the different items you list if that is your intention.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

Nope, im trying to find if someone has a sample link how to do it, not asking if someone can do it for me... 😕

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 27, 2013 Jan 27, 2013
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines