• 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.

[General] maximum workers harvesting a 'tree'?

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
I've read a tutorial about HashTables, and looks pretty handy. But I can't seem to get the event right to check if unit harvests a 'tree', here are my triggers (I have added display text to check if the trigger works):

  • Create Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • Worker harvests mineral
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) is A peon-type unit) Equal to True
      • (Destructible-type of (Target destructible of ability being cast)) Equal to Minerals
    • Actions
      • Game - Display to (All players) the text: (Load (Key (Target destructible of ability being cast)) of 1 from Hashtable)
      • Hashtable - Save ((Key (Target destructible of ability being cast)) + 1) as (Key (Target destructible of ability being cast)) of 1 in Hashtable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load (Key (Target destructible of ability being cast)) of 1 from Hashtable) Greater than or equal to 2
        • Then - Actions
          • Hashtable - Save ((Key (Target destructible of ability being cast)) - 1) as (Key (Target destructible of ability being cast)) of 1 in Hashtable
          • Set TEMP_RegionWorker = (Region centered at (Position of (Casting unit)) with size (600.00, 600.00))
          • Unit - Order (Casting unit) to Harvest (Random destructible in TEMP_RegionWorker matching ((Matching destructible) Not equal to (Target destructible of ability being cast)))
          • Custom script: call RemoveRect(udg_TEMP_RegionWorker)
        • Else - Actions
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
Is your harvest an ability?
, it is the normal harvest (gold and lumber) from peasant/peon etc. I tested it and alas Wcr3 does not see this as an ability for the event 'starts the effect of an ability'.

Is there a passive ability that is triggered by this event? Maybe something like bash, pulverize, liquid fire, poison (/envenomed spears /slow poison)?

u should just save a boolean. true or false. if unit is harvesting tree save false. then u can structure it as a load condition to see if the tree is true.
, but the problem is the event, how do you check if the worker is harvesting? I am trying not to use periodic events as much cause that is a bit heavy for the map.

, if you use units as resources (like ruleofiron did there), than you could just use the hashtable triggers I have written above and just replace event and conditions with a unit is attacked event & the appropiate conditions (unless I overlook something there, that is a way easier and is less heavy -> no periodic events required).
 
Status
Not open for further replies.
Top