- Joined
- Feb 13, 2022
- Messages
- 87
Howdy! Simple question is it possible to make it so heroes can mine/collect gold from gold mines without needing a homebase to drop it off? Please let me know if this is possible and how to do it.
Exactly! When they are done collecting the gold they would receive the gold immediately! They don't need to enter the gold mine. I will attempt to make those triggers for the hidden channeling ability, any chance you could make those triggers so I could copy them? If not, your suggestion has helped plenty!What does that mean exactly? When they exit the Gold Mine would you receive the gold immediately? Do they even need to enter the Gold Mine?
What I would:
Create a hidden Channeling ability that your Heroes can cast on Gold Mines. Basically, if you right click the Gold Mine with your Hero then you would order it instead cast this ability on the Gold Mine. Then once they begin channeling the ability you would periodically subtract gold from the mine and add it to the caster. A Unit Indexer + Unit Group + Periodic Interval could get the job done.
Yes it would be forever unless the player starts to move, build, or activate another hero ability, it would be every 5 seconds equals 10 gold from the mine. Thanks dude I appreciate the help a ton, you are going to save me a ton of time! I have the latest version of Warcraft 3 reforged if that makes a difference.If you're on the latest version of Warcraft 3 I can throw something together for you. But just to clarify, would they channel forever and let's say every 5 seconds of channeling receive the gold? That would make the most sense to me. And of course if the Gold Mine is out of gold they will stop and be unable to target it anymore.
Hero not player my bad!Yes it would be forever unless the player starts to move, build, or activate another hero ability, it would be every 5 seconds equals 10 gold from the mine. Thanks dude I appreciate the help a ton, you are going to save me a ton of time! I have the latest version of Warcraft 3 reforged if that makes a difference.
Wow this system works awesomely, thank you it is exactly what I'm looking for! Im having trouble implementing this system into my map. I'm still a novice when it comes to custom script and indexes. Could you take a look at your system in my current map? Here is a link to the current map: Broken CheeseMine in Rat MazeHere you go, hopefully it's to your liking. If you already have a Unit Indexer in your map then DO NOT add another one! They often come with imported systems / custom spells but all you need is one since they all do the same thing.
You are seriously a true gentlemen and a scholar thank you for all the help! Everything works perfectly now thank you so much! How would I make a trigger that kills the gold mines once they hit zero gold? Thank you for pointing that out, It is definitely something I will work on to make my game efficient!Step 1: You'll see in my map I have an ability called Hero Mine Gold. You need to copy and paste this into your map. Then give it to any Hero that you want to be able to harvest gold.
Step 2: In the Trigger Editor you'll want to copy and paste both folders into your map, Unit Indexer and Hero Gold Mine. If you've already imported a Unit Indexer into your map then you don't need another one. Also, if you're ever setting Custom Value in your triggers then know that this will conflict with the Unit Indexer, however, a Unit Indexer provides a much better alternative solution that makes setting Custom Value unnecessary.
Step 3: Looking through the triggers you should see Conditions that 1) Check for a standard Gold Mine and 2) Check for the Hero Mine Gold ability. HOWEVER, since you've imported this into your map these references can get messed up and you may need to update them. So anything that was checking the (Ability being cast) should reference your Hero Mine Gold ability and anything that's referencing a standard Gold Mine should be checking for your Cheese-Mines instead.
These fixes should be fairly simple and straightforward. Also, I'm pretty sure on your version this is already enabled by default but there's a World Editor Preference called "Automatically create unknown variables..." which should be enabled from the File menu. This can help a lot when importing triggers into your map and should be enabled before doing so.
Edit: See these conditions, note how they're referencing an Unknown ability. That should be Hero Mine Gold.
- Hero Mine Gold Order
- Events
- Unit - A unit Is issued an order targeting an object
- Conditions
- (Level of Unknown (CHNL) for (Ordered unit)) Equal to 1
- (Issued order) Equal to (Order(smart))
- Actions
Also, a random bit of advice after glossing over your triggers. You should rarely need to make a unique trigger/variable for each individual player. You can generally achieve everything in a single trigger. For example, creating the Speed Potions for the Rats after 300.00 seconds:
- Hero Mine Gold Cast
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Unknown (CHNL)
- Actions
^ This one trigger will check the life of each Rat (assuming you've added them to RatGroup) and give each of them their own Speed Potion. Note: If you meant to filter out dead Rats then there's a Boolean Condition for that -> Is unit alive/dead. Checking if Life is >= 1.00 is not guaranteed to work since a unit can have < 1.00 life and still be alive.
- fiveminpotion
- Events
- Time - Elapsed game time is 300.00 seconds
- Conditions
- Actions
- Unit Group - Pick every unit in RatGroup and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Life of (Picked unit)) Greater than or equal to 1.00
- Then - Actions
- Item - Create Potion of Speed at (Position of (Picked unit))
- Else - Actions
Also, a variable can be made to work for multiple units/players which will help simplify things. This can be done with Variable Arrays and the Unit Indexer to store data to specific units and Player Numbers to store data to specific players. Combine all of those with Unit Groups / Player Groups and you have an easy way to reference every Player + Unit and any data revolving around them at any given moment in a single trigger.
Also, it looks like you aren't addressing memory leaks. It's not the end of the world and your map should run fine but it's something you may want to look into in the future if you care about improving game performance. There are some rare cases where a user creates a trigger which generates a ton of nasty memory leaks. Something like leaking 100 Unit Groups per second would be quite bad and you'd probably notice better performance if you addressed it.