add NPC question

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
serokon
Posts: 11
Joined: Wed Mar 27, 2013 1:43 am

add NPC question

Post by serokon »

Hey Irrlicht com !!
I was just thinking about add NPC´s but I dont know exactly how to do this.
I add a mesh and a walk cycle to him, should I know add a if function , if the player is near to this mob and
if he is like 2 meters away he attacks him ? But how I say walk to the player ?
I know camera.position but I cant say to npc thats the new position would seem like teleporting :)
A hint how you used multiple npcs (how you designed the array and class) would be nice.
Thanks for help (I use delphi, no code needed but would be nice if you want to explain something :P)
Stauricus
Posts: 20
Joined: Mon Jun 25, 2012 10:12 pm
Location: Uberlandia, Brazil

Re: add NPC question

Post by Stauricus »

well, this is very different from RPG Maker, so there is no thing such as "add npc"

you need to get the player mesh position, then the npc msh position, then compare both. if the distance between them is less than 2 meters, then move the monster towards the player, and if it is less than 20cm (as an example), attack the player.

to move, do something like "wait 0.1seconds, then move 10cm".
serokon
Posts: 11
Joined: Wed Mar 27, 2013 1:43 am

Re: add NPC question

Post by serokon »

Oh thanks for you reply, I see how its working.
I will try it and if I got any problems I write it in that thread, thank you.
Post Reply