- Joined
- Sep 25, 2013
- Messages
- 717
Hi! Im working on adding additional resources to my game such as food and stone. Everything is working fine so far. I made food in the form of pigs which you slaughter with an ability they have. This replaces them with a neutral hostile slaughtered pig unit that only workers can attack. You gain a certain amount of food every time a worker hits the slaughtered pig.
The problem i have is that when i set a town center's rally point to a slaughtered pig, the workers that are trained move to the rally point but don't attack the slaughtered pig unless i manually command them to. I want to make it so if the rally point is set to a slaughtered pig or a stone ore pile, the trained workers will automatically go and attack them.
How would i go about doing this. I couldn't find a way to have a trigger that checks what the rally point is set to. If i could i would make so if the rally point is set to a slaughtered pig then trained workers would attack it. I thought maybe when units are trained the rally point gives them a command, so i made a trigger that triggers when workers are commanded to move to a slaughtered pig, they are re-ordered to attack it.
But this trigger crashed the map. Does anyone have an idea of how to make this work? Thank you if you do!
The problem i have is that when i set a town center's rally point to a slaughtered pig, the workers that are trained move to the rally point but don't attack the slaughtered pig unless i manually command them to. I want to make it so if the rally point is set to a slaughtered pig or a stone ore pile, the trained workers will automatically go and attack them.
How would i go about doing this. I couldn't find a way to have a trigger that checks what the rally point is set to. If i could i would make so if the rally point is set to a slaughtered pig then trained workers would attack it. I thought maybe when units are trained the rally point gives them a command, so i made a trigger that triggers when workers are commanded to move to a slaughtered pig, they are re-ordered to attack it.
Code:
Untitled Trigger 002
Events
Unit - A unit Is issued an order targeting an object
Conditions
((Ordered unit) has buff Worker (All)) Equal to True
Or - Any (Conditions) are true
Conditions
(Unit-type of (Target unit of issued order)) Equal to Slaughtered Pig (Nature)
(Unit-type of (Target unit of issued order)) Equal to Gold Ore (Nature)
Actions
Unit - Order (Ordered unit) to Attack (Target unit of issued order)
But this trigger crashed the map. Does anyone have an idea of how to make this work? Thank you if you do!