Here is my take on the whole castle/mana system. (Rough summary)
This is essentially how it works:
Cond: Always (or Player 1 commands 1 castle, which he'll start out with)
Action: -Wait 25 milliseconds
Set Switch "Player 1 castle 1"
-Clear Switches "Player 1 castles 2-4" (assuming you use standard 4 castles
(Repeat this one for the 4 other options (no castles, 2-4 castles))
Cond: Always
Action: Add 1 death for Unused Unit
-Preserve Trigger
Cond: Current Player commands exactly 1 castle
-Switch P1 Castle 1-4 are cleared
-Current Player has at most (we'll say 639 for a tad less than 20 minutes) deaths of Unused Unit
Action: Remove 1 castle for Current Player
-Add 5000 vespene gas for Current Player
-Preserve Trigger
Do you see where I'm going with this? The castle will take (just for now) 20 minutes to make. If the player finishes the castle before he's supposed to (what the death counter is for), then it automatically removes a castle and he has to start again. Use remove and not kill. Kills will mess up the next trigger:
Cond: Player 1 has at least 1 death of Castle
Action: Add 5000 vespene gas for Current Player
-Set to 0 Deaths of Castle for Current Player
-Preserve Trigger
Yeah, for a minute I was thinking it would work as one trigger, but it won't. One runs off the timer, while the other is off of kills.
Here is the method for resetting the death counter should castles die and/or be rebuilt:
Cond: Switch Castle 1 is Set
-Switch Castle 0 is Cleared
-Current Player Commands exactly 0 castle
Action: Set Deaths of Unused Unit for Current Player to 0
-Preserve Trigger
This is where the wait for Castle Switch setting takes much hold
-In the space where the switches are set but the player has a different amount of castles, this trigger will run to set the death count back to 0
Problems: This only works with 1 castle at a time
-If players lose a castle, they'll get another 5000 gas
-Maybe disable spells if a player controls more than say 500 gas?
These were my ideas and I have no idea if they work. However I'm rather proud of myself for thinking this up

*Edit*
-This also: makes castles more important
-Well, instead of just disabling spells, disable spells and gas production (not castle gas, mind you)
This makes it simple:
-It is not really a hassle, but it does keep players from being idiotic and using endless spells!
-Therefore, all a player needs to do to use spells again is to start building a castle!
-There are some definite problems, like... OMG NVM! I HAVE THE ANSWER!
There are a maximum of 5 different castle counts (0,1,2,3,4)
-There are ummm 5, repeat 5, different gas ranges
-0-500,5000-5500,10000-10500,15000-15500,20000-20500
-Wait, a little voice in the back of my head says there's some problem...
-Nvm, I don't think there really is one
Oh yes, what was I going to finish up with? Dammit! I can't remember.
Anyone see any problem with this?
Oh yes, it had something to do with the castle ranges and gas ranges...
Here is how you can fix that:
Cond: Player 1 accumulates at least 501 vespene gas
-Current Player accumulates at most 4999 vespene gas
Action: Subtract ___ vespene gas
-Preserve Trigger
Of course this might be blocky and annoying to see the gas constantly go up/down
Try something like this:
Cond: Player 1 accumulates at most 499 gas
Action: Add 1 gas for Current Player
-Preserve Trigger
Cond: Player 1 accumulates at least 5000 gas
-Current Player accumulates at most 5499 gas
Action: Add 1 gas for Current Player
-Preserve Trigger
Those are his spell ranges : )
I'm trying to think of safeguards
Here is the example of your generic spell:
Cond: Player 1 brings 1 spellcaster to location "Aura of Healing"
-Current player accumulates at least 350 gas
-Player 1 accumulates at most 525 gas (to be safe)
Action: Set all HP for men owned by Current Player to 100%
-Subtract 350 gas for Current Player
-Preserve Trigger
Cond: Player 1 brings 1 spellcaster to location "Aura of Healing"
-Player 1 accumulates at least 5350 gas
-Current Player accumulates at most 5525 gas (to be safe)
Action: Set all HP for men owned by Current Player to 100%
-Subtract 350 gas for Current Player
-Preserve Trigger
This would be a pretty simple spell system, yet it's made more difficult as you multiply like all the triggers in the map five times. It will take a nice amount of triggering, but I believe it can be done, and if done right and balanced, the rewards will be enormous : ) *Note* Take time now to do this right, to relieve yourself of difficulties and bugs now.
Is there anything I forgot/messed up in this?
I could be hitting a bulls-eye or I could be turned 180
o in the other direction, firing madly into the sky. I have no self confidence! Please don't be harsh if I didn't do it right...
