Screeps Creep.attack(): Melee Range, ATTACK Parts, and Return Codes
Use Creep.attack() with the correct range-1 boundary, active ATTACK parts, documented return codes, Rampart behavior, and later-tick verification.
ARTICLE LIBRARY
Browse 81 published guides by system, difficulty, content type, or topic. Start with What Is Screeps? A Programming Strategy Game or follow the beginner sequence through How to Combine Your First Screeps Room Loop.
Use Creep.attack() with the correct range-1 boundary, active ATTACK parts, documented return codes, Rampart behavior, and later-tick verification.
Find injured owned Creeps, rank lower hit ratios before missing hits and nearest-Tower range, require active owned Towers with TOWER_ENERGY_COST, save heal() results, avoid caching stale targets, and leave over-heal optimization to a later dispatcher.
Bind one reviewed boolean change to the exact Rampart, reserve that ID for the tick, record pending evidence only after OK, and verify the same object's isPublic state on the next tick.
Bind confirmation to the exact Extension and owned room, block hostile Creeps and Power Creeps, submit one queued destroy call, then distinguish original-ID removal from a later replacement at the tile.
Report progress and remaining work, submit one tracked build intent, match the exact Builder and Site in the next tick's EVENT_BUILD record, and separate completion from removal.
Set room-specific Wall and Rampart stages, reserve targets across repairers, record only accepted repair calls, and verify the exact Repairer-to-structure EVENT_REPAIR on the next tick.
Bind confirmation to the exact Nuker and target, record only an accepted launch, verify the launcher's zeroed resources and cooldown, and match the exact Nuke object when target vision exists.
Bind one target and each Tower ID, estimate range- and Power-adjusted output for allocation, submit one attack intent per Tower, then verify exact prior-tick ranged-attack events instead of inferring a volley from net hits.
Preserve a defense Energy reserve, select an ordinary damaged structure, estimate range-adjusted repair to limit over-repair, submit one intent per Tower, then verify exact prior-tick repair events and Energy spent.
Use a one-time Memory request, validate a visible room and 0–49 coordinates, allow Road placement on natural wall terrain, reject an existing Road or Construction Site, respect MAX_CONSTRUCTION_SITES, disable before createConstructionSite(), and verify later.
Confirm RCL 2, place one Extension Construction Site, make Builder1 harvest and build it, and understand progress, capacity, and common failure states.
Give Builder1 a clear priority: build owned sites, repair selected damaged structures, and upgrade the Controller when no higher task exists.
English articles are published only after source review, official API checks where applicable, JavaScript syntax review where code is present, duplicate-intent and link checks, and editorial review. Publication does not imply Console or multi-tick live-room verification; those evidence states remain separate in each guide. Review the verification method.