• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dat Goldmine Bug-Fix 1.04

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This system will fix the bug where your workers will instant mine when the town hall object is too close to the mine. It adds a delay before your workers can mine more.

I was inspired by this thread three hours ago to make this system as well I felt that this was needed since there could be forgotten threads where people never received help so the people that need help with this type of system now can get that help hopefully. Plus it's unique/original.

The only system that had something even close to this was http://www.hiveworkshop.com/forums/spells-569/gold-mine-distance-remover-v1-01-a-223835/?prev=search%3Dmine%26d%3Dlist%26r%3D20 .

[trigger=Trigga's]
Dat DPGM Configs
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Set A_Dat_DR_DefaultTime = 20
Set A_Dat_DR_DefaultCountDown = 1
Set A_Dat_DR_DistanceCheck = 250.00
[/trigger]
[trigger=]
Dat DR
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(resumeharvesting))
Actions
Set tempinteger = (Custom value of (Triggering unit))
Set tempunit = (Target unit of issued order)
-------- Cleaning unit references. . . --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
A_Dat_DR_Hall[tempinteger] Not equal to No unit
Then - Actions
Set A_Dat_DR_Hall[tempinteger] = No unit
Else - Actions
Set A_Dat_DR_Hall[tempinteger] = tempunit
Set Dat_DR_Spot1 = (Position of tempunit)
Set tempunit = (Triggering unit)
Set tempinteger = (Custom value of tempunit)
Unit - Turn collision for tempunit Off
Set Dat_DR_Spot2 = (Position of tempunit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Dat_DR_Spot1 and Dat_DR_Spot2) Less than or equal to A_Dat_DR_DistanceCheck
(tempunit is in Dat_DR_Group) Equal to False
Then - Actions
Unit - Order tempunit to Hold Position
Unit Group - Add tempunit to Dat_DR_Group
Set A_Dat_DR_TimeLeft[tempinteger] = A_Dat_DR_DefaultTime
Set A_Dat_DR_GroupNumber = (A_Dat_DR_GroupNumber + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
A_Dat_DR_GroupNumber Equal to 1
Then - Actions
Countdown Timer - Start Dat_DR_Timer as a Repeating timer that will expire in 0.10 seconds
Else - Actions
Else - Actions
Custom script: call RemoveLocation(udg_Dat_DR_Spot1)
Custom script: call RemoveLocation(udg_Dat_DR_Spot2)
[/trigger]
[trigger=]
Dat Loop
Events
Time - Dat_DR_Timer expires
Conditions
Actions
Unit Group - Pick every unit in Dat_DR_Group and do (Actions)
Loop - Actions
Set tempunit2 = (Picked unit)
Set Dat_DR_Spot1 = (Position of A_Dat_DR_Hall[(Custom value of tempunit2)])
Set Dat_DR_Spot2 = (Position of tempunit2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between Dat_DR_Spot1 and Dat_DR_Spot2) Less than or equal to 50.00
Then - Actions
Set tempinteger = (Custom value of tempunit2)
Set A_Dat_DR_StartCount[tempinteger] = True
Unit - Hide tempunit2
Else - Actions
Custom script: call RemoveLocation(udg_Dat_DR_Spot1)
Custom script: call RemoveLocation(udg_Dat_DR_Spot2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
A_Dat_DR_TimeLeft[(Custom value of tempunit2)] Less than or equal to 0
Then - Actions
Set A_Dat_DR_GroupNumber = (A_Dat_DR_GroupNumber - 1)
Set tempinteger = (Custom value of tempunit2)
Set A_Dat_DR_StartCount[tempinteger] = False
Unit - Unhide tempunit2
Unit - Turn collision for tempunit2 On
Unit - Order tempunit2 to Harvest Nearby Gold
Unit Group - Remove tempunit2 from Dat_DR_Group
Else - Actions
Set tempinteger = (Custom value of tempunit2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
A_Dat_DR_StartCount[tempinteger] Equal to True
Then - Actions
Set A_Dat_DR_TimeLeft[tempinteger] = (A_Dat_DR_TimeLeft[tempinteger] - A_Dat_DR_DefaultCountDown)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
A_Dat_DR_GroupNumber Less than or equal to 0
Then - Actions
Countdown Timer - Pause Dat_DR_Timer
Else - Actions
[/trigger]


Keywords:
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,And now you know your alphabet!,!,Tal0n,Dat,C3,-,@,#,$,%,^,&,*,(,),1,2,3,4,5,6,7,8,9,0,epic,ca
Contents

Dat APGM (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. 10:24, 10th Apr 2015 IcemanBo: Read the post in thread.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: For long time as NeedsFix. Rejected.

10:24, 10th Apr 2015
IcemanBo: Read the post in thread.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
Ok, here it comes:
Maybe add some comments on the first two lines of configuration to make it clear what it does.
  • Set A_Dat_DR_Hall[(Custom value of (Triggering unit))] = No unit
  • Set A_Dat_DR_Hall[(Custom value of (Triggering unit))] = tempunit
If you make that, then makes this:
  • Dat DR
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(resumeharvesting))
    • Actions
      • Set tempunit = (Target unit of issued order)
      • Set A_Dat_DR_Hall[(Custom value of (Triggering unit))] = No unit
      • Set A_Dat_DR_Hall[(Custom value of (Triggering unit))] = tempunit
      • Set Dat_DR_Spot1 = (Position of tempunit)
      • Set tempunit = null <-------------------------------
      • Set tempunit = (Triggering unit)
      • Unit - Turn collision for tempunit Off
      • Set Dat_DR_Spot2 = (Position of tempunit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Dat_DR_Spot1 and Dat_DR_Spot2) Less than or equal to A_Dat_DR_DistanceCheck
          • ((Triggering unit) is in Dat_DR_Group) Equal to False
          • ((Triggering unit) is in Dat_DR_Group2) Equal to False
        • Then - Actions
          • Unit - Order tempunit to Hold Position
          • Unit Group - Add tempunit to Dat_DR_Group
          • Set A_Dat_DR_TimeLeft[(Custom value of tempunit)] = A_Dat_DR_DefaultTime
          • Set A_Dat_DR_GroupNumber = (A_Dat_DR_GroupNumber + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_Dat_DR_GroupNumber Equal to 1
            • Then - Actions
              • Countdown Timer - Start Dat_DR_Timer as a Repeating timer that will expire in 0.10 seconds
            • Else - Actions
        • Else - Actions
      • Set tempunit = null <----------------
      • Custom script: call RemoveLocation(udg_Dat_DR_Spot1)
      • Custom script: call RemoveLocation(udg_Dat_DR_Spot2)
  • Dat Loop
    • Events
      • Time - Dat_DR_Timer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Dat_DR_Group and do (Actions)
        • Loop - Actions
          • Set tempunit2 = (Picked unit)
          • Set Dat_DR_Spot1 = (Position of A_Dat_DR_Hall[(Custom value of tempunit2)])
          • Set Dat_DR_Spot2 = (Position of tempunit2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Dat_DR_Spot1 and Dat_DR_Spot2) Less than or equal to 50.00
            • Then - Actions
              • Set A_Dat_DR_StartCount[(Custom value of tempunit2)] = True
              • Unit - Hide tempunit2
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Dat_DR_Spot1)
          • Custom script: call RemoveLocation(udg_Dat_DR_Spot2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_Dat_DR_TimeLeft[(Custom value of tempunit2)] Less than or equal to 0
            • Then - Actions
              • Set A_Dat_DR_GroupNumber = (A_Dat_DR_GroupNumber - 1)
              • Set A_Dat_DR_StartCount[(Custom value of tempunit2)] = False
              • Unit - Unhide tempunit2
              • Unit - Turn collision for tempunit2 On
              • Unit - Order tempunit2 to Harvest Nearby Gold
              • Unit Group - Add tempunit2 to Dat_DR_Group2
              • Set A_Dat_DR_GroupNumber2 = (A_Dat_DR_GroupNumber2 + 1)
              • Set A_Dat_DR_TimeLeft2[(Custom value of tempunit2)] = 10
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_Dat_DR_GroupNumber2 Equal to 1
                • Then - Actions
                  • Countdown Timer - Start Dat_DR_Timer2 as a Repeating timer that will expire in 0.10 seconds
                • Else - Actions
              • Unit Group - Remove tempunit2 from Dat_DR_Group
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_Dat_DR_StartCount[(Custom value of tempunit2)] Equal to True
                • Then - Actions
                  • Set A_Dat_DR_TimeLeft[(Custom value of tempunit2)] = (A_Dat_DR_TimeLeft[(Custom value of tempunit2)] - A_Dat_DR_DefaultCountDown)
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_Dat_DR_GroupNumber Less than or equal to 0
        • Then - Actions
          • Countdown Timer - Pause Dat_DR_Timer
        • Else - Actions
->
  • Dat Loop
    • Events
      • Time - Dat_DR_Timer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Dat_DR_Group and do (Actions)
        • Loop - Actions
          • Set tempunit2 = (Picked unit)
          • Set Dat_DR_Spot1 = (Position of A_Dat_DR_Hall[(Custom value of tempunit2)])
          • Set Dat_DR_Spot2 = (Position of tempunit2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Dat_DR_Spot1 and Dat_DR_Spot2) Less than or equal to 50.00
            • Then - Actions
              • Set A_Dat_DR_StartCount[(Custom value of tempunit2)] = True
              • Unit - Hide tempunit2
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Dat_DR_Spot1)
          • Custom script: call RemoveLocation(udg_Dat_DR_Spot2)
          • -------- =========CHANGE TO THIS ORDER BELOW========== --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_Dat_DR_StartCount[(Custom value of tempunit2)] Equal to True
            • Then - Actions
              • Set A_Dat_DR_TimeLeft[(Custom value of tempunit2)] = (A_Dat_DR_TimeLeft[(Custom value of tempunit2)] - A_Dat_DR_DefaultCountDown)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_Dat_DR_TimeLeft[(Custom value of tempunit2)] Less than or equal to 0
            • Then - Actions
              • Set A_Dat_DR_GroupNumber = (A_Dat_DR_GroupNumber - 1)
              • Set A_Dat_DR_StartCount[(Custom value of tempunit2)] = False
              • Unit - Unhide tempunit2
              • Unit - Turn collision for tempunit2 On
              • Unit - Order tempunit2 to Harvest Nearby Gold
              • Unit Group - Add tempunit2 to Dat_DR_Group2
              • Set A_Dat_DR_GroupNumber2 = (A_Dat_DR_GroupNumber2 + 1)
              • Set A_Dat_DR_TimeLeft2[(Custom value of tempunit2)] = 10
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_Dat_DR_GroupNumber2 Equal to 1
                • Then - Actions
                  • Countdown Timer - Start Dat_DR_Timer2 as a Repeating timer that will expire in 0.10 seconds
                • Else - Actions
              • Unit Group - Remove tempunit2 from Dat_DR_Group
            • Else - Actions
          • -------- ====================================== --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_Dat_DR_GroupNumber Less than or equal to 0
        • Then - Actions
          • Countdown Timer - Pause Dat_DR_Timer
        • Else - Actions
This way, you don't have a delay of 0.10 seconds, and makes more sense.
Questions: Why you use a timer? You dont need to make a variable timer, it's unnecessary, use "every X game time seconds", and then turn off trigger when needed.
Why you have another timer?
  • Countdown Timer - Start Dat_DR_Timer2 ????? as a Repeating timer that will expire in 0.10 seconds
???????
Why another group?
  • Set A_Dat_DR_GroupNumber2 = (A_Dat_DR_GroupNumber2 + 1)
????
 
Ok, here it comes:
Maybe add some comments on the first two lines of configuration to make it clear what it does.
Okay added, getting rid of unit references is very important since we're dealing with something more limited then WC3's in-game stuff... That's WC3's allowed RAM usage before the fatal and/or freezes/problems occur.

This way, you don't have a delay of 0.10 seconds, and makes more sense.
Questions: Why you use a timer? You dont need to make a variable timer, it's unnecessary, use "every X game time seconds", and then turn off trigger when needed.
Why you have another timer?
I like the delay so nope not changing it. Timer's are better then the game play timer because you can turn it off as well have more control over it. Oh, and its more accurate as well while running a bit smoother.
Why another group?
It was there for testing purposes, I either forgot or was too lazy to remove those.... I think it was rather both.
Edit:
Amazingly I somehow quoted your entire post in near-perfect English without even noticing it until now. . . Cool.
New version soon, will have fixed all reported bugs and speed-focused requests.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
Okay added, getting rid of unit references is very important since we're dealing with something more limited then WC3's in-game stuff... That's WC3's allowed RAM usage before the fatal and/or freezes/problems occur.
But still, you didn't null tempunit yet, or am I wrong? Also, why you need another tempunit2? Is it testing stuff yet?

Oh, and its more accurate as well while running a bit smoother.
Uh...just for you to know: timers are timers, "every X seconds of game time" is a timer too, so they are as accurate as timers.

In your loop trigger, you could just set tempinteger to the custom value of the unit instead of placing it repeatly inside ITEs and stuff.
 
Describe the purpose of your system, and why/when people should use it.
It's so your workers don't instant-mine. Well people should use it to fix 200 or lower distance with workers mining gold mines, people should use it now in this day and age since only custom resource systems could fix this in the past, now we have two choices.

But still, you didn't null tempunit yet, or am I wrong? Also, why you need another tempunit2? Is it testing stuff yet?


Uh...just for you to know: timers are timers, "every X seconds of game time" is a timer too, so they are as accurate as timers.

In your loop trigger, you could just set tempinteger to the custom value of the unit instead of placing it repeatly inside ITEs and stuff.

Don't need to null a non-array/local variable according to popular demand. To reference two units instead of using one function call.

Nope, gameplay timers continue to run when the trigger is off and don't exactly count properly either. So nope.

It'd require me to repeat tempunit then and I would rather just repeat an integer.
 
I did not really understand when to use this system.
Also please add the description to your spell submission, so people don't have to search for it in thread.

Well you use it when your either annoyed of not being able to select your worker or you want to get rid of the bug where it mines three/twice times as fast. Okay. :thumbs_up:
 
- Honestly I still don't understand how you fix a "bug" with it. Workers just mine the gold and bring it back, that's normal.
- Doesn't work correctly. Going close to gold mine with the tank made the worker completly stop.
- Your prefixes are inconsequent. Use the same abbreviation for all. Also for your "temp" variables.
- Need of descriptive comments.
 
Top