I have no idea what's wrong with these triggers...

Moridin

Snow Leopard
Reaction score
144
Okay. A small problem I'm having. Some of you might be intimidated by the wall of GUI code, but I promise you my problem will probably NOT include you reading through all my code. Firstly: Here are the two triggers:

Trigger:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Static Lightning
    • Actions
      • Set Count = 1
      • Unit Group - Pick every unit in (Units within ((300.00 + (100.00 x (Real((Level of Static Lightning for (Triggering unit)))))) / 2.00) of (Target point of ability being cast) matching ((((Triggering player) is an enemy of (Owner of (Matching unit))) Equal to True) and (((Matching unit) is and do (Actions)
        • Loop - Actions
          • Set Count = (Count + 1)
          • Unit Group - Add (Picked unit) to Units_chosen
          • Unit - Pause (Picked unit)
          • Unit - Set the custom value of (Picked unit) to 0
          • Hashtable - Save Handle Of(Picked unit) as (Key (Triggering unit)) of Count in Spell
          • Hashtable - Save 500 as ((Key (Triggering unit)) + 1) of Count in Spell
          • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\Drain\DrainTarget.mdl
          • Hashtable - Save Handle Of(Last created special effect) as ((Key (Triggering unit)) + 2) of Count in Spell
          • Lightning - Create a Chain Lightning - Primary lightning effect from source (Position of (Triggering unit)) to target (Position of (Picked unit))
          • Hashtable - Save Handle Of(Last created lightning effect) as ((Key (Triggering unit)) + 3) of Count in Spell
      • Hashtable - Save Count as ((Key (Triggering unit)) + 1) of 1 in Spell
      • Game - Display to (All players) the text: ((String(Count)) + = Count)
      • Unit Group - Add (Triggering unit) to Units_casting
      • Unit - Pause (Triggering unit)
      • Animation - Play (Triggering unit)'s channel animation


Trigger:
  • Drag
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Units_casting and do (Actions)
        • Loop - Actions
          • Set Stopper = 1
          • For each (Integer Drag_V_1) from 2 to (Load ((Key (Picked unit)) + 1) of 1 from Spell), do (Actions)
            • Loop - Actions
              • Set current_unit = (Load (Key (Picked unit)) of Drag_V_1 in Spell)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (current_unit is in Units_chosen) Equal to False
                • Then - Actions
                  • Set Stopper = (Stopper + 1)
                  • Game - Display to (All players) the text: ((String(Stopper)) + = Stopper)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Stopper Equal to (Load ((Key (Picked unit)) + 1) of 1 from Spell)
                    • Then - Actions
                      • Game - Display to (All players) the text: ((String(Stopper)) + = Stopper)
                      • Game - Display to (All players) the text: Stopping from main ...
                      • Unit Group - Remove (Picked unit) from Units_casting
                      • Unit - Unpause (Picked unit)
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Spell
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (current_unit is dead) Equal to True
                • Then - Actions
                  • Unit Group - Remove current_unit from Units_chosen
                  • Unit - Set the custom value of current_unit to 2
                  • Unit - Unpause current_unit
                  • Unit - Turn collision for current_unit On
                  • Special Effect - Destroy (Load ((Key (Picked unit)) + 2) of Drag_V_1 in Spell)
                • Else - Actions
                  • Unit - Turn collision for current_unit Off
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between (Position of current_unit) and (Position of (Picked unit))) Less than or equal to 150.00
                    • Then - Actions
                      • Unit - Set the custom value of current_unit to 1
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load ((Key (Picked unit)) + 1) of Drag_V_1 from Spell) Less than or equal to 0
                    • Then - Actions
                      • Unit Group - Remove current_unit from Units_chosen
                      • Unit - Set the custom value of current_unit to 2
                      • Unit - Unpause current_unit
                      • Unit - Turn collision for current_unit On
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Custom value of current_unit) Equal to 0
                    • Then - Actions
                      • Lightning - Move (Load ((Key (Picked unit)) + 3) of Drag_V_1 in Spell) to source (Position of (Picked unit)) and target (Position of current_unit)
                      • Unit - Move current_unit instantly to ((Position of current_unit) offset by 1.00 towards (Angle from (Position of current_unit) to (Position of (Picked unit))) degrees)
                      • Unit - Cause (Picked unit) to damage current_unit, dealing ((40.00 x 0.03) x (Real((Level of Static Lightning for (Picked unit))))) damage of attack type Spells and damage type Normal
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Custom value of current_unit) Equal to 1
                    • Then - Actions
                      • Lightning - Destroy (Load ((Key (Picked unit)) + 3) of Drag_V_1 in Spell)
                      • Special Effect - Destroy (Load ((Key (Picked unit)) + 2) of Drag_V_1 in Spell)
                      • Special Effect - Create a special effect at (Position of current_unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                      • Unit - Move current_unit instantly to ((Position of current_unit) offset by 20.00 towards (Angle from (Position of (Picked unit)) to (Position of current_unit)) degrees)
                      • Unit - Cause (Picked unit) to damage current_unit, dealing ((40.00 x (20.00 / 500.00)) x (Real((Level of Static Lightning for (Picked unit))))) damage of attack type Spells and damage type Normal
                      • Hashtable - Save ((Load ((Key (Picked unit)) + 1) of Drag_V_1 from Spell) - 20) as ((Key (Picked unit)) + 1) of Drag_V_1 in Spell
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load ((Key (Picked unit)) + 1) of 1 from Spell) Less than 2
              • ((Picked unit) is paused) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Stopping from side ...
              • Unit Group - Remove (Picked unit) from Units_casting
              • Unit - Unpause (Picked unit)
            • Else - Actions

Now my problem is that this piece of code:

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Stopper Equal to (Load ((Key (Picked unit)) + 1) of 1 from Spell)
    • Then - Actions
      • Game - Display to (All players) the text: ((String(Stopper)) + = Stopper)
      • Game - Display to (All players) the text: Stopping from main ...
      • Unit Group - Remove (Picked unit) from Units_casting
      • Unit - Unpause (Picked unit)
      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Spell
    • Else - Actions


....in the second trigger somehow loops it back to the first trigger. I have no idea why it does this...and I need it to stop. No where in the either trigger have I used the actions:

Trigger - Run trigger (Checking conditions)/(ignoring conditions)

Edit: also how do you hide stuff with spoilers ? :S
 

jomik

New Member
Reaction score
17
Edit: also how do you hide stuff with spoilers ? :S
Think you hide them with
tags :p

I'm looking over your code now >.<

What are you doing with the
Trigger:
  • Stopper Equal to (Load ((Key (Picked unit)) + 1) of 1 from Spell)

condition? 1 from Spell? :O

Ahh think I know now :p I dunno much about hashtables, so it's probably some hashtable thing? :p
And you have massive amounts of leaks :D
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Well, I don't know why it would be going back to the first trigger, but I think you have the child/parent keys swapped when saving to the hashtable.

If you want to be able to do this:
Trigger:
  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Spell


Then the way you're doing it:
Trigger:
  • Hashtable - Save Handle Of(Last created lightning effect) as ((Key (Triggering unit)) + 3) of Count in Spell

...is backwards. You'd need to do this:
Trigger:
  • ...
    • Hashtable - Save Handle Of(Picked unit) as (4*Count) of (Key (Triggering unit)) in Spell
    • Hashtable - Save 500 as ((4*Count) + 1) of (Key (Triggering unit)) in Spell
    • Hashtable - Save Handle Of(Last created special effect) as ((4*Count) + 2) of (Key (Triggering unit)) in Spell
    • Hashtable - Save Handle Of(Last created lightning effect) as ((4*Count) + 3) of (Key (Triggering unit)) in Spell


Edit: also how do you hide stuff with spoilers ? :S
Spoilers don't work in all the forums, eg. they work in Tutorials and Resources, but not in World Editor Help. :(
 

Moridin

Snow Leopard
Reaction score
144
If you want to be able to do this:
Trigger:

* Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Spell



Then the way you're doing it:
Trigger:

* Hashtable - Save Handle Of(Last created lightning effect) as ((Key (Triggering unit)) + 3) of Count in Spell


...is backwards. You'd need to do this:
Trigger:

* ...
o Hashtable - Save Handle Of(Picked unit) as (4*Count) of (Key (Triggering unit)) in Spell
o Hashtable - Save 500 as ((4*Count) + 1) of (Key (Triggering unit)) in Spell
o Hashtable - Save Handle Of(Last created special effect) as ((4*Count) + 2) of (Key (Triggering unit)) in Spell
o Hashtable - Save Handle Of(Last created lightning effect) as ((4*Count) + 3) of (Key (Triggering unit)) in Spell

Haha. Don't worry. I think I know what I'm doing. Thank you for the help anyway. The way my hashtable is organised is:

Casting unit Bash distance
Sub-unit Effect for s-u
Sub-unit Effect for s-u
Sub-unit Effect for s-u
Sub-unit Effect for s-u
------

I'm looking over your code now >.<

What are you doing with the
Trigger:

* Stopper Equal to (Load ((Key (Picked unit)) + 1) of 1 from Spell)


condition? 1 from Spell? :O

Ahh think I know now I dunno much about hashtables, so it's probably some hashtable thing?
And you have massive amounts of leaks

The way I've triggered the spell, it causes all the targeted units to do their actions simultaneously no matter who the caster is. In this way, I have no easy way of checking whether a specific caster has finished casting the spell or not. To avoid bugs with a caster being later designated as the point for a drag/bash, I use the stopper variable to determine exactly how many unit's a caster has already run the spell through. If that number(stopper) = the count of units targeted by that caster...then his spell must be over...so I remove him from the group.
 

jomik

New Member
Reaction score
17
Hmm, I can't see the error :O But it's a kinda complex code too :S
You should start on JASS :p

How do you check that it goes back to the first trigger? :)
 

Moridin

Snow Leopard
Reaction score
144
I put numerous text messages around....and found that a text message in the first trigger was getting triggered again and again.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top