Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list my Walls [Screeps]

Tags:

screeps

When I build a new wall using Creep.build(), it creates wall with 1 hit point. Now I am trying to create a creep which repairs these newly constructed walls. But I am not able to figure a good way to list and iterate on these wall objects.

Game.structures doesn't contain these since walls doesn't belong to a player. The only approach I could find was Game.getObjectById(objectId) where id is copy pasted from my game' ui (right panel).

like image 616
gaurav Avatar asked Oct 15 '25 07:10

gaurav


1 Answers

var repairit = creep.room.find(FIND_STRUCTURES, { 
   filter: (structure) => { 
       return ((structure.hits < 5000) && (structure.hits > 0))
   }
});

this repairs everything in a room, I'll give you a hint towards walls

structure.structureType == STRUCTURE_WALL
like image 106
Alex Avatar answered Oct 20 '25 07:10

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!