• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Spell problem

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
I made a spell earlier today, it works fine when casting but when i try with 2 units at the same time it wont even start they do the first attack and then stop. with other words it is not mui

the spell should be teleported around the unit and attack for dmg

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- to make it look good you need to change it based on wich model you use --------
      • Set KS_animation_Speed = 300.00
      • Set KS_dmg_per_attack[1] = 10.00
      • Set KS_dmg_per_attack[2] = 20.00
      • Set KS_dmg_per_attack[3] = 30.00
      • Set KS_number_of_attacks = 6
      • -------- How far from the target the unit will stand --------
      • Set KS_range = 50.00
      • -------- - --------
      • Hashtable - Create a hashtable
      • Set KS_hash = (Last created hashtable)
      • Set KS_handle[1] = (Triggering unit)
      • Set KS_handle[2] = (Picked unit)
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set KS_time = 0.00
      • Set KS_caster = (Triggering unit)
      • Set KS_target = (Target unit of ability being cast)
      • Set KS_target_loc = (Position of KS_target)
      • Set KS_facing = ((Facing of KS_target) / 2.00)
      • Set KS_move_to_loc = (KS_target_loc offset by KS_range towards KS_facing degrees)
      • Unit - Move KS_caster instantly to KS_move_to_loc
      • Unit - Make KS_caster face KS_target over 0.00 seconds
      • Animation - Change KS_caster's animation speed to 300.00% of its original speed
      • Animation - Play KS_caster's Attack Slam animation
      • Unit - Cause KS_caster to damage KS_target, dealing KS_dmg_per_attack[(Level of (Ability being cast) for KS_caster)] damage of attack type Spells and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KS_group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on loop <gen>
        • Else - Actions
      • Set KS_attack_count = 1
      • Hashtable - Save KS_attack_count as 1 of (Key KS_handle[1]) in KS_hash
      • Hashtable - Save Handle OfKS_caster as 2 of (Key KS_handle[1]) in KS_hash
      • Hashtable - Save Handle OfKS_target as 3 of (Key KS_handle[1]) in KS_hash
      • Hashtable - Save KS_time as 4 of (Key KS_handle[1]) in KS_hash
      • Unit Group - Add KS_caster to KS_group
      • Custom script: call RemoveLocation(udg_KS_target_loc)
      • Custom script: call RemoveLocation(udg_KS_move_to_loc)
  • loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KS_group and do (Actions)
        • Loop - Actions
          • Set KS_time = (Load 4 of (Key KS_handle[2]) from KS_hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KS_time Less than 0.40
            • Then - Actions
              • Set KS_time = (KS_time + 0.01)
              • Hashtable - Save KS_time as 4 of (Key KS_handle[2]) in KS_hash
            • Else - Actions
              • Set KS_attack_count = (Load 1 of (Key KS_handle[2]) from KS_hash)
              • Set KS_caster = (Load 2 of (Key KS_handle[2]) in KS_hash)
              • Set KS_target = (Load 3 of (Key KS_handle[2]) in KS_hash)
              • Set KS_random = (Random integer number between 1 and 3)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KS_random Equal to 2
                • Then - Actions
                  • Set KS_facing = ((Facing of KS_target) - 90.00)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KS_random Equal to 1
                • Then - Actions
                  • Set KS_facing = ((Facing of KS_target) - 180.00)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KS_random Equal to 3
                • Then - Actions
                  • Set KS_facing = ((Facing of KS_target) + 90.00)
                • Else - Actions
              • Set KS_target_loc = (Position of KS_target)
              • Set KS_move_to_loc = (KS_target_loc offset by KS_range towards KS_facing degrees)
              • Unit - Move KS_caster instantly to KS_move_to_loc
              • Unit - Make KS_caster face KS_target over 0.00 seconds
              • Animation - Play KS_caster's Attack Slam animation
              • Unit - Cause KS_caster to damage KS_target, dealing KS_dmg_per_attack[(Level of (Ability being cast) for KS_caster)] damage of attack type Spells and damage type Normal
              • Set KS_attack_count = (1 + KS_attack_count)
              • Set KS_time = 0.00
              • Hashtable - Save KS_attack_count as 1 of (Key KS_handle[2]) in KS_hash
              • Hashtable - Save KS_time as 4 of (Key KS_handle[2]) in KS_hash
              • Custom script: call RemoveLocation(udg_KS_target_loc)
              • Custom script: call RemoveLocation(udg_KS_move_to_loc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KS_attack_count Greater than or equal to 6
                • Then - Actions
                  • Animation - Change KS_caster's animation speed to 100.00% of its original speed
                  • Unit Group - Remove KS_caster from KS_group
                  • Hashtable - Clear all child hashtables of child 1 in KS_hash
                  • Hashtable - Clear all child hashtables of child 2 in KS_hash
                  • Hashtable - Clear all child hashtables of child 3 in KS_hash
                  • Hashtable - Clear all child hashtables of child 4 in KS_hash
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (KS_group is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions


//slowed makers fix did it
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Create an integer variable. I'll name it ID.

In cast trigger:
  • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
Then save stuff like this:
  • Hashtable - Save KS_attack_count as 1 of ID in KS_hash
  • Hashtable - Save Handle OfKS_caster as 2 of ID in KS_hash
  • ...
In looping trigger:
  • Custom script: set udg_ID = GetHandleId(GetEnumUnit())
And load stuff using ID.
 
Status
Not open for further replies.
Top