Help with spell, [GUI]

NeuroToxin

New Member
Reaction score
46
Okay, the dummy unit moves, then stops, and I have messages put in here, so that the trigger tells me where it is, but it just doesnt work. The dummy unit isnt being removed either, and it says that the unit reached the target before it even goes anywhere, it doesnt move
Trigger:
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HomingTable = (Last created hashtable)

Trigger:
  • Homing Rocket GUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cffffff00H|r|cffff0080oming Missle|r
    • Actions
      • Set Caster = (Triggering unit)
      • Unit Group - Add Caster to HomingGroup
      • Set TargetUnit = (Target Unit of (Ability Being Cast))
      • Set CasterLoc = (Position of (Triggering unit))
      • Set TargetUnitLoc = (Position of (Target unit of ability being cast))
      • Set Angle = (Angle from CasterLoc to TargetUnitLoc)
      • Unit - Create 1 Rocket_Unit for (Owner of Caster) at (CasterLoc offset by 100.00 towards Angle degrees) facing Angle degrees
      • Hashtable - Save Handle OfDummyUnit as 2 of (Key (Last created unit)) in HomingTable
      • Unit - Set level of Dummy_StormBolt for (Last created unit) to (Level of |cffffff00H|r|cffff0080oming Missle|r for (Load 0 of 1 in HomingTable))
      • Set DummyUnit = (Last created unit)
      • Unit Group - Add (Last created unit) to HomingRocketGroup
      • Game - Display to (All players) the text: Homing Rocket Start...
      • Hashtable - Save Handle OfCaster as 0 of (Key (Triggering unit)) in (Last created hashtable)
      • Hashtable - Save Handle OfTargetUnit as 1 of (Key (Target unit of ability being cast)) in HomingTable
      • Trigger - Turn on Homing Rocket Move <gen>

Trigger:
  • Homing Rocket Move
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in HomingGroup) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in HomingGroup and do (Actions)
            • Loop - Actions
              • Set TargetUnit = (Load 1 of (Key (Target unit of ability being cast)) in HomingTable)
              • Set DummyUnit = (Load 2 of (Key (Last created unit)) in HomingTable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between DummyLoc and TargetUnitLoc) Less than or equal to 40.00
                • Then - Actions
                  • Game - Display to (All players) the text: Unit Is Reaching Ta...
                  • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
                  • Unit Group - Remove DummyUnit from HomingRocketGroup
                  • Unit - Remove DummyUnit from the game
                  • Custom script: call RemoveLocation(udg_CasterLoc)
                  • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                  • Custom script: call RemoveLocation(udg_DummyLoc)
                  • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in HomingTable
                  • Hashtable - Clear all child hashtables of child (Key (Last created unit)) in HomingTable
                  • Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in HomingTable
                • Else - Actions
                  • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                  • Custom script: call RemoveLocation(udg_DummyLoc)
                  • Set DummyLoc = (Position of DummyUnit)
                  • Set TargetUnitLoc = (Position of TargetUnit)
                  • Set PointsMovedPerSecond = ((Distance between DummyLoc and TargetUnitLoc) x 0.04)
                  • Set Angle = (Angle from DummyLoc to TargetUnitLoc)
                  • Unit Group - Pick every unit in HomingRocketGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Move DummyUnit instantly to (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between TargetUnitLoc and DummyLoc) Less than or equal to 40.00
                        • Then - Actions
                          • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
                          • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Unit - Remove DummyUnit from the game
                          • Custom script: call RemoveLocation(udg_CasterLoc)
                          • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                          • Custom script: call RemoveLocation(udg_DummyLoc)
                          • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in HomingTable
                          • Hashtable - Clear all child hashtables of child (Key (Last created unit)) in HomingTable
                          • Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in HomingTable
                        • Else - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)
 

Flare

Stops copies me!
Reaction score
664
Code:
Set TargetUnit = (Load 1 of (Key (Target unit of ability being cast)) in HomingTable)
Found this (amongst other things) in your periodic trigger - given that the event is Periodic Event, how is the game engine supposed to know who Target unit of ability being cast is? Just have a quick think about what you're trying to do, relative to the code that is in place in your trigger, before you implement it - the event dictates what event response functions you can/can't use so an event, completely unrelated to a unit, is incapable of defining a legitimate value for the event response to return.

Given that you need some way of getting that information across, I'd recommend using the dummy unit as parent key with all the data being saved (instead of designating each unit as a key for stuff, just for the sake of doing so) - that way, you can do your "Pick every unit" loop, and load your data from using the keys (ChildKey*, Key of Picked Unit)

*Replace this with whatever your child key is - in your case, it'd be 0, 1, 2 or something like that, depending on what data needs to be loaded at the time

Code:
Unit - Move DummyUnit instantly to (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
Leak - save the offset location to a variable, and destroy it appropriately
 

Ashlebede

New Member
Reaction score
43
For god's sake...

DO NOT. POST. MULTIPLE THREADS. ASKING. THE. SAME. QUESTION. This will be heavily enforced. Most same-question threads will be deleted.

This is, I'm pretty sure, your 4th threads about this spell. Although one was your attempt to make it in vJass and I can understand that, it's still 2 GUI threads requesting help and 2 Jass threads requesting help for the same spell.

On-Topic :

Code:
[WC3]//
Hashtable - Save Handle OfDummyUnit as 2 of (Key (Last created unit)) in HomingTable
Hashtable - Save Handle OfCaster as 0 of (Key (Triggering unit)) in (Last created hashtable)
Hashtable - Save Handle OfTargetUnit as 1 of (Key (Target unit of ability being cast)) in HomingTable[/WC3][WC3]//
Set TargetUnit = (Load 1 of (Key (Target unit of ability being cast)) in HomingTable)
Set DummyUnit = (Load 2 of (Key (Last created unit)) in HomingTable)[/WC3]

Should rather be :

Code:
[WC3]//
Hashtable - Save Handle OfDummyUnit as 2 of (Key (TRIGGERING UNIT)) in HomingTable
Hashtable - Save Handle OfCaster as 0 of (Key (TRIGGERING UNIT)) in HomingTable
Hashtable - Save Handle OfTargetUnit as 1 of (Key (TRIGGERING UNIT)) in HomingTable[/WC3][WC3]//
Set TargetUnit = (Load 1 of (Key (PICKED UNIT)) in HomingTable)
Set DummyUnit = (Load 2 of (Key (PICKED UNIT)) in HomingTable)[/WC3]

That means your units weren't loaded correctly from the hashtable, which explains a few... problems... upon testing.

You'd have to save everything in your triggering unit's Hashtable, since (Target unit of ability being cast) and such ain't accessible from your periodic trigger. That's why we have to use Hashtables at all. We add the Triggering unit to a unit group, so that's the only one we can access easily. We then associate the other units (dummy & target) to the triggering unit by using the hashtable.

You could do this for the target unit or even the dummy unit instead of the triggering unit. But it's sort of a convention to store everything in the triggering unit's key in the hashtable.

Trigger:
  • If - Conditions
    • (Distance between DummyLoc and TargetUnitLoc) Less than or equal to 40.00


You didn't set the value of DummyLoc and TargetUnitLoc before using them.

There is also the "Pick every unit in HomingRocketGroup" which should be removed, since there is, technically, only one rocket per caster, assuming there is a cooldown on your ability.
 

NeuroToxin

New Member
Reaction score
46
Well, its not the same question, last time. I had no idea at ALL what I was doing with my hashtables, and thats a good point
And, I am setting those, I remove them when the periodic is run, EDIT I see what you mean, and once again, dude you're like jesus
and the HomingRocketGroup is so its mui, at least I think I have to do that dont i?
 

Ashlebede

New Member
Reaction score
43
This is what you have :

Trigger:
  • //
    • Unit Group - Pick every unit in HomingRocketGroup and do (Actions)
      • Loop - Actions
        • Unit - Move DummyUnit instantly to (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Distance between TargetUnitLoc and DummyLoc) Less than or equal to 40.00
          • Then - Actions
            • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
            • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
            • Special Effect - Destroy (Last created special effect)
            • Unit - Remove DummyUnit from the game
            • Custom script: call RemoveLocation(udg_CasterLoc)
            • Custom script: call RemoveLocation(udg_TargetUnitLoc)
            • Custom script: call RemoveLocation(udg_DummyLoc)
            • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in HomingTable
            • Hashtable - Clear all child hashtables of child (Key (Last created unit)) in HomingTable
            • Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in HomingTable
          • Else - Actions


This is what you should have :

Trigger:
  • //
    • Set OffsetPoint = (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
    • Unit - Move DummyUnit instantly to OffsetPoint
    • Custom Script : call RemoveLocation(udg_OffsetPoint)
    • Custom Script : call RemoveLocation(udg_DummyLoc)
    • Custom Script : call RemoveLocation(udg_TargetUnitLoc)


You don't need a group with the rockets in it, for they are stored in the caster's key's section of the hashtable. That means you can retrieve it without using a group.
 

NeuroToxin

New Member
Reaction score
46
Okay, I get it, thanks :D
EDIT: Its not MUI for some reason, its not moving more than one at once And its not dealing damage, I made a dummy stormbolt ability, but its not working
I have this
Trigger:
  • Homing Rocket GUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cffffff00H|r|cffff0080oming Missle|r
    • Actions
      • Set Caster = (Triggering unit)
      • Unit Group - Add Caster to HomingGroup
      • Set TargetUnit = (Target unit of ability being cast)
      • Set CasterLoc = (Position of (Triggering unit))
      • Set TargetUnitLoc = (Position of (Target unit of ability being cast))
      • Set Angle = (Angle from CasterLoc to TargetUnitLoc)
      • Unit - Create 1 Rocket_Unit for (Owner of Caster) at (CasterLoc offset by 100.00 towards Angle degrees) facing Angle degrees
      • Set DummyUnit = (Last created unit)
      • Hashtable - Save Handle OfDummyUnit as 2 of (Key (Triggering unit)) in HomingTable
      • Unit - Set level of Dummy_StormBolt for (Last created unit) to (Level of |cffffff00H|r|cffff0080oming Missle|r for (Load 0 of 1 in HomingTable))
      • Game - Display to (All players) the text: Homing Rocket Start...
      • Hashtable - Save Handle OfCaster as 0 of (Key (Triggering unit)) in (Last created hashtable)
      • Hashtable - Save Handle OfTargetUnit as 1 of (Key (Triggering unit)) in HomingTable
      • Set DummyLoc = (Position of DummyUnit)
      • Hashtable - Save Handle OfDummyLoc as 5 of (Key (Triggering unit)) in (Last created hashtable)
      • Hashtable - Save Handle OfTargetUnitLoc as 6 of (Key (Triggering unit)) in (Last created hashtable)
      • Trigger - Turn on Homing Rocket Move <gen>

Trigger:
  • Homing Rocket Move
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in HomingGroup) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in HomingGroup and do (Actions)
            • Loop - Actions
              • Set TargetUnit = (Load 1 of (Key (Picked unit)) in HomingTable)
              • Set DummyUnit = (Load 2 of (Key (Picked unit)) in HomingTable)
              • Set DummyLoc = (Load 6 of (Key (Picked unit)) in HomingTable)
              • Set TargetUnitLoc = (Load 7 of (Key (Picked unit)) in HomingTable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between DummyLoc and TargetUnitLoc) Less than or equal to 40.00
                • Then - Actions
                  • Game - Display to (All players) the text: Unit Is Reaching Ta...
                  • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
                  • Unit Group - Remove Caster from HomingGroup
                  • Unit - Remove DummyUnit from the game
                  • Custom script: call RemoveLocation(udg_CasterLoc)
                  • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                  • Custom script: call RemoveLocation(udg_DummyLoc)
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in HomingTable
                • Else - Actions
                  • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                  • Custom script: call RemoveLocation(udg_DummyLoc)
                  • Set DummyLoc = (Position of DummyUnit)
                  • Hashtable - Save Handle OfDummyLoc as 6 of (Key (Picked unit)) in HomingTable
                  • Set TargetUnitLoc = (Position of TargetUnit)
                  • Hashtable - Save Handle OfTargetUnitLoc as 7 of (Key (Picked unit)) in HomingTable
                  • Set DummyLoc = (Load 6 of (Key (Picked unit)) in HomingTable)
                  • Set TargetUnitLoc = (Load 7 of (Key (Picked unit)) in HomingTable)
                  • Set PointsMovedPerSecond = ((Distance between DummyLoc and TargetUnitLoc) x 0.04)
                  • Set Angle = (Angle from DummyLoc to TargetUnitLoc)
                  • Unit - Move DummyUnit instantly to (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between TargetUnitLoc and DummyLoc) Less than or equal to 40.00
                    • Then - Actions
                      • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
                      • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Remove DummyUnit from the game
                      • Unit Group - Remove Caster from HomingGroup
                      • Custom script: call RemoveLocation(udg_CasterLoc)
                      • Custom script: call RemoveLocation(udg_TargetUnitLoc)
                      • Custom script: call RemoveLocation(udg_DummyLoc)
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in HomingTable
                    • Else - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)

Trigger:
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HomingTable = (Last created hashtable)
 

Ashlebede

New Member
Reaction score
43
Trigger:
  • Unit Group - Remove Caster from HomingGroup


The variable Caster wasn't set before. That should be (Picked unit).


Trigger:
  • //
    • Set DummyLoc = (Load 6 of (Key (Picked unit)) in HomingTable)
    • Set TargetUnitLoc = (Load 7 of (Key (Picked unit)) in HomingTable)


Should be :

Trigger:
  • //
    • Set DummyLoc = (Position of DummyUnit)
    • Set TargetUnitLoc = (Position of TargetUnit)


You don't need to save their locations in the hashtable, for they are both likely to change every time the script is run (every .04 second). Not to mention you didn't save them in slots 6 & 7 upon spell cast, which would explain the 'if' not working well...


Trigger:
  • //
    • Hashtable - Save Handle OfDummyLoc as 5 of (Key (Triggering unit)) in (Last created hashtable)
    • Hashtable - Save Handle OfTargetUnitLoc as 6 of (Key (Triggering unit)) in (Last created hashtable)


Can therefore be removed. Oh, and by the way, it should be in "HomingTable", instead of "(Last created hashtable)", since you might have more than one hashtable.


Trigger:
  • //
    • Unit - Move DummyUnit instantly to (DummyLoc offset by PointsMovedPerSecond towards Angle degrees), facing Angle degrees
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Distance between TargetUnitLoc and DummyLoc) Less than or equal to 40.00
      • Then - Actions
        • Unit - Order DummyUnit to Human Mountain King - Storm Bolt TargetUnit
        • Special Effect - Create a special effect at TargetUnitLoc using Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
        • Special Effect - Destroy (Last created special effect)
        • Unit - Remove DummyUnit from the game
        • Unit Group - Remove Caster from HomingGroup
        • Custom script: call RemoveLocation(udg_CasterLoc)
        • Custom script: call RemoveLocation(udg_TargetUnitLoc)
        • Custom script: call RemoveLocation(udg_DummyLoc)
        • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in HomingTable


Remove that 'if'. You'll check where the projectile is in .04 seconds, no big deal. Or you could only keep one 'if', this one, instead of the 'big' if.
 

Devalut

TH.net Regular
Reaction score
7
may i ask why you need the unit for the spell cast?
if you want i can make a very cheap easy on hit spell
 

Ashlebede

New Member
Reaction score
43
By the way, Storm Bolt is a homing spell, if you want to know. Same for Fireball & a couple others. I've been wondering why you trigger this one...
 

NeuroToxin

New Member
Reaction score
46
Cause, I want it to follow them wherever then increase speed, but for now just follow them so I can make sure it works
 

Laiev

Hey Listen!!
Reaction score
188
@Ashlebede

if i remember right, Fire Ball and Storm Bolt are the same ability :)


@NeuroToxin

you can use Shadow Strike and detect when that unit takes damage if has the buff of Shadow Strike (deals 1 damage and in the trigger, increase the life by 1)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top