I want my creeps to attack healers first if there is any in range but in order for me to do that I need to be able to find some array that holds a list of their body parts. Does any such member variable exist within the creeps object?
Geners
@Geners
Posts made by Geners
-
Is there a way to check to body parts of a creep?
-
Community updates
It would be really nice to have more community functions to the site. A bigger forum, pings so you know when people have replied to you or your topics, private messages, friends lists. It would make this feel more like a community driven game and less like a single player tournament.
-
Healers trying to heal themselves.
A lot of people (me included) run into an issue where when we make a healer class where the healers purpose is to heal the closest ally to them, they often just stop functioning when they get hurt.
Welp, it's an easy fix. The healer is just trying to heal itself which is the closest wounded thing to it, which is can't.
SO we do this
var target = creep.pos.findClosest(FIND_MY_CREEPS, { filter: function(object) { return (object.hits < object.hitsMax) && (object.name != creep.name); } });
Basically we just tell our healer creep, that if the person he finds damaged is himself, move on to the next person.
-
RE: Issue with creep.moveTo
I figured out the problem
in main I put if(creep.memory.role = 'tower') instead of if(creep.memory.role == 'tower') i forgot to add a = sign to switch from an assignment operator to a logical equals operator. Thanks guys!
-
Issue with creep.moveTo
I have a harvester module
module.exports = function(creep) { if(creep.energy < creep.energyCapacity) { var sources = creep.room.find(FIND_SOURCES); creep.moveTo(sources[3]); creep.harvest(sources[3]); } else { creep.moveTo(Game.spawns.Spawn1); creep.transferEnergy(Game.spawns.Spawn1) } }
and I have a tower module
module.exports = function(creep,towerStart) { var enemy = creep.pos.findClosest(FIND_HOSTILE_CREEPS); if(enemy) { creep.rangedAttack(enemy); } creep.moveTo(TowerStart, 32); }
But when I run both of them, my harvesters instead of harvesting materials, they movetTo the area where my towers are supposed to go and my towers do not move. It's not a problem with memory because if I take out that moveTo in the tower module both creep types work fine.
-
I wish I could get my friends into this game
But I'm the only person in my friend group interested in programming.
-
How can you tell if you've defeated an enemy?
Is there some kind of function or something that checks if an enemy is defeated?
-
RE: Small snippet to clear the memory of dead creeps.
Is this just to free up memory? Or?...
-
In PVE mode my
Guards I create always go for the two red dots at the top center.
I have them set to attackGame.creeps.guard1.room.find(FIND_HOSTILE_CREEPS);
I store this in a variable and then I use it as a targettarget[0]
for my guards to fight. However I don't think I fully understand how the find array works. Does[0]
not give me to closest enemy objects but something else?A brief explanation of what find returns might suffice.