31-07-2009, 10:20 PM
I've converted Mirage Source into an online text-based game (See my Virellia MUD thread). I've rewritten most of the core features to work with the style of game, but I've come across a small road block which I need some guidance on.
When a player enters the room, I want a hostile NPC to automatically attack the player, I know this can be done with a loop to check if a player is in the same room as the NPC, if so, initiate attack procedure. However, if there are more players in the same room, I want the NPC to switch between each player every time it attacks.
Most of the code is pretty much the same, so feel free to refer to parts of the code.
I'm using Mirage Source 1.
When a player enters the room, I want a hostile NPC to automatically attack the player, I know this can be done with a loop to check if a player is in the same room as the NPC, if so, initiate attack procedure. However, if there are more players in the same room, I want the NPC to switch between each player every time it attacks.
Most of the code is pretty much the same, so feel free to refer to parts of the code.
I'm using Mirage Source 1.