Search code examples
screeps

How do you attack structures in Screeps?


I can attack other creeps just not the structures and I want to know how you do that, I have looked everywhere for an answer but everything I find is about how to attack another creep.


Solution

  • It's the same as attacking a creep.

    creep.attack(structure);
    

    Documentation is here: https://docs.screeps.com/api/#Creep.attack

    The only difference, is when you're attacking a controller, which is different because it requires CLAIM body parts.

    Documentation: https://docs.screeps.com/api/#Creep.attackController