Making this spell MUI

chukky-jr

Member
Reaction score
15
Trigger:
  • Deep Freeze Ready
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Deep Freeze
    • Actions
      • Set DeepFreezeIndex[1] = (DeepFreezeIndex[1] + 1)
      • Set DeepFreezeIndex[2] = (DeepFreezeIndex[2] + 1)
      • Set DeepFreezeSource[DeepFreezeIndex[2]] = (Casting unit)
      • Set DeepFreezeSourcePost[DeepFreezeIndex[2]] = (Position of DeepFreezeSource[DeepFreezeIndex[2]])
      • Unit Group - Pick every unit in (Units within 1000.00 of DeepFreezeSourcePost[DeepFreezeIndex[2]]) and do (Unit Group - Add (Picked unit) to DeepFreezeUnitGroup[DeepFreezeIndex[2]])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A structure) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in DeepFreezeUnitGroup[DeepFreezeIndex[2]] and do (Actions)
            • Loop - Actions
              • Set DeepFreezeCounter[DeepFreezeIndex[2]] = (DeepFreezeCounter[DeepFreezeIndex[2]] + 1)
              • Set DeepFreezeHealth[DeepFreezeCounter[DeepFreezeIndex[2]]] = (Life of (Picked unit))
              • Set DeepFreezeMana[DeepFreezeCounter[DeepFreezeIndex[2]]] = (Mana of (Picked unit))
              • Set DeepFreezeUnit[DeepFreezeCounter[DeepFreezeIndex[2]]] = (Picked unit)
        • Else - Actions
      • Set DeepFreezeDuration[DeepFreezeIndex[2]] = (3.00 + (2.00 x (Real((Level of Deep Freeze for DeepFreezeSource[DeepFreezeIndex[2]])))))
      • Custom script: call RemoveLocation(udg_DeepFreezeSourcePost[udg_DeepFreezeIndex[2]])
      • Trigger - Turn on Deep Freeze Effects <gen>


Trigger:
  • Deep Freeze Effects
    • Events
      • Time - Every 0.05 seconds of game time
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • For each (Integer DeepFreezeIndex[3]) from 1 to DeepFreezeIndex[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeepFreezeDuration[DeepFreezeIndex[3]] Greater than 0.00
            • Then - Actions
              • Set DeepFreezeDuration[DeepFreezeIndex[3]] = (DeepFreezeDuration[DeepFreezeIndex[3]] - 0.05)
              • Game - Display to (All players) the text: (String(DeepFreezeDuration[DeepFreezeIndex[3]]))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(unimmolation))
                  • (Ordered unit) Equal to DeepFreezeSource[DeepFreezeIndex[3]]
                • Then - Actions
                  • Set DeepFreezeDuration[DeepFreezeIndex[3]] = 0.00
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeepFreezeDuration[DeepFreezeIndex[3]] Equal to 0.00
                • Then - Actions
                  • Unit Group - Pick every unit in DeepFreezeUnitGroup[DeepFreezeIndex[3]] and do (Actions)
                    • Loop - Actions
                      • For each (Integer A) from 1 to DeepFreezeCounter[DeepFreezeIndex[3]], do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Picked unit) Equal to DeepFreezeUnit[(Integer A)]
                            • Then - Actions
                              • Unit - Set life of (Picked unit) to DeepFreezeHealth[(Integer A)]
                              • Unit - Set mana of (Picked unit) to DeepFreezeMana[(Integer A)]
                              • Unit Group - Remove (Picked unit) from DeepFreezeUnitGroup[DeepFreezeIndex[3]]
                            • Else - Actions
                  • Set DeepFreezeIndex[1] = (DeepFreezeIndex[1] - 1)
                  • Set DeepFreezeCounter[DeepFreezeIndex[3]] = 0
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeepFreezeIndex[1] Equal to 0
                    • Then - Actions
                      • Game - Display to (All players) the text: Loop Ends
                      • Set DeepFreezeIndex[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions


basically, the spell is going to store any unit's health and mana in 1000 AoE of caster, and a few seconds later/using the revert form(unimmolation) their health will be returned to stored values

my problem is, only one instance of spell worked, 2 instance does works in counting the duration and ending the loop, but no clue why it doesn't work in restoring the unit's health and mana

any thoughts?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
store the values in a hashtable... 1 hashtable for life and 1 for mana... like so...
Trigger:
  • Hashtable - Save real (health of picked unit) as (key picked unit) of (key casting unit) in Health_Hash (A hashtable variable with the hashtable you create at map init saved to it)
 

chukky-jr

Member
Reaction score
15
is there any work around aside from Hashtables? my Hashtables is bugged (JNGP) that it cannot choose anything under the Hashtables choices.. maybe simply changing some integer values from current trigger?

i've checked my code again, it is bugged in this part

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Picked unit) is A structure) Equal to False
    • Then - Actions
      • Unit Group - Pick every unit in DeepFreezeUnitGroup[DeepFreezeIndex[2]] and do (Actions)
        • Loop - Actions
          • Set DeepFreezeCounter[1] = (DeepFreezeCounter[1] + 1)
          • Set DeepFreezeHealth[DeepFreezeCounter[1]] = (Life of (Picked unit))
          • Set DeepFreezeMana[DeepFreezeCounter[1]] = (Mana of (Picked unit))
          • Set DeepFreezeUnit[DeepFreezeCounter[1]] = (Picked unit)
          • Game - Display to (All players) the text: (String(DeepFreezeCounter[1]))
    • Else - Actions


on the first cast, it gives values 1 2 3 4 5 (meaning the Game - Display blabla runs), but on the 2nd cast, it doesn't show anything, if there anything that can cause this function to fail? i'm picking the same unit
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
the reason why hashtables are soooo important for mui is because they are essentially a variable for every single unit that can use other units as its arrays... without having jass or a hashtable it would be near impossible, unless you made your own indexxing system, try this

add this line to the end
Trigger:
  • Custom Script: Calldestroyunitgroup(UDG_DeepFreezeUnitGroup[(here you put every index used in the trigger, a new line for each one)]


you have to destroy the group or it will leak, and i believe it wont be able to save another unit group until then
 

Dirac

22710180
Reaction score
147
your own indexxing system
There are plenty, for GUI too. The good thing about units is that you don't have to use their "key" or handle id since they have another unique modifiable value: custom value. The only reason of why i would ever use hashtables is to take advantage of that 2d array, and i try my best to avoid them.

Remember also that coding in JASS is a lot more easier than coding in GUI for several reasons, just a few:
-Extremely easy variable generation
-Functions that do stuff for you
-Many many resources online that accomplish what you want to do.
-Never have to click through the menus again. (typing is a lot faster)
 

chukky-jr

Member
Reaction score
15
i already know that and FYI if you don't know this GUI's shape, it is Paladon's indexing system

btw i did told you my Hashtables is bugged and cant be used.. if i can use Hashtables, i already use it and not this indexing system...
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you could make one long index (XXXXYYYY) where xxxx is the casting unit index and yyyy is the target, and if it is less digits place a 0 to hold the place of that digit ie: 05790003

that way its like using a hashtable saved in a variable, which would make it much much faster than a normal hashtable btw, variables take less time to access information

this way of saving information would work with AIDS, the link i posted in my message above
 

chukky-jr

Member
Reaction score
15
Trigger:
  • Hashtable - Save real (health of picked unit) as (key picked unit) of (key casting unit) in Health_Hash (A hashtable variable with the hashtable you create at map init saved to it)

for this one, what would happen, if the 2nd time of casting, the picked unit and casting unit is the same? wouldn't it overwrite the 1st one?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
yes, but can they cast the same ability twice during the duration of the ability?
 

chukky-jr

Member
Reaction score
15
yes, but can they cast the same ability twice during the duration of the ability?

in some case yes (other unit has ability to refresh cooldown for all units)

but nevermind, i've gotten a work around for it using capped integer, wanna take a look?
 

chukky-jr

Member
Reaction score
15
Trigger:
  • Deep Freeze Ready
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Deep Freeze
    • Actions
      • Set DeepFreezeIndex[1] = (DeepFreezeIndex[1] + 1)
      • Set DeepFreezeIndex[2] = (DeepFreezeIndex[2] + 1)
      • Set DeepFreezeSource[DeepFreezeIndex[2]] = (Casting unit)
      • Set DeepFreezeSourcePost[DeepFreezeIndex[2]] = (Position of DeepFreezeSource[DeepFreezeIndex[2]])
      • Set DeepFreezeUnitGroup[DeepFreezeIndex[2]] = (Units within 1000.00 of DeepFreezeSourcePost[DeepFreezeIndex[2]])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A structure) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in DeepFreezeUnitGroup[DeepFreezeIndex[2]] and do (Actions)
            • Loop - Actions
              • Set DeepFreezeCounter[1] = (DeepFreezeCounter[1] + 1)
              • Set DeepFreezeHealth[DeepFreezeCounter[1]] = (Life of (Picked unit))
              • Set DeepFreezeMana[DeepFreezeCounter[1]] = (Mana of (Picked unit))
              • Set DeepFreezeUnit[DeepFreezeCounter[1]] = (Picked unit)
              • Game - Display to (All players) the text: (String(DeepFreezeCounter[1]))
        • Else - Actions
      • Set DeepFreezeDuration[DeepFreezeIndex[2]] = (3.00 + (2.00 x (Real((Level of Deep Freeze for DeepFreezeSource[DeepFreezeIndex[2]])))))
      • Set DeepFreezeCounterMax[DeepFreezeIndex[2]] = DeepFreezeCounter[1] <b>&lt;--- Set Cap for checking each unit group</b>
      • Game - Display to (All players) the text: (String(DeepFreezeIndex[2]))
      • Custom script: call RemoveLocation(udg_DeepFreezeSourcePost[udg_DeepFreezeIndex[2]])
      • Trigger - Turn on Deep Freeze Effects &lt;gen&gt;


Trigger:
  • Deep Freeze Effects
    • Events
      • Time - Every 0.05 seconds of game time
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • For each (Integer DeepFreezeIndex[3]) from 1 to DeepFreezeIndex[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeepFreezeDuration[DeepFreezeIndex[3]] Greater than 0.00
            • Then - Actions
              • Set DeepFreezeDuration[DeepFreezeIndex[3]] = (DeepFreezeDuration[DeepFreezeIndex[3]] - 0.05)
              • Game - Display to (All players) the text: (String(DeepFreezeDuration[DeepFreezeIndex[3]]))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(unimmolation))
                  • (Ordered unit) Equal to DeepFreezeSource[DeepFreezeIndex[3]]
                • Then - Actions
                  • Set DeepFreezeDuration[DeepFreezeIndex[3]] = 0.00
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeepFreezeDuration[DeepFreezeIndex[3]] Equal to 0.00
                • Then - Actions
                  • Unit Group - Pick every unit in DeepFreezeUnitGroup[DeepFreezeIndex[3]] and do (Actions)
                    • Loop - Actions
                      • For each (Integer A) from 1 to DeepFreezeCounterMax[DeepFreezeIndex[3]], do (Actions) <b>&lt;--- Each unit that has been checked will be set as No Unit, and each check will be capped so it won&#039;t overlap with other unit group</b>
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Picked unit) Equal to DeepFreezeUnit[(Integer A)]
                            • Then - Actions
                              • Unit - Set life of (Picked unit) to DeepFreezeHealth[(Integer A)]
                              • Unit - Set mana of (Picked unit) to DeepFreezeMana[(Integer A)]
                              • Unit Group - Remove (Picked unit) from DeepFreezeUnitGroup[DeepFreezeIndex[3]]
                              • Set DeepFreezeUnit[DeepFreezeIndex[3]] = No unit
                            • Else - Actions
                  • Set DeepFreezeIndex[1] = (DeepFreezeIndex[1] - 1)
                  • Unit - Order DeepFreezeSource[DeepFreezeIndex[3]] to Night Elf Demon Hunter - Deactivate Immolation
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeepFreezeIndex[1] Equal to 0
                    • Then - Actions
                      • Game - Display to (All players) the text: Loop Ends
                      • Custom script: call DestroyGroup(udg_DeepFreezeUnitGroup[udg_DeepFreezeIndex[3]])
                      • Set DeepFreezeCounter[1] = 0
                      • Set DeepFreezeIndex[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions


notice the
Trigger:
  • Set DeepFreezeCounterMax[DeepFreezeIndex[2]] = DeepFreezeCounter[1]


i made that integer so the checking for unit group doesn't overlap with checking of another unit group, since there is a possibility another unit group contains the same unit which causes the problem that i had before

basically it will be like this :

Unit Group 1 contains : 1 2 3 4 5 6
Unit Group 2 contains : 7 8 9 10 11 12

whereas there is a possibilty that number 2 and 10 is the same unit

since w/o caps, the trigger will check from 1 to 12, there is a possibilty of overlaps, that
Trigger:
  • Set DeepFreezeCounterMax[DeepFreezeIndex[2]] = DeepFreezeCounter[1]
is used to cap so each check will only ranged from start of its number to the end of its number, and whenever unit is checked, its value will be set to No Unit (to prevent its HP/MP values modified again)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
interesting... thats a cool idea, id +rep you but im capped on the ammount of rep i can give out in 24 hours lol
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top