• 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] Detect amount of lumber and stop

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,205
Edit: I have solved it by myself. If you want to learn, post message in here. I am not sharing directly because i gave up and changed system. That means i am actually not solved this one.

Code:
lumber stock
    Events
        Player - Player 1 (Red)'s Current lumber becomes Greater than or equal to 10.00
    Conditions
    Actions
        Game - Display to Player Group - Player 1 (Red) the text: KUTUKMAX
        Set P1KutukMax = True

Code:
lumber stop
    Events
        Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
    Conditions
        (Issued order) Equal to (Order(harvest))
        P1KutukMax Equal to True
    Actions
        Game - Display to Player Group - Player 1 (Red) the text: MAX KUTUK
        Unit - Order (Triggering unit) to Stop


Here it is what i try to do.

You have 1 worker and you can gather lumber and return to your Lumber Mill
If you have 20 wood, your worker cannot return lumber to your mill.


But it seems i have messed. I am not familiar with order triggers. What am i missing?
 
Last edited:
Level 5
Joined
Mar 5, 2015
Messages
135
I think what might be happening is that, the first trigger is fired after the other trigger, so it doesn't register that it shouldn't harvest before returning.
A good idea would be to print some message on in the first trigger to debug

There is another solution which would be to add the harvesting unit to a group, and then order all units in that group to stop when the limit is reached.

Not too sure however, how it will work if you order the unit to harvest again.
 
Level 18
Joined
Jun 2, 2009
Messages
1,205
I think what might be happening is that, the first trigger is fired after the other trigger, so it doesn't register that it shouldn't harvest before returning.
A good idea would be to print some message on in the first trigger to debug

There is another solution which would be to add the harvesting unit to a group, and then order all units in that group to stop when the limit is reached.

Not too sure however, how it will work if you order the unit to harvest again.

I have solved it by myself thank you for your aid
 
Level 5
Joined
Mar 5, 2015
Messages
135
Nice! It's always best to realize the solution yourself (y) Good luck with your project
 
Level 5
Joined
Mar 5, 2015
Messages
135
Ah, fair enough ;) Well that's also sort of solution; rethinking the problem/solution
 
Status
Not open for further replies.
Top