• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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