Because I don't have 24-hr Internet this week I wasn't able to reply yesterday...
Anyway, I got a few tries at the problem:
1. Giving gold: there are two likely ways to solve this:
- I can just use the "Give Bounty" option so that when a unit [i.e. Gold Rock] dies for Player 5 (Yellow), it automatically gives gold based on what is set in the Object Editor for each Gold Rock unit.
- Or, I can use a trigger to give gold. This is not as easily done as the first one, but after a few tries I chose this method because of a problem... (explained later)
2. Make Gold Rock units turn into Rock units after they die and then turn them back into Gold Rocks after a fixed amount of time: Three ways at this but each comes with a problem:
- I can use pure triggers. It's harder, and I failed to make it work before I gave up... Also, it's tough to make it leakless without using pure JASS. (I could probably make it work eventually, but you are going to have a tough time understanding it too.)
- I can use the "Phoenix Morph (Egg Related)" ability. Remember that when a Phoenix "dies", a Phoenix Egg "spawns"? And after a few seconds, a Phoenix "respawns"? Well, this is the ability that allows it to do so, and I'm using this ability to mimic the "Gold Rock dies > turns to Rock > wait some time > turns to Gold Rock" ability. It worked, but unfortunately "killing" the Gold Rock doesn't actually "kill" it. It merely leaves it at one hit points before turning into Rock. This is probably done that way so that enemy players cannot "kill" Phoenix and leave it as an egg to get XP for their heroes in melee games (i.e. they must completely destroy the egg in order to get XP). And this brings a problem for the give bounty method for giving gold, since if you don't really kill the Gold Rock, you can't get "bounty", or gold. So I needed to use a trigger to give gold instead. (This is the method I'm using)
- A third method involved using a "Spawn Hydra" ability, but instead of spawning hydra, a single Rock is spawned whenever a Gold Rock dies. This worked well, except that every time a Gold Rock dies, the spawned Rock doesn't always spawn at exactly the right point where the Gold Rock died, and this means over time, the rocks will start shifting to somewhere else. Also everytime a rock spawns, a "feral spirit" effect is shown, which is kinda ugly. (I'm referring to the "red lighting shock" special effect that is displayed every time you cast Feral Spirit, or every time a Feral Spirit vanishes.)
Okay, after all this trial and error, it works now (you can probably test it more thoroughly and see if it has any bugs). Also I added a special effect whenever the miner gets gold.
(Reason: when I use the Give Bounty method of giving gold, it always makes that nice special effect, but using triggers means that there's no special effect, so I wanted to improvise.)
Here are the changes I made:
- Created a suite of abilities called "Respawn (###)" all of which are based on "Phoenix Morphing (Egg Related)". If you want to modify the duration during which the rock lives, change the "Stats - Duration - Hero" of the abilities.
- Created 2 triggers: "Ore Respawn Red" & "Ore Respawn Blue", one for each user player (Red & Blue). The triggers give the players gold whenever gold life goes < 1.
- Added custom script function "SpawnEffect", which is basically just decoration. It makes a nice special effect whenever the miner gets gold.
- Added the respective "Respawn (###)" abilities to each gold and rock unit. For example, Gold(500) and Rock(500) both get the ability "Respawn (500)".
- Changed the "Stats - Point Value" of each Gold unit, so that it matches the amount of gold the unit should give. (This is so that I don't have to hard code any gold values into the trigger, since the trigger can just give the amount of gold specified by the "Point Value". The "Point Value" is simply a custom value that each unit has, and can be pre-defined in the Object Editor.)
- Disabled all the "OreDead ***"-type triggers.
Oops, I forgot to attach the file before posting...
Also an extra note:
- I don't get if the gold rock is supposed to be 125 or 120. You have a Gold Rock(125) but a Rock(120)?
I suggest that you look at the map carefully to see all the changes I made and how the respawning works.