ID:161124
Jun 14 2008, 2:05 pm
|
|
Hi, for my game i need a place where you can kill monsters, but you cant actually kill other players. Since they are both mobs, im really confused, is there any way i can make it so that you cant kill other players but you can kill mob monsters?And how would you do it?
|
In response to GhostAnime
|
|
GhostAnime wrote:
Players have clients, thus check if the mob client is there. if(mob.client) world << "PLAYER!!" Of course, if the player left, the mob (unless moved or deleted at Logout()) can be killed. Another common design is to have NPCs and players derive from separate /mob parent types, such as /mob/PC and /mob/NPC. |
In response to GhostAnime
|
|
It is a danger that linkdead players could be killed.
Why not just check to see if they have a key? Mob.key should be null for mobs that never had a client assigned to them. |
In response to Jmurph
|
|
Jmurph wrote:
It is a danger that linkdead players could be killed. Danger? If they remained for some reason, then you probably don't want them to be invulnerable, now. Perhaps you have a system in place against running away from a battle by logging out, or some such. If you didn't want such things to be possible, you'd delete player mobs upon logout, or at least relocate them or some such if deleting was undesired. Why not just check to see if they have a key? Mob.key should be null for mobs that never had a client assigned to them. True, but it isn't quite foolproof either. If a player switches mobs, his old/previous will have a null key. This could cause a problem with, for example, a Body/Mind Control verb of some sort that logs the player into another mob, their original mob will be invulnerable as the game will assume it's an NPC. Likely, the subtype istype() check is the best here. You're probably going to have your path types designed in such subtypes anyway. That way you can know in the basic sense whether a mob is intended to be player-owned or not. |
Of course, if the player left, the mob (unless moved or deleted at Logout()) can be killed.