Boomerang problem ?!?

aki15

New Member
Reaction score
5
Hello everyone, I requested a boomerang spell and it was working good in test map, but not in mine.
-In my map it's damaging it on first hit, but won't damage it when turning back.
Here are the triggers:
Code:
Boomerang Var
    Events
        Map initialization
    Conditions
    Actions
        -------- Set this variable to the base ability "Boomerang" --------
        Set BoAbility = Boomerang 
        -------- Set this variable to the unit "Boomerang Dummy" --------
        Set BoDummy = Boomerang Dummy
        -------- Damage dealt --------
        Set BoReal[0] = 18.00
        -------- Collision area of boomerang --------
        Set BoReal[1] = 130.00
        -------- Maximum distance --------
        Set BoReal[2] = 1200.00
        -------- Speed of boomerang (distance travelled per second) --------
        Set BoReal[3] = 650.00
        -------- ----------------------------------------- --------
        Hashtable - Create a hashtable
        Set Hashtable = (Last created hashtable)

Code:
Boomerang
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to BoAbility
    Actions
        Set TempPoint = (Position of (Triggering unit))
        Set TempOffset = (Target point of ability being cast)
        Unit - Create 1 BoDummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
        Hashtable - Save BoReal[2] as 0 of (Key (Last created unit)) in Hashtable
        Hashtable - Save False as 1 of (Key (Last created unit)) in Hashtable
        Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Last created unit)) in Hashtable
        Hashtable - Save (Angle from TempPoint to TempOffset) as 3 of (Key (Last created unit)) in Hashtable
        Hashtable - Save 4 as 4 of (Key (Last created unit)) in Hashtable
        Unit Group - Add (Last created unit) to BoGroup
        Set BoGroupCount = (BoGroupCount + 1)
        Trigger - Turn on Boomerang Periodic <gen>
        Custom script:   call RemoveLocation(udg_TempPoint)
        Custom script:   call RemoveLocation(udg_TempOffset)

Code:
Boomerang Periodic
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                BoGroupCount Equal to 0
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
                Unit Group - Pick every unit in BoGroup and do (Actions)
                    Loop - Actions
                        Set TempUnit = (Load 2 of (Key (Picked unit)) in Hashtable)
                        Set TempPoint = (Position of (Picked unit))
                        Set TempOffset = (Position of TempUnit)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Distance between TempPoint and TempOffset) Less than or equal to 50.00
                                (Load 1 of (Key (Picked unit)) from Hashtable) Equal to True
                            Then - Actions
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                                Unit Group - Remove (Picked unit) from BoGroup
                                Set BoGroupCount = (BoGroupCount - 1)
                                Unit - Kill (Picked unit)
                            Else - Actions
                                Set BoUnit = (Picked unit)
                                Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
                                Unit Group - Pick every unit in TempGroup and do (Actions)
                                    Loop - Actions
                                        Custom script:   set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                TempBoolean Equal to True
                                            Then - Actions
                                            Else - Actions
                                                Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
                                                Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Custom script:   call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)
                                Custom script:   call DestroyGroup(udg_TempGroup)
                                Set TempReal = (Angle from TempPoint to TempOffset)
                                Custom script:   call RemoveLocation(udg_TempOffset)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Load 0 of (Key (Picked unit)) from Hashtable) Less than or equal to 0.00
                                    Then - Actions
                                        Set TempOffset = (TempPoint offset by (BoReal[3] x 0.03) towards TempReal degrees)
                                        Unit - Move (Picked unit) instantly to TempOffset
                                        Hashtable - Save True as 1 of (Key (Picked unit)) in Hashtable
                                    Else - Actions
                                        Set TempOffset = (TempPoint offset by (BoReal[3] x 0.03) towards (Load 3 of (Key (Picked unit)) from Hashtable) degrees)
                                        Unit - Move (Picked unit) instantly to TempOffset
                                        Hashtable - Save ((Load 0 of (Key (Picked unit)) from Hashtable) - (BoReal[3] x 0.03)) as 0 of (Key (Picked unit)) in Hashtable
                        Custom script:   call RemoveLocation(udg_TempPoint)
                        Custom script:   call RemoveLocation(udg_TempOffset)
Spell made by Ayanami :D !
 

Ayanami

칼리
Reaction score
288
It's not supposed to hit when turning back. o.o Didn't make it that way, lol.
 

Sajin

User title under construction.
Reaction score
56
You can do what i did and have it damage for every 0.03 seconds of game :) what you do is change this section of the third code
Code:
     Then - Actions
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                                Unit Group - Remove (Picked unit) from BoGroup
                                Set BoGroupCount = (BoGroupCount - 1)
                                Unit - Kill (Picked unit)
                            Else - Actions
                                Set BoUnit = (Picked unit)
                                Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
                                Unit Group - Pick every unit in TempGroup and do (Actions)
                                    Loop - Actions
                                        Custom script:   set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                TempBoolean Equal to True
                                            Then - Actions
                                            Else - Actions
                                                Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
                                                Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Custom script:   call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)
to
Code:
     Then - Actions
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                                Unit Group - Remove (Picked unit) from BoGroup
                                Set BoGroupCount = (BoGroupCount - 1)
                                Unit - Kill (Picked unit)
                            Else - Actions
                                Set BoUnit = (Picked unit)
                                Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
                                Unit Group - Pick every unit in TempGroup and do (Actions)
                                    Loop - Actions
                                        Custom script:   set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
                                        Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
                                                Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Custom script:   call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)

Im sure theres another way such as changing TempBoolean back to false when the boomerang turns around but I did it this way to make it more epic ;)
 

Ayanami

칼리
Reaction score
288
You can do what i did and have it damage for every 0.03 seconds of game :) what you do is change this section of the third code
Code:
     Then - Actions
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                                Unit Group - Remove (Picked unit) from BoGroup
                                Set BoGroupCount = (BoGroupCount - 1)
                                Unit - Kill (Picked unit)
                            Else - Actions
                                Set BoUnit = (Picked unit)
                                Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
                                Unit Group - Pick every unit in TempGroup and do (Actions)
                                    Loop - Actions
                                        Custom script:   set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                TempBoolean Equal to True
                                            Then - Actions
                                            Else - Actions
                                                Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
                                                Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Custom script:   call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)
to
Code:
     Then - Actions
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                                Unit Group - Remove (Picked unit) from BoGroup
                                Set BoGroupCount = (BoGroupCount - 1)
                                Unit - Kill (Picked unit)
                            Else - Actions
                                Set BoUnit = (Picked unit)
                                Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
                                Unit Group - Pick every unit in TempGroup and do (Actions)
                                    Loop - Actions
                                        Custom script:   set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
                                        Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
                                                Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Custom script:   call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)

Im sure theres another way such as changing TempBoolean back to false when the boomerang turns around but I did it this way to make it more epic ;)

Wouldn't this actually deal damage per 0.03 seconds? o.o
Although you're saving the boolean, no Conditions are being used to check if the boolean is true or false.
 

Sajin

User title under construction.
Reaction score
56
Wouldn't this actually deal damage per 0.03 seconds? o.o
Although you're saving the boolean, no Conditions are being used to check if the boolean is true or false.

hehe ^^
Quote Originally Posted by Sajin
You can do what i did and have it damage for every 0.03 seconds of game what you do is change this section of the third code
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top