Advertisement
Guest User

Untitled

a guest
Nov 16th, 2023
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // First manage damaged state, this is independant of room
  2. if (creep.hits < creep.hitsMax) creep.memory.damaged = true;
  3. else if (creep.hits == creep.hitsMax) creep.memory.damaged = false;
  4.  
  5. // Then room logic, and priority to healing right?
  6. if (creep.memory.damaged) {
  7.   creep.moveTo(Game.flags.Flag1); // Flee
  8.   creep.heal(creep); // Heal
  9. } else if (currentRoom === myRoom) {
  10.   creep.moveTo(Game.flags.Flag2); // Assuming the flag is in room 2
  11. } else {
  12.   // if you go in here, that means you are in the right room, AND you are not damaged
  13.   attack_room_with(creep); // This is a function you need to write
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement