Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / attack closest npc?

Author
Message
David iz cool
20
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 9th Jul 2010 20:26 Edited at: 9th Jul 2010 20:27
how do u check for an enemy npc to attack the closest friendly npc in your party????
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 9th Jul 2010 20:29
Do a distance check between the enemy NPC and all friendly NPCs, and determine which is closest.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Jul 2010 22:55
No need to check the "actual" distance, just leave the results squared then compare them to determine the closest as Benjamin said. Depending how many NPCs you're checking, it could save several frame rates.


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke

Login to post a reply

Server time is: 2026-07-25 08:13:41
Your offset time is: 2026-07-25 08:13:41