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

Losing mana when moving

Status
Not open for further replies.
Level 3
Joined
Jul 15, 2013
Messages
54
Sorry for disturbing but can anyone create a GUI trigger (or triggers) that when a unit is moving, he/she losing mana per second and when a unit stops, this ends? Also if possible make a unit unable to move when mana reach zero :grin:

I'm currently using "IsUnitMoving" system from Bribe.
MUI is always better and dynamix index too :ogre_haosis:
Thanks for your helping!:ogre_hurrhurr:
 
Level 3
Joined
Jul 15, 2013
Messages
54
oh nice Entangling Roots! I tried using stop order when unit reach zero mana but it simply not working >_>
 
Level 28
Joined
Feb 18, 2014
Messages
3,578
I'm not so sure but could this work ? :

Event : A unit recieve an order to ''Move''
Condition : Trigerring unit equal to '' your unit "
Action : Interger (Set Current mana point of '' Trigerring unit '' - 1)

Not sure if it's gonna work, also I believe you will also need to make a timer event '' Every 0.01 of game ''
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You can do it without dummy units with a custom script:
"Custom script: call SetUnitPropWindow(udg_MyUnit, 0)"
And you can enable it again with the GUI action:
"Animation - Change (MyUnit) prop window angle to (Default prop window angle of (MyUnit))"

Also...
"MUI is always better and dynamix index too"
-_- If you have no idea of what you are saying... then dont say anything.
 
Level 3
Joined
Jul 15, 2013
Messages
54
Also...
"MUI is always better and dynamix index too"
-_- If you have no idea of what you are saying... then dont say anything.

Ay, my mistake:goblin_boom:. I mean that this thing now i can do with 3 triggers:
1/ Detects if unit is moving then turn on the loop
2/ Looping - Every 1 second make a unit losing mana
3/ Detects if unit is stop moving then turn off the loop
Usually this is not MUI but i wonder can dynamic index can be used in those triggers and how.
btw, tks for the tip.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Just put all units that you want to drain mana of while they are moving in a unit group.
Then every 0.03 to 0.1 (user preference) seconds, you loop through the group and check if they are moving.
If so, you reduce their mana by MANA_DRAIN_PER_SECOND * INTERVAL.
MANA_DRAIN_PER_SECOND should be how much mana you want to drain.
INTERVAL would be that 0.03 or whatever you fill in as interval.
 
Level 9
Joined
May 27, 2012
Messages
116
I made the system for you :ogre_datass:
Even made it with Dynamic Indexing, as I think you said you liked that.

It is made in GUI, it is 100% MUI, means you can add it to as many units as you want. It works by comparing the units last location with its current.
If mana is lower then 5 (this can be changed easly, 5 was just a good number) it cant move. I'm using Ensare as it is better fitted for this then entangle.

If you wonder why it says that is it made by "CanFight" that is me ;).
Anyway i'd be happy if you gave me cridits in your map.

Note:
The manadrain variabele is x10 in size. So if you want to drain 10 mana per second set it to 1.
This is becouse the loop goes 10 times per second, and I forgot to compensate for it.
 

Attachments

  • DWA System By CanFight.w3x
    33 KB · Views: 53
Last edited:
Level 3
Joined
Jul 15, 2013
Messages
54
I made the system for you :ogre_datass:
Even made it with Dynamic Indexing, as I think you said you liked that.

It is made in GUI, it is 100% MUI, means you can add it to as many units as you want. It works by comparing the units last location with its current.
If mana is lower then 5 (this can be changed easly, 5 was just a good number) it cant move. I'm using Ensare as it is better fitted for this then entangle.

If you wonder why it says that is it made by "CanFight" that is me ;).
Anyway i'd be happy if you gave me cridits in your map.

Note:
The manadrain variabele is x10 in size. So if you want to drain 10 mana per second set it to 1.
This is becouse the loop goes 10 times per second, and I forgot to compensate for it.

Nice man! +rep:ogre_love:
I will try to find a way setting the Unit variable as the Hero is created through trigger not preplaced
But anyway all are find, but this:
  • DWA Remove Unit
    • Events
    • Conditions
    • Actions
      • -------- At this trigger you can remove units. --------
      • -------- To remove something simply copy past this, --------
      • -------- "TempUnit" will be the unit that we remove this system from. --------
      • -------- You do not need to remove anything else. --------
      • Set DWA_TempUnit = No unit
      • For each (Integer DWA_Index) from 1 to DWA_Index_Max, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DWA_TempUnit Equal to DWA_Unit[DWA_Index]
            • Then - Actions
              • Unit - Remove DWA_Dummy[DWA_Index] from the game
              • Set DWA_Dummy[DWA_Index] = DWA_Dummy[DWA_Index_Max]
              • Set DWA_Dummy[DWA_Index_Max] = No unit
              • Set DWA_Unit[DWA_Index] = DWA_Dummy[DWA_Index_Max]
              • Set DWA_Unit[DWA_Index_Max] = No unit
              • Set DWA_ManaDrain[DWA_Index] = DWA_ManaDrain[DWA_Index_Max]
              • Set DWA_ManaDrain[DWA_Index_Max] = 0.00
              • Set DWA_HpDrain[DWA_Index] = DWA_HpDrain[DWA_Index_Max]
              • Set DWA_HpDrain[DWA_Index_Max] = 0.00
              • Set DWA_Index_Max = (DWA_Index_Max - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DWA_Index_Max Equal to 0
                • Then - Actions
                  • Trigger - Turn off DWA Loop <gen>
                • Else - Actions
            • Else - Actions
      • Set DWA_TempUnit = No unit
serves like when a unit dies it will remove the dummy?
About credit, that is must for me:thumbs_up:
 
Level 9
Joined
May 27, 2012
Messages
116
DWA Remove Unit, is just if you want to remove a unit from the system. It is the "Deindex part". The system doesn't need it at all. But normal you use it inside the "loop" to remove a something when it is not used anymore. For example. When a unit dies that uses the system, we remove it from the system. (Seems legit) But i figured you where gonna use this for a hero so i put it outside in another trigger.
But you do not really need to worry about it.


If you want to add it to a unit created thoughout triggers its very simple. Just copy past the "Actions" in the "DWA Add unit" trigger add them under the "create unit" action in your trigger. And finaly set "DWA_Unit" to "last created unit". As simple as that! :D

  • Add Trigg Unit
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Blademaster for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set DWA_Index_Max = (DWA_Index_Max + 1)
      • -------- - --------
      • -------- Here we use "Last Created Unit", referring to the "Blademaster" we created. --------
      • Set DWA_Unit[DWA_Index_Max] = (Last created unit)
      • -------- - --------
      • Set DWA_HpDrain[DWA_Index_Max] = 0.00
      • Set DWA_ManaDrain[DWA_Index_Max] = 2.00
      • Set TempPoint[1] = (Position of DWA_Unit[DWA_Index])
      • Unit - Create 1 DWA Dummy Stop Movement for Neutral Passive at TempPoint[1] facing Default building facing degrees
      • Set DWA_Dummy[DWA_Index_Max] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DWA_Index_Max Equal to 1
        • Then - Actions
          • Trigger - Turn on DWA Loop <gen>
        • Else - Actions
 
Status
Not open for further replies.
Top