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();
up vote 7 down vote accepted

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

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

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

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.