Page 1 of 1

add NPC question

Posted: Thu May 02, 2013 10:17 am
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)

Re: add NPC question

Posted: Thu May 02, 2013 12:55 pm
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".

Re: add NPC question

Posted: Mon May 06, 2013 9:49 am
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.