• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Creating a new resource system for a specific unit

Status
Not open for further replies.
Level 3
Joined
Jul 3, 2013
Messages
25
I'm trying to create a new resource (other than mana) for a specific unit. It'll still function much like mana (needed to use spells, will diminish on use, can be regenerated, etc.)

My question is, is it possible to set a maximum amount of mana for that specific unit? Like, his mana cannot exceed a certain threshold (say 300 Mana), and he'll have increased mana regeneration (and other good stuff to compensate for his mana roof) - is this possible to be triggered, if not done normally through OE?
 
u can trigger mana regeneration and max mana but the max mana has to be preset to a value equal to or higher than the number u want. so if u are going with 300 max mana the mana max has to be set to 300 or higher in OE.

to make the trigger u use a periodic trigger and check if the mana of that unit is less than 300. in the then block u set the units mana to mana + whatever amount u want which u can manipulate the amount there.
 
u can trigger mana regeneration and max mana but the max mana has to be preset to a value equal to or higher than the number u want. so if u are going with 300 max mana the mana max has to be set to 300 or higher in OE.

to make the trigger u use a periodic trigger and check if the mana of that unit is less than 300. in the then block u set the units mana to mana + whatever amount u want which u can manipulate the amount there.

Wouldn't that reset the unit's mana back to maximum value? At least, that's what happened when I tried triggering it (made the mistake of trashing the trigger though, so I can't replicate it)

-Edit-

I redid the trigger - my bad, I had forgotten to set Max Mana = 300 in OE. Heh.

-Edit-

Okay now I can't seem to do the periodic trigger anymore. How do you make it? I set the event to be every second but idk what conditions to set

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Mana of (Triggering unit)) Less than 200.00
      • Then - Actions
        • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 10.00)
      • Else - Actions
        • Unit - Set mana of (Triggering unit) to 200.00
Something like that, right? (Changed it to 200, decreasing mana costs in the process)
 
no it wont. u do set mana of unit equals mana of unit plus 1.
the condition is there so it wont set the mana over 300 or whatever u pick its max value to be.

Edit: there is no triggering unit in ur trigger that is what is messing up. also in the else dont set the mana to 200. in the then block after u add mana check if the current mana of the unit is over 200. in that then block set the mana to 200.

also for future reference. whenever u use something twice or more store it into a variable and use the variable.
 
no it wont. u do set mana of unit equals mana of unit plus 1.
the condition is there so it wont set the mana over 300 or whatever u pick its max value to be.

Edit: there is no triggering unit in ur trigger that is what is messing up. also in the else dont set the mana to 200. in the then block after u add mana check if the current mana of the unit is over 200. in that then block set the mana to 200.

That's the thing, what do I replace by "triggering unit"? Idk what to use otherwise, cuz I want it to apply to a specific unit and not every unit on the map

-Edit-

I changed the trigger around, splitting it into two - tell me if it makes sense (don't wanna crash my WC)

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Mana of (Picked unit)) Less than 200.00
          • Then - Actions
            • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 10.00)
          • Else - Actions
  • Events
    • Time - Every 0.05 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Mana of (Picked unit)) Greater than or equal to 200.00
          • Then - Actions
            • Unit - Set mana of (Picked unit) to 200.00
          • Else - Actions
 
it will work but it isnt efficient.

u should make another trigger that fires when unit enters playable map area.
for the actions add the unit to a group. call the group something like manaUnitGroup.
thats all for that trigger.

now to fix this trigger. change it to this.
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • Set tempUnit = (Picked unit)
        • Set tempReal = (Mana of tempUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • tempReal Less than 200.00
          • Then - Actions
            • Set tempReal = tempReal + 10.00
            • Unit - Set mana of tempUnit to tempReal)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • tempReal Greater than 200.00
              • Then - Actions
                • Unit - Set mana of tempUnit to 200.00
              • Else - Actions
          • Else - Actions
 
it will work but it isnt efficient.

u should make another trigger that fires when unit enters playable map area.
for the actions add the unit to a group. call the group something like manaUnitGroup.
thats all for that trigger.

Okay, I did that, but I don't seem to be using it anywhere?

  • Events
    • Unit - A unit enters (Playable map area)
  • Conditions
    • (Unit-type of (Entering unit)) Equal to Blade Dancer
  • Actions
    • Unit Group - Add (Entering unit) to BladeDancerGroup
now to fix this trigger. change it to this.
  • Snip

Like this?

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Less than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to (BladeDancerMana + 10.00)
          • Else - Actions
  • Events
    • Time - Every 0.05 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Mana of BladeDancerUnit) Greater than or equal to 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to 200.00
          • Else - Actions
Note, I still split it into two mostly cuz I want the 200+ check to fire faster (every 1 second makes it weird to see his mana pop back up to 400 and then down to 200 and then back to 400 when I have an INT-based item equipped)
 
put it back to one trigger and use the 0.03 second timer. it is ok to use and u will not see the numbers change.
put it exactly how i had it.

in the unit enters playable map trigger never use entering unit. change it to triggering unit. it is both faster and more efficient.

Well I tried merging the triggers and now the mana regen heals 10 mana every 0.05 seconds, meaning I have like 200 mana regen every second. Uh... xD

Are you sure it changes nothing?
 
it changes the speed at which the trigger fires. so instead of adding 10 every second u add 0.3125 every 0.03 seconds. dont use .05 for this use 0.03 for the trigger

Oh, well, that's logical, I should've realized that. xD

  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Less than 200.00
          • Then - Actions
            • Set BladeDancerMana = (BladeDancerMana + 0.30) ----------------- (10.00 / (100.00 / 3.00))) <-- I'm assuming this result is just 0.3
            • Unit - Set mana of BladeDancerUnit to BladeDancerMana
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Mana of BladeDancerUnit) Greater than or equal to 200.00
              • Then - Actions
                • Unit - Set mana of BladeDancerUnit to 200.00
              • Else - Actions
          • Else - Actions
Is this what you meant?
 
i didnt see that u werent using it. u need to change this.
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blade Dancer)) and do (Actions)
to this
  • Unit Group - Pick every unit in BladeDancerGroup and do (Actions)
then u will be using it properly

Okay so I'm using this

  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in BladeDancerGroup and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Less than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to (BladeDancerMana + 0.30)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • BladeDancerMana Greater than or equal to 200.00
              • Then - Actions
                • Unit - Set mana of BladeDancerUnit to 200.00
              • Else - Actions
          • Else - Actions
But when I buy an INT item, my mana goes up to 265 and doesn't come back down. =/
 
sry that was my fault i placed the second ITE in the first one.
change it to this.
lol im doing this on my phone so sry i got some of the things mixed up lol
here this will work for u
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in BladeDancerGroup and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Less than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to (BladeDancerMana + 0.30)
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Greater than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to 200.00
          • Else - Actions
 
sry that was my fault i placed the second ITE in the first one.
change it to this.
lol im doing this on my phone so sry i got some of the things mixed up lol
here this will work for u
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in BladeDancerGroup and do (Actions)
      • Loop - Actions
        • Set BladeDancerUnit = (Picked unit)
        • Set BladeDancerMana = (Mana of BladeDancerUnit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Less than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to (BladeDancerMana + 0.30)
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BladeDancerMana Greater than 200.00
          • Then - Actions
            • Unit - Set mana of BladeDancerUnit to 200.00
          • Else - Actions

Lol I knew something was off =P thanks! Other than the fact that the blade dancer's maximum mana exceeds 200, his current mana never does, which is okay I guess.
 
Status
Not open for further replies.
Back
Top