5

I am programming a script for my guards, if the guard can't move, make the guard commit suicide, so my system can spawn a new one again.

But how do I do that? It's not listed in the docs. I am looking for something like this:

creep.commitSuicide();

2 Answers 2

8

New method Creep.suicide() has been added to the API today (changelog).

2
  • 1
    Does this make it drop energy too?
    – joppiesaus
    Dec 1, 2014 at 18:26
  • 2
    Yes it does, the behavior is the same as when it's killed.
    – artch
    Dec 2, 2014 at 8:12
1
creep = null;

This will make the creep "commit suicide" and dropping all it's energy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .