ID:1681385
 
Keywords: monster, npc
(See the best response by GhostAnime.)
I want to create a npc (an animal), that the command of a player(specific), he attack other NPC monsters, do not know how to do this, someone could show me?
Best response
Merely one way to do what you said. Obviously there's more to it then shown.

new /Animal(src)  //  Create a new Animal instance (default loc will place it in the mob's content initially)

Animal
var/mob/Owner

New(mob/O) // Called when /Animal is created
Owner = O
if(!Owner || !Owner.client) del src
src.loc = get_step(Owner.loc, Owner.dir) // Place the animal ahead of the user. Check if this may place it in THE VOID.
Owner.verbs += typesof(/Animal/Owner/verb) // Give the owner the owner verbs (ex: dismiss)

Del() // Called when deleted
if(Owner && Owner.client)
Owner.verbs -= typesof(/Animal/Owner/verb)
..() // Without this, the object would never be deleted

Owner/verb
....
In response to GhostAnime
GhostAnime wrote:
Merely one way to do what you said. Obviously there's more to it then shown.

new /Animal(src)  //  Create a new Animal instance (default loc will place it in the mob's content initially)
>
> Animal
> var/mob/Owner
>
> New(mob/O) // Called when /Animal is created
> Owner = O
> if(!Owner || !Owner.client) del src
> src.loc = get_step(Owner.loc, Owner.dir) // Place the animal ahead of the user. Check if this may place it in THE VOID.
> Owner.verbs += typesof(/Animal/Owner/verb) // Give the owner the owner verbs (ex: dismiss)
>
> Del() // Called when deleted
> if(Owner && Owner.client)
> Owner.verbs -= typesof(/Animal/Owner/verb)
> ..() // Without this, the object would never be deleted
>
> Owner/verb
> ....


then used the copy and past, to know whether it will be functional, but it is showing error
In response to Gabriel001
When people show you snippets on the forum, the point is to understand what is going on and not just copy/paste and modify & hope for the best.

Obviously it will give you indentation errors and it is not complete.

Read through, find out what is going on and ask questions about any part you do not understand.

... Just don't expect a plug-and-play snippet on the forum.