Spell Problems

Gwafu

Active Member
Reaction score
12
Confuse
When the effect runs out, the confused/target unit still attacks his last attacked unit.

Trigger:
  • Confusion 1
    • Events
    • Conditions
      • ((Damage source) is in Confusion_UG) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Key target) is stored as a Handle of (Key (Damage source)) in Confusion_Hash) Equal to False
        • Then - Actions
          • Hashtable - Save Handle Of(Triggering unit) as (Key target) of (Key (Damage source)) in Confusion_Hash
        • Else - Actions



Trigger:
  • Confusion 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Confusion 1 <gen> the event (Unit - (Triggering unit) Takes damage)


Trigger:
  • Confusion 3
    • 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
          • (Confusion_UG is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in Confusion_UG and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Key target) is stored as a Handle of (Key (Picked unit)) in Confusion_Hash) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Confusion ) Equal to True
                    • Then - Actions
                      • Set Confusion_Point = (Position of (Picked unit))
                      • Set Confusion_TempGroup = (Units within (Current acquisition range of (Picked unit)) of Confusion_Point matching ((Life of (Matching unit)) Greater than (0.41 - 0.05)))
                      • Unit - Order (Picked unit) to Attack (Random unit from Confusion_TempGroup)
                      • Custom script: call DestroyGroup (udg_Confusion_TempGroup)
                      • Custom script: call RemoveLocation (udg_Confusion_Point)
                    • Else - Actions
                      • Hashtable - Save Handle OfNo unit as (Key target) of (Key (Picked unit)) in Confusion_Hash
                      • Unit - Order (Picked unit) to Stop
                      • Unit Group - Remove (Picked unit) from Confusion_UG
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Confusion_Hash
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of (Load (Key target) of (Key (Picked unit)) in Confusion_Hash)) Less than (0.41 - 0.05)
                    • Then - Actions
                      • Hashtable - Save Handle OfNo unit as (Key target) of (Key (Picked unit)) in Confusion_Hash
                      • Unit - Order (Picked unit) to Stop
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Confusion_Hash
                    • Else - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)


Trigger:
  • Confusion 4
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • ((Triggering unit) is in Confusion_UG) Equal to True
    • Actions
      • Set Confusion_MainUnit = (Load (Key target) of (Key (Triggering unit)) in Confusion_Hash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Confusion_MainUnit) Greater than (0.41 - 0.05)
        • Then - Actions
          • Wait 0.00 seconds
          • Unit - Order (Triggering unit) to Attack Confusion_MainUnit
        • Else - Actions


Trigger:
  • Confusion 5
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Confusion
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in Confusion_UG) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to Confusion_UG
          • Trigger - Turn on Confusion 3 <gen>
        • Else - Actions


Trigger:
  • Confusion 6
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Confusion_UG) Equal to True
    • Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Confusion_Hash
      • Unit Group - Remove (Triggering unit) from Confusion_UG


Here's what it does:

~The target unit will randomly attack anything and it's uncontrollable, but after the effect runs out, it should stop attacking (if the target is a friend) or continue attacking (if it is an enemy).

~Gwafu
 

Moridin

Snow Leopard
Reaction score
144
I'm not exactly sure how the boolean hashtable conditions work, but an efficient way to find out why it isn't stopping is to use

Game - Display text to all players

..command.

Also, because you know that the problem is where the unit doesn't stop, you can narrow the possiblities to:
1) The conditions never not get satisfied, meaning the code never gets to the blocks where it orders the stop.
2) It gets to the block but the stop order doesn't work (highly unlikely).

Just run through those conditions and ensure that they really will give false once the spell is over.
 

Gwafu

Active Member
Reaction score
12
Hmm, I think the periodic is the problem.
I set it to 0.50, it still don't stop.
I set it to 0.25, still don't
Set it to 0.15, and it goes crazy. Like it can't attack now, it's like the target is dancing and won't attack.
 

farold

New Member
Reaction score
3
Trigger:
  • Actions
    • Unit - Pause (Triggering unit)
    • Unit - Unpause (Triggering unit)

Try this :thup:
 

hgkjfhfdsj

Active Member
Reaction score
55
- disable/enable trigger in confusion 4 before ordering triggering unit to attack CofusionMainUnit (infinite loop)
- remove unit from group before ordering to stop (so it doesnt fire the order event(
 

Gwafu

Active Member
Reaction score
12
What do you mean by disable? Where should I enable it and disable it?
 

hgkjfhfdsj

Active Member
Reaction score
55
freehand:
Trigger:
  • Confusion 4
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • ((Triggering unit) is in Confusion_UG) Equal to True
    • Actions
      • Set Confusion_MainUnit = (Load (Key target) of (Key (Triggering unit)) in Confusion_Hash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Confusion_MainUnit) Greater than (0.41 - 0.05)
        • Then - Actions
          • Wait 0.00 seconds
          • Disable (This Trigger)
          • Unit - Order (Triggering unit) to Attack Confusion_MainUnit
          • Enable (This Trigger)
        • Else - Actions


you probably wont need the wait in this case

Trigger:
  • Else - Actions
    • Hashtable - Save Handle OfNo unit as (Key target) of (Key (Picked unit)) in Confusion_Hash
    • Unit Group - Remove (Picked unit) from Confusion_UG //switch these 2
    • Unit - Order (Picked unit) to Stop //switch these 2
    • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Confusion_Hash
 

hgkjfhfdsj

Active Member
Reaction score
55
so what was the problem again?
- purpose of damage event? i dont think a unit that is changing target every 1s will ever land a hit :p
- i suggest you set the target in Confusion 3 when 'key target is stored == false' rather than on damage
- switch turn on/off (off first then on)
- on buff removal, spell ends >> unit stops attacking
- Confusion_MainUnit in Confusion 4 will most likely be null
 

Gwafu

Active Member
Reaction score
12
i suggest you set the target in Confusion 3 when 'key target is stored == false' rather than on damage
Care to explain?

switch turn on/off (off first then on)
Oh lol.

on buff removal, spell ends >> unit stops attacking
Dude, wait, what?

Confusion_MainUnit in Confusion 4 will most likely be null
I'll run more tests.



EDIT: Nevermind ._., managed to make it work.
 
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