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

[Trigger] MUI spell help

Status
Not open for further replies.
Level 16
Joined
Jul 31, 2012
Messages
2,217
I created this thread for the spell i uploaded here and i'm making it GUI
I made what i could following a hashtable tutorial here and i got stuck here:
  • Lightning Field Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Field
    • Actions
      • Set Hashtable_Value = (Key (Triggering unit))
      • Hashtable - Save Handle Of(Triggering unit) as 1 of Hashtable_Value in Hashtable
      • Hashtable - Save Handle Of(Target point of ability being cast) as 20 of Hashtable_Value in Hashtable
      • Hashtable - Save 0.02 as 21 of Hashtable_Value in Hashtable
      • Hashtable - Save 600 as 22 of Hashtable_Value in Hashtable
      • For each (Integer x) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Lightning Field dummy for (Owner of (Triggering unit)) at (Target point of ability being cast) facing Default building facing degrees
          • Hashtable - Save Handle Of(Last created unit) as (x + 1) of Hashtable_Value in Hashtable
      • Unit - Create 1 Lightning Field dummy high for (Owner of (Triggering unit)) at (Target point of ability being cast) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 8 of Hashtable_Value in Hashtable
      • Wait 1.00 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set Lightning_Field_dummy[(x + 1)] = (Load (x + 2) of Hashtable_Value in Hashtable)
          • Set Lightning_Field_Target = (Load 20 of Hashtable_Value in Hashtable)
          • Set temp_location = (Lightning_Field_Target offset by 500.00 towards ((360.00 / 5.00) x (Real(x))) degrees)
          • Unit - Order Lightning_Field_dummy[(x + 1)] to Move To temp_location
          • Set Lightning_Field_Angle[x] = ((360.00 / 5.00) x (Real(x)))
          • Hashtable - Save Lightning_Field_Angle[x] as (x + 21) of Hashtable_Value in Hashtable
      • Animation - Change (Load 8 of Hashtable_Value in Hashtable) flying height to 600.00 at 600.00
      • Wait 1.00 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 2 to 2, do (Actions)
        • Loop - Actions
          • Set Lightning_Field_dummy[x] = (Load (x + 1) of Hashtable_Value in Hashtable)
          • Set Lightning_Field_dummy[(x + 1)] = (Load (x + 2) of Hashtable_Value in Hashtable)
          • Lightning - Create a Forked Lightning lightning effect from source (Position of Lightning_Field_dummy[x]) to target (Position of Lightning_Field_dummy[(x + 1)])
          • Hashtable - Save Handle Of(Last created lightning effect) as (x + 7) of Hashtable_Value in Hashtable
      • Wait 0.01 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 3 to 3, do (Actions)
        • Loop - Actions
          • Set Lightning_Field_dummy[x] = (Load (x + 1) of Hashtable_Value in Hashtable)
          • Set Lightning_Field_dummy[(x + 1)] = (Load (x + 2) of Hashtable_Value in Hashtable)
          • Lightning - Create a Forked Lightning lightning effect from source (Position of Lightning_Field_dummy[x]) to target (Position of Lightning_Field_dummy[(x + 1)])
          • Hashtable - Save Handle Of(Last created lightning effect) as (x + 7) of Hashtable_Value in Hashtable
      • Wait 0.01 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 4 to 4, do (Actions)
        • Loop - Actions
          • Set Lightning_Field_dummy[x] = (Load (x + 1) of Hashtable_Value in Hashtable)
          • Set Lightning_Field_dummy[(x + 1)] = (Load (x + 2) of Hashtable_Value in Hashtable)
          • Lightning - Create a Forked Lightning lightning effect from source (Position of Lightning_Field_dummy[x]) to target (Position of Lightning_Field_dummy[(x + 1)])
          • Hashtable - Save Handle Of(Last created lightning effect) as (x + 7) of Hashtable_Value in Hashtable
      • Wait 0.01 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 5 to 5, do (Actions)
        • Loop - Actions
          • Set Lightning_Field_dummy[x] = (Load (x + 1) of Hashtable_Value in Hashtable)
          • Set Lightning_Field_dummy[(x + 1)] = (Load (x + 2) of Hashtable_Value in Hashtable)
          • Lightning - Create a Forked Lightning lightning effect from source (Position of Lightning_Field_dummy[x]) to target (Position of Lightning_Field_dummy[(x + 1)])
          • Hashtable - Save Handle Of(Last created lightning effect) as (x + 7) of Hashtable_Value in Hashtable
      • Wait 0.01 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • Lightning - Create a Forked Lightning lightning effect from source (Position of (Load 7 of Hashtable_Value in Hashtable)) to target (Position of (Load 3 of Hashtable_Value in Hashtable))
      • Hashtable - Save Handle Of(Last created lightning effect) as 13 of Hashtable_Value in Hashtable
      • Wait 0.01 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • For each (Integer x) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set p = (Position of (Load 2 of Hashtable_Value in Hashtable))
          • Set p1 = (Position of (Load (x + 1) of Hashtable_Value in Hashtable))
          • Custom script: set udg_Lightning_Field_lightning[udg_x+5] = AddLightningEx("FORK", true , GetLocationX(udg_p), GetLocationY(udg_p), GetLocationZ(udg_p) + 600, GetLocationX(udg_p1), GetLocationY(udg_p1), GetLocationZ(udg_p1) + 0)
          • Hashtable - Save Handle OfLightning_Field_lightning[(x + 5)] as (x + 13) of Hashtable_Value in Hashtable
      • Wait 0.50 seconds
      • Set Hashtable_Value = (Key (Triggering unit))
      • Animation - Change (Load 8 of Hashtable_Value in Hashtable) flying height to 100.00 at 100.00
      • Unit Group - Add (Triggering unit) to Lightning_Field_UG
      • Custom script: call RemoveLocation(udg_temp_location)
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: call RemoveLocation(udg_p1)
  • Lightning Field move
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightning_Field_UG and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 23 of (Key (Picked unit)) from (Last created hashtable)) - 1) as 23 of (Key (Picked unit)) in Hashtable
          • For each (Integer x) from 1 to 5, do (Actions)
            • Loop - Actions
              • Hashtable - Save (Load (x + 21) of (Key (Picked unit)) from Hashtable) as (x + 21) of (Key (Picked unit)) in Hashtable
              • Set temp_location = ((Position of Lightning_Field_dummy[1]) offset by 500.00 towards Lightning_Field_Angle[x] degrees)
              • Unit - Move (Load (x + 2) of (Key (Picked unit)) in Hashtable) instantly to ((Position of (Load 2 of (Key (Picked unit)) in Hashtable)) offset by 500.00 towards (Load (x + 21) of (Key (Picked unit)) from Hashtable) degrees)
              • Lightning - Move (Load (x + 8) of (Key (Picked unit)) in Hashtable) to source (Position of (Load (x + 2) of (Key (Picked unit)) in Hashtable)) and target (Position of (Load (x + 3) of (Key (Picked unit)) in Hashtable))
      • For each (Integer x) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set p = (Position of (Load 2 of (Key (Picked unit)) in Hashtable))
          • Set p1 = (Position of (Load (x + 1) of (Key (Picked unit)) in Hashtable))
          • Custom script: call MoveLightningEx(LoadLightningHandleBJ(( udg_x + 13 ), GetHandleIdBJ(GetEnumUnit()), udg_Hashtable), true , GetLocationX(udg_p), GetLocationY(udg_p), GetLocationZ(udg_p) + udg_i, GetLocationX(udg_p1), GetLocationY(udg_p1), GetLocationZ(udg_p1) + 0)
      • Lightning - Move (Load 13 of (Key (Picked unit)) in Hashtable) to source (Position of (Load 3 of (Key (Picked unit)) in Hashtable)) and target (Position of (Load 7 of (Key (Picked unit)) in Hashtable))
      • Hashtable - Save (Load 21 of (Key (Picked unit)) from Hashtable) as 21 of (Key (Picked unit)) in Hashtable
      • Unit - Order (Load 8 of (Key (Picked unit)) in Hashtable) to Orc Tauren Chieftain - War Stomp
      • Custom script: call RemoveLocation(udg_temp_location)
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: call RemoveLocation(udg_p1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 21 of (Key (Picked unit)) from Hashtable) Greater than or equal to 10.00
        • Then - Actions
          • Unit Group - Remove (Load 1 of (Key (Picked unit)) in Hashtable) from Lightning_Field_UG
          • Unit - Create 1 Lightning Field effect for (Owner of (Load 1 of (Key (Picked unit)) in Hashtable)) at (Position of (Load 2 of (Key (Picked unit)) in Hashtable)) facing Default building facing degrees
          • Unit - Add Lightning_Field_Ability[(Level of Lightning Field for Lightning_Field_Caster)] to (Last created unit)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Animation - Change (Last created unit)'s animation speed to 30.00% of its original speed
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Create 1 Lightning Field effect for (Owner of (Load 1 of (Key (Picked unit)) in Hashtable)) at (Position of (Load 2 of (Key (Picked unit)) in Hashtable)) facing Default building facing degrees
          • Animation - Change (Last created unit)'s animation speed to 20.00% of its original speed
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Create 1 Lightning Field effect for (Owner of (Load 1 of (Key (Picked unit)) in Hashtable)) at (Position of (Load 2 of (Key (Picked unit)) in Hashtable)) facing Default building facing degrees
          • Animation - Change (Last created unit)'s animation speed to 10.00% of its original speed
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • For each (Integer x) from 1 to 7, do (Actions)
            • Loop - Actions
              • Unit - Remove (Load (x + 1) of (Key (Picked unit)) in Hashtable) from the game
          • For each (Integer x) from 1 to 11, do (Actions)
            • Loop - Actions
              • Lightning - Destroy (Load (x + 8) of (Key (Picked unit)) in Hashtable)
        • Else - Actions
The first is perfectly MUI but the second doesn't do anything, someone help?


If it is hard to understand all the hashtable:
1 x: caster
--------------------
2 x: dumies 1
3 x: dumies 2
4 x: dumies 3
5 x: dumies 4
6 x: dumies 5
7 x: dumies 6
8 x: dumies 7
---------------------
9 x: lightning 1
10 x: lightning 2
11 x: lightning 3
12 x: lightning 4
13 x: lightning 5
14 x: lightning 6
15 x: lightning 7
16 x: lightning 8
17 x: lightning 9
18 x: lightning 10
19 x: lightning 11
---------------------------
20 x: target point
---------------------------
21 x: angle speed
---------------------------
22 x: i (dummy height)
---------------------------
22 x: angle 1
23 x: angle 2
24 x: angle 3
25 x: angle 4
26 x: angle 5
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Still not MUI due to waits.

Just thought I'd mention that the use of "Triggering Unit" is in fact MUI. This is because "Triggering Unit" creates a local variable, meaning it is not affected by waits. I can confirm this because I have acheived MUI with waits with the use of "Triggering Unit".

I don't know MUI well though, so I'm not saying his trigger is fully MUI...
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I agree with Radicool, its true that while using Hashtables doesnt necessarily means the spell is MUI, also using wait doesnt necessarily mean it is not MUI

but yes you memory leaks in the code and because you loop every 0.01 it is pretty bad memory leak which should be fixed(you dont destroy the Locations when you create them in the Pick every unit in ..., and the same for the first trigger, the last loop leaks 5 Locations per run

I cant directly say if it is MUI or not, because Im not best at reading GUI codes but it doesnt seem that it is not MUI.

But you should consider slowing it down to 0.03 seconds

Why it doesnt work may be because you are using Picked Unit(like order Load 23 of Picked Unit in hashtable) to War Stomp, the PickedUnit is null, so it should return 0 and you have nothing in 0, 23 afaik so noone will war stomp
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Pharaoh_ said:
Triggering unit works just fine with waits. Wait tend to break down the thread of a trigger stack, resulting event responses such as Target unit of ability being cast not to work. They are generally avoided both GUI and Jass, because they are not accurate as timers.

so i should make a countdown timer and dont create a window for it?
The Timer window is only there for indicating the time left of a specific timer, you don't have to use it for a timer to function properly. It's most likely for the sake of visuals, depending on its use, towards the players.
You should use a variable (with indexing of Bribe's) and in the periodic loop, subtract 0.03, depending on the timed event. If the variable[] <= 0, then recycle the index and stop the effect.

Asked 2 years ago
 
please, tell me that you have seen the first spell i posted

the lightnings move around a point (orbit) with a high high speed i can't make the loop 1 second dah :vw_unimpressed:

Time: every one second of the game
Actions:
Pick every unit in castingrightnowgroup and do action {
set INT = load integerthatcounts from hash_casting
if (INT < 6){
set p= position of picked unit
create dummy at p
custom script: call RemoveLocation(udg_p)
}
else {}(dont put here "do nothing" since its a bugged command)
}
condition: castingrightnowgroup is empty equalls to True{
turn off this trigger
}

*** once the phase that create all orbs done, start another phase of moving those orbs.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Time: every one second of the game
Actions:
Pick every unit in castingrightnowgroup and do action {
set INT = load integerthatcounts from hash_casting
if (INT < 6){
set p= position of picked unit
create dummy at p
custom script: call RemoveLocation(udg_p)
}
else {}(dont put here "do nothing" since its a bugged command)
}
condition: castingrightnowgroup is empty equalls to True{
turn off this trigger
}

1. plz explain what does this do
2. plz make it int "
  • [TRIGGER]"
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
You can make "periodic event" loop as fast as every 0,01 seconds.
Also get rid of "waits" as 0,01 wait doesn't really "wait" that shortly. The minimum wait time ranges between ~0,1-0,27 second per use, thus it is unreliable.
 
1. plz explain what does this do
2. plz make it int "
  • [TRIGGER]"[/QUOTE]
  • Your missing a great point in what I try to tell you.
  • You knowledge of hashtables is good, the only reason you fail to do that trigger is because you try to make all the phases with too small trigger ammount: the creation should have a trigger of its own, the spin effect, a trigger of its own. once you split the phases into 2 triggers, the creation of orbs will last 6x0.1 as explain in my last massage, and after all orbs exists, then don't go "do nothing", it is my own mistake in my last massage, instead, go "set Boolean_Finished = True" "save Boolean_Finished in Caster_Hash" then you have a respond that tells you that you can start moving the orbs.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
You can make "periodic event" loop as fast as every 0,01 seconds.
Also get rid of "waits" as 0,01 wait doesn't really "wait" that shortly. The minimum wait time ranges between ~0,1-0,27 second per use, thus it is unreliable.

didn't know for the min wait :vw_wtf:

for getting rid of waits I DO NOT WANT TIMERS as they have every one second or anything else other than 0.01 s loop time because they won't be accurate, using waits will be better....

Your missing a great point in what I try to tell you.
You knowledge of hashtables is good, the only reason you fail to do that trigger is because you try to make all the phases with too small trigger ammount: the creation should have a trigger of its own, the spin effect, a trigger of its own. once you split the phases into 2 triggers, the creation of orbs will last 6x0.1 as explain in my last massage, and after all orbs exists, then don't go "do nothing", it is my own mistake in my last massage, instead, go "set Boolean_Finished = True" "save Boolean_Finished in Caster_Hash" then you have a respond that tells you that you can start moving the orbs.

If i understood right, what you are making is to turn off the loop trigger when no spell is occuring, another thing splitting the first trigger will make the work harder
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
for getting rid of waits I DO NOT WANT TIMERS as they have every one second or anything else other than 0.01 s loop time because they won't be accurate, using waits will be better....
What are you writing about?
Time - Elapsed Game time can be set randomly
Time - Periodic Event can be also set randomly (a periodic 0,03 second event is used to give an impression of fluid movement when moving immobile objects/units)
Time - Timer expires - countdown timer can also be set with random value

When your trigger starts and you want to set things forward by 0,01 second, or with other similarly small values, you switch the loop on and when you no longer need it, you switch it off.
As far as I'm aware, these are more accurate (if not completely) than wait with wait value less than 0,27 second.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
What are you writing about?
Time - Elapsed Game time can be set randomly
Time - Periodic Event can be also set randomly (a periodic 0,03 second event is used to give an impression of fluid movement when moving immobile objects/units)
Time - Timer expires - countdown timer can also be set with random value

When your trigger starts and you want to set things forward by 0,01 second, or with other similarly small values, you switch the loop on and when you no longer need it, you switch it off.
As far as I'm aware, these are more accurate (if not completely) than wait with wait value less than 0,27 second.

one question is there a function that stops loop?
 
one question is there a function that stops loop?
not that I know off, only shutting of a trigger and set your own loop in it (set int and upgrade and check it) could have been totaly usefull tool since when i go random and the loop fail (hero was alleardy picked) I would want the loop too try again and not wait for the next 0.01 check to reach. (tho it not such a big deal but still, its weird that you cant set for loop integer a = -1 and prolong the loop your allready inside at, creating endless loop unless the special case allready occured.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
not that I know off, only shutting of a trigger and set your own loop in it (set int and upgrade and check it) could have been totaly usefull tool since when i go random and the loop fail (hero was alleardy picked) I would want the loop too try again and not wait for the next 0.01 check to reach. (tho it not such a big deal but still, its weird that you cant set for loop integer a = -1 and prolong the loop your allready inside at, creating endless loop unless the special case allready occured.

what the h*** are you talking about :eekani:
 
Status
Not open for further replies.
Top