• 🏆 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!

units costing mana?

Status
Not open for further replies.
Level 5
Joined
May 23, 2008
Messages
123
is there a way to make TRAINNING(not using spells) a troop to cost mana?

More info:
I trying to create a way to make a barracks only able to create a total for 3 troops. I had a friend who tried to do this with food but failed.
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
I do not know how all those unit construction events work, but it might be possible to lower the mane on the building every time a unit is produced and when a construction is started with 0 mana it stops the construction. I am not sure about a possibility to do so though, but I thought there were events like that.
 
Level 4
Joined
Apr 18, 2009
Messages
127
Here is one way to do it.

  • Barracks Training
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Less than 10.00
        • Then - Actions
          • Trigger - Turn on Barracks Training 3 <gen>
        • Else - Actions
          • Trigger - Turn on Barracks Training 2 <gen>
  • Barracks Training 2
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Barracks
          • (Trained unit-type) Equal to Footman
        • Then - Actions
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - The_Cost_You_Want)
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Barracks Training 3
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Barracks
          • (Trained unit-type) Equal to Footman
        • Then - Actions
          • Unit - Kill (Trained unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your Barracks have ...
        • Else - Actions
Fixed

Fixed 2: Now your unit gets killed when you don't have enough mana
 
Last edited:
Level 18
Joined
Mar 13, 2009
Messages
1,411
If the player then would decide to make a unit the mana cost of the building must be equal or more as the required mana cost too. Otherwise it would create units at 0 mana.
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
Another way would be a triggered creation:
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Footman
  • Actions
    • Unit - Create 1 Footman for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
 
Level 4
Joined
Apr 18, 2009
Messages
127
Not? I will test it ingame. Ill edit this post soon

You are right. It deos not stop


Edit2: I could make it so if the bararcks have no mana, it will kill the trained unit..?

Done: Now your unit gets killed if you don't have enough mana.
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
I don't know either D:

I think that you would have to make triggers like this:

Unit production is started only if mana is enough.
If production is stopped after starting mana is given back to the building.

to Elmo: that trigger doesn't look MUI (or MB(uilding)I in this case :p) to me.
 
Level 4
Joined
Apr 18, 2009
Messages
127
I did not intend to make it MB(^^) either.

I do not have enough time atm, but I will be back in about 20 mins, and can do it then

My system does what u suggest. It checks if the mana is enough, and then starts either kill or spawn trigger
 
Level 8
Joined
Aug 3, 2008
Messages
391
This trigger is MUCH simpler:
  • Mana Cost
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Less than your_mana_cost
        • Then - Actions
          • Unit - Remove (Trained unit) from the game
        • Else - Actions
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - your_mana_cost)
Btw Elmo, it's better if you remove the unit. :wink:
 
Level 5
Joined
May 23, 2008
Messages
123
3 on every barrack.

also i forgot to add that the biulding can't kill the troop after it has been trainned if it does not have the mana needed, because it will mess up other triggers.

Extra info:currently troops all troops only cost 1 mana, that might make it easyer to make.

If you have a better system that player can see besides mana to limit how many troops can be trained per biulding please post it.
 
Level 11
Joined
May 31, 2008
Messages
698
  • Limit
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All Players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Footman to 3 for (Picked player)
That should do the trick if you only want to be able to train 3 at a time.

  • Limit1
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Barracks
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 10.00)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Integer((Mana of (Triggering unit)))) Equal to (==) 0
          • Then - Actions
            • Player Group - Pick every player in (Player group((Owner of (Triggering unit)))) and do (Actions)
              • Loop - Actions
                • Player - Make Footman Unavailable for training/construction by (Picked player)
          • Else - Actions
Or that if you only want to be able to train 3 total.
 
Level 11
Joined
May 31, 2008
Messages
698
Oh just make it so you purchase units?
Or you can do kind of what my second trigger was (same conditions) but instead of makin the footman unavailable just pause the barracks. If you give it 20 mana it should work. Im pretty sure that if you pause it the building wont be able to make any units.
 
Level 8
Joined
Aug 3, 2008
Messages
391
Off course it's possible, my friend. But you'd have to use custom values. That's how I'd do it.

  • Training Limitation
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Triggering unit)) Less than 3
        • Then - Actions
          • Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) + 1)
        • Else - Actions
          • Unit - Remove (Trained unit) from the game
 
Status
Not open for further replies.
Top