I dont know how to make a collector choose a specific item but in the hints says that you need to do like this def always fire(): then reutrn 'fire
i tried that but it wont work
You also need this line, otherwise it wont work
hero.chooseItem = alwaysFire
Yeh i know i do like this hero.on('spawn-merger' , hero.chooseItem)
and the merger just stand still
Try posting your code, maybe an error is stopping it.
Ok wait for a while
count = 0;
def a(data):
unit = data.target
while True:
unit.moveXY(70,50)
def collectHandler(data):
unit = data.target
while True:
if unit.item:
unit.bring()
else:
fruit = unit.findNearestFruit()
if fruit:
unit.pick(fruit)
def a(collector):
return "fire"
hero.chooseItem = a
hero.spawnCollector()
hero.on('spawn-merger' , hero.chooseItem)
hero.spawnCollector()
hero.transform(hero.findMyCollectors()[0], 'merger')
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
while True:
if hero.earth >= 4:
hero.cast("earth-arrow")
elif hero.water >= 4:
hero.cast("water-arrow")
elif hero.fire >= 4:
hero.cast("fire-arrow")
Its just a sample code bc im just trying is it working or not if i use a collector(meger)
You defined “a” twice
Here:
and here:
Give one of the functions a different name, it should work
and be specific of which function you want to call
still dont work
count = 0;
def a(data):
unit = data.target
while True:
unit.moveXY(70,50)
def collectHandler(data):
unit = data.target
while True:
if unit.item:
unit.bring()
else:
fruit = unit.findNearestFruit()
if fruit:
unit.pick(fruit)
def fire(collector):
return "fire"
hero.chooseItem = fire
hero.spawnCollector()
hero.on('spawn-merger' , hero.chooseItem)
hero.spawnCollector()
hero.transform(hero.findMyCollectors()[0], 'merger')
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
hero.spawnCollector()
while True:
if hero.earth >= 4:
hero.cast("earth-arrow")
elif hero.water >= 4:
hero.cast("water-arrow")
elif hero.fire >= 4:
hero.cast("fire-arrow")
The merger isn’t finding a target, try putting this piece in the while true loop
Tried it still doesnt work merger is walking towards the mana but not firemana just random mana
I dont know, when I first tried it, this function didn’t work, maybe its a bug. @Chaboi_3000 can you please check?
I want to try this bc like hello can to this so for some reason i want to try it
Hi sorry, I’m not too familiar with SB so it’s probably better to ask Bryukh.
Can you please check this @Bryukh?
To check what exactly? There are many messages – which one I need to check?
Please, read the documentation. chooseItem
is for collector. Event handler are for transformed units. For transformed units you need to write the controling code. You are trying to use the collector choosing callback as an event handler for units.
So this only works for untransformed collectors as I understand
Ahhhh ok thank you for your information