• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Looped attack and move trigger for multiple units. Help needed.

Status
Not open for further replies.
Level 2
Joined
Oct 9, 2007
Messages
16
Ok, I have a problem concerning orders that I really need help with.

[Overview of the trigger]
-What I am trying to create, is a system which will allow peasants to mine various resources, not just gold and wood.
What I've done is created a system based on items, rather than the ui, for example, the stone resource is counted by the integer variable "stone"
and whenever a peasant strikes a quarry, a grey "+8" appears above his head, and the variable gains an additional 8, all buildings which use stone gain an additional +8 charges to their stone item. this all works fine, and is not causing problems, however...

[The problem]
-What I really want, in order to make the system more lifelike, not too mention, a lot like blizzards, however, The units will just stay in one place, hacking away at the stone, with numbers above their heads. what I really need is for the peasants to go back and forth between the closest town hall and the quarry. I have the idea wrapped up, with the peasants getting the item and its charges and giving it to the building, though here is where the real problem arises, the game crashes when ordered by a trigger to attack the quarry (I don't use harvest in this case, they attack the stone and get the item)

[What I need]
I desperately need two problems fixed here, the first being a way to order the peasant to attack the quarry when the player right clicks on it when selected, the second being a way for the peasant to repeat his harvesting routine when he completes it.

I can't give you the exact trigger at the moment, as I am away from the computer I work on the project with, though I think I know the source of the problem;
there is an action which reads something like this:
order(ordered unit) to attack (target of order)
the crash seems to originate from here, though I cant get the quarry to become the target in any other way I know of, even by ordering the peasant to attack units in the area of the quarry, it still crashes.

any kind of help would be greatly appreciated, I'm new here so I'm sorry if this is in the wrong section of the forum, if it is, let me know.

Thank you
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I don't think that's possible. You can make a statistically Stone resource, but you'll won't be able to display along with the gold and lumber (you can only replace it). There's a very popular (and recent) thread about 'Detecting harvesting', which might be of some use to you.
 
Level 5
Joined
Oct 17, 2006
Messages
151
You could set it up so that your quarry is a gold mine (it would say Resources: instead of Gold: ) that way you can target it with harvest.

Then have a separate ability where if a unit drops off gold (find the unit order for that) and the unit is carrying an item then set current gold - the temporary gold gained and then do your special item stuff.

You would have to find a system for detecting a worker dropping resources off though...
 
Level 2
Joined
Feb 1, 2009
Messages
11
Possibility...

I'm working on limited knowledge at the moment, but do the peasants really need to attack the quarry? You might be able to get away with moving them there, orienting them towards the quarry (making them face it), then running the attack animation for them.

It could work fairly simply:

Peasant is spawned, move to area.
A trigger in the area causes the peasant to face quarry, perform attack animation, give item to peasant, display floating text, wait 1 second (for the animation to finish), move to town hall.
Town hall trigger detects the item, updates your variable, and shuffles your peasant back to the mine (or another one based on another variable that can be altered in game).

Let me know if this doesn't make any sense...
 
Level 5
Joined
Oct 17, 2006
Messages
151
he could still do it my way with the other resources but honestly if your doing Avator's way ditch it! that would be lame to only have 2 resources show and the rest in some board.... =)
 
Level 2
Joined
Oct 9, 2007
Messages
16
I'm not too fussed with the resources portrail, I'm not changing the gold or lumber resource display on the ui or attempting to add more onto the ui, that would either be impossible or not worth the effort. the way I solve it is to have the resources show up as items on town halls across the map, and that works well. you can sell these additional resources at a marketplace to buy gold to recruit troops so that system is moving smoothly.

The real problem is getting the peasants to move about in a fashion similar to blizzards original peasants movement. on that note;

Darkelvensfi: thank you, I like your idea, that may just work and i am going to try it, my only concern is the complexity of getting every peasant on the map to continue this routine, I can't use any wait commands (though to be fair I wasnt using them anyway) as the game will get horribly confused, though this animation idea is a good direction, if more complex.

Does anyone out there have either a good way to put this idea together or a different solution altogether? don't be shy to speak out
 
Level 2
Joined
Oct 9, 2007
Messages
16
Also avator, thank you for the help, but it's not what I'm concerned about :X sorry, but thank you nontheless!
 
Status
Not open for further replies.
Top