The basic idea is that you store the unit-type of each wave in an array. You fill the array at map initialization in such a way, that the array index corresponds to the wave's number
(i.e. index 1 = wave 1, index 5 = wave 5). You keep track of current wave number in an integer variable.
When you want to create new wave of creeps, you check the unit-type in the array under index of the new wave's number.
I am not sure if you are talking about receiving gold for killing creeps in a wave or talking about receiving gold for selling your own towers, so I will answer for both options
Receiving gold for killing creeps:
You can use the bounty system - in Object editor you can set gold and lumber bounty for each unit (see 'Stats - Gold/Lumber Bounty Awarded' fields). If you want a static bounty, then just set the amount in the '- Base' field and leave the '- Number of Dice' and '- Sides per Dice' fields as 0.
By default, only Neutral units award bounty, but you can override that via triggers. For example the below will award bounty to any player that kills player 2 (Blue)'s units:
-
Melee Initialization
-

Events
-

Conditions
-

Actions
-


Player - Turn Gives bounty On for Player 2 (Blue)
Receiving gold for selling your own towers:
There are multiple approaches - starting from using some abilities to triggering the entire thing yourself. Other people may know of a better way, but what comes to my mind is using a modified version of the Alchemist Hero's Transmute ability. The cool thing about transmute is that it gives you a portion of the unit's original lumber and gold cost and you can configure how big that portion should be.
So the approach here would be as follows:
- Create an ability that does nothing and that requires no target. This will be an ability you give to your towers and that the player will click to sell the tower. Let's call it 'Sell Tower'
- Create a custom version of Transmute ability - make it non-hero spell, set mana cost and cooldown to 0, set the Lumber and Gold Cost factors (note: the default Gold Cost Factor is 0.8, but it is erroneously displayed as 1.0 in object editor, so if you want to get full refund for sold unit, set the factor to 1.001).
- Also make sure the 'Targets Allowed' field is set to friendly targets
- Create a dummy unit in object editor
- Create a trigger that fires when a tower starts casting the 'Sell Tower' ability
- In the trigger, create a dummy unit, give it the custom Transmute ability and order the dummy unit to cast Transmute on the tower that should be sold
- Cleanup