• 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.

Tazer Ability

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
Hi, This ability works as a 2.05 second stun using a dummy unit. I also need to create a lightning effect between the 2 points that lasts for 1.05 seconds. I'm having trouble getting a timer to work for me although I know this is the method to use... Trigger in the map below, (Gunner==>Tazer+Tazer timer)

iThanks yous!
 

Attachments

  • Arena Idea 0001A.w3x
    111.7 KB · Views: 46
Level 37
Joined
Mar 6, 2006
Messages
9,243
Does more than one unit use the ability?

Use
  • Custom script: set udg_someInteger = GetHandleId(udg_TZ01_Timer)
Then save stuff like this:
  • Hashtable - Save Handle OfTZ01_Timer as (Key atimer) of someInteger in TZ01_HashT
Use A timer expires event, not a periodic event. Use this in the second trigger:
  • Custom script: set udg_someInteger = GetHandleId(GetExpiredTimer())
And load stuff using someInteger.
 
Level 6
Joined
Oct 4, 2011
Messages
226
Yeah the map im creating I want all the abilities to be capable of MUI.. You designed my "Heatseeker" ability previously and it works pretty well. if the fireball follows too long however the dmg isnt dealt. Also this helped me out i got the scripts in the right place i think but its still glitchy. if more then 1 gunner casts tazer the lightning effects get leaked still. I posted my edited map below.. Your always too helpful :D.

It seems like using the custom script+ integer is close to the same thing as just using a regular variable.. if 2+ units cast it at the same time or very close, it ignores the previously saved one because this system will just save over the last integer variable will it not? I always feel like im getting closer and find myself a step backwards.
 

Attachments

  • Arena Idea 0001B.w3x
    111.8 KB · Views: 101
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,243
It bugs because you're using the same timer for all instances. You need to use different timers.

Another method is to add units into a unit group,. Store a real value into a hashtable, the value represents time. Every 0.03 seconds pick units in the group. Load the real value using GetHandleId integer, subtract 0.03 from the value and if it is 0 or less then do some actions.
 
Level 6
Joined
Oct 4, 2011
Messages
226
Could i use a periodic trigger .03 seconds to check for the time. and use and extra integer for keeping track of how many lightnings have been created by adding +1 to the integer when its casted and -1 from the integer when a lightning is removed. in the periodic trigger if integer 2 = 0 turn off the trigger because all lightnings are nulled. Im having trouble but ill keep trying.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243

  • Tazer
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tazer (Gunner)
    • Actions
      • Set TZ01_CasterUnit = (Casting unit)
      • Set TZ01_CasterPoint = (Position of TZ01_CasterUnit)
      • Set TZ01_OwnerPlayer = (Owner of TZ01_CasterUnit)
      • Set TZ01_TargetUnit = (Target unit of ability being cast)
      • Set TZ01_TargetPoint = (Position of TZ01_TargetUnit)
      • Visibility - Create an initially Enabled visibility modifier for TZ01_OwnerPlayer emitting Visibility from TZ01_TargetPoint to a radius of 180.00
      • Set TZ01_VMOD = (Last created visibility modifier)
      • Lightning - Create a Chain Lightning - Primary lightning effect from source TZ01_CasterPoint to target TZ01_TargetPoint
      • Set TZ01_Lightning = (Last created lightning effect)
      • Unit - Create 1 2.05 second stun for TZ01_OwnerPlayer at TZ01_TargetPoint facing TZ01_TargetPoint
      • Unit - Order (Last created unit) to Attack TZ01_TargetUnit
      • Custom script: call RemoveLocation(udg_TZ01_TargetPoint)
      • Custom script: call RemoveLocation(udg_TZ01_CasterPoint)
      • Custom script: set udg_TZ01_Integer = GetHandleId(udg_TZ01_Timer)
      • Hashtable - Save Handle OfTZ01_Lightning as (Key L) of TZ01_Integer in TZ01_HashT
      • Hashtable - Save 1.05 as (Key time) of TZ01_Integer in TZ01_HashT
      • Unit Group - Add TZ01_CasterUnit to TZ01_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Tazer timer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Tazer timer <gen>
        • Else - Actions
      • Visibility - Destroy TZ01_VMOD
  • Tazer timer
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TZ01_Group and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • Custom script: set udg_TZ01_Integer = GetHandleId(udg_unit)
          • Set SG01_FacingAngle = (Load (Key time) of TZ01_Integer from TZ01_HashT)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SG01_FacingAngle Greater than 0.00
            • Then - Actions
              • Hashtable - Save (SG01_FacingAngle - 0.03) as (Key time) of TZ01_Integer in TZ01_HashT
            • Else - Actions
              • Lightning - Destroy (Load (Key L) of TZ01_Integer in TZ01_HashT)
              • Hashtable - Clear all child hashtables of child TZ01_Integer in TZ01_HashT
              • Unit Group - Remove unit from TZ01_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TZ01_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 4
Joined
Feb 22, 2012
Messages
74
One thing about lightning effects that bothers me is they are stuck to the ground by default. Changing their Z height is a real carnival game for GUI. It looks like the Z value needs to also account for the terrain height because it is based on "absolute" 0.
 
Level 6
Joined
Oct 4, 2011
Messages
226
IsaacNewbton, good point. I thought for changing the lightning positions in my loop trigger to make it a little more easy on the eyes but its good enough for now.
Maker, Thanks thats exactly what I needed (+Rep if I didnt have to spread it around). Had to tweak a few things like setting the TZ01_Integer to the caster unit instead of the timer in trigger 1. Anyways im glad I had to do a little bit at the end to get a bit more understanding of it.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
One thing about lightning effects that bothers me is they are stuck to the ground by default. Changing their Z height is a real carnival game for GUI. It looks like the Z value needs to also account for the terrain height because it is based on "absolute" 0.

just need a bit custom script and its ok

  • set udg_lightning = AddLightningEx ("CLPB", true, x1, y1, z1, x2, y2, z2)
before every gui variable u must put a udg_
lightning is a gui lightning variable and this way u can create lightning and store to variable
("CLPB" is chain lightning primary raw code, u can get every lightning raw code if u convert to text)
(x1,y1,z1 - start point x,y and height, rest the target)

i think worth to use the custom script if u want set the lightning height
 
Level 4
Joined
Feb 22, 2012
Messages
74
yeah but to get the z position you need to get the z-location of a point variable, which returns the terrain height. If you dont have flat terrain and you don't get the z-position from this method, it will be messed up

it is GetLocationZ(var)

here is a map i am working on and it has one spell that uses lightning graphics. you can check the triggers, they are "Wither Cast" and "Wither Effects."
 

Attachments

  • testmap.w3x
    87.7 KB · Views: 50
Level 6
Joined
Oct 4, 2011
Messages
226
I added in some information so that it moves the lightning in the loop trigger. You guys can check these for bugs, I think I got it all setup now Thanks. It moves lightning from the caster to the target unit over the 1.05 second duration.
  • Tazer
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Tazer (Gunner)
    • Actions
      • Set TZ01_CasterUnit = (Casting unit)
      • Set TZ01_CasterPoint = (Position of TZ01_CasterUnit)
      • Set TZ01_OwnerPlayer = (Owner of TZ01_CasterUnit)
      • Set TZ01_TargetUnit = (Target unit of ability being cast)
      • Set TZ01_TargetPoint = (Position of TZ01_TargetUnit)
      • Visibility - Create an initially Enabled visibility modifier for TZ01_OwnerPlayer emitting Visibility from TZ01_TargetPoint to a radius of 180.00
      • Set TZ01_VMOD = (Last created visibility modifier)
      • Lightning - Create a Chain Lightning - Primary lightning effect from source TZ01_CasterPoint to target TZ01_TargetPoint
      • Set TZ01_Lightning = (Last created lightning effect)
      • Countdown Timer - Start TZ01_Timer as a Repeating timer that will expire in 1.05 seconds
      • Set TZ01_Timer = (Last started timer)
      • Unit - Create 1 2.05 second stun for TZ01_OwnerPlayer at TZ01_TargetPoint facing TZ01_TargetPoint
      • Unit - Order (Last created unit) to Attack TZ01_TargetUnit
      • Custom script: call RemoveLocation(udg_TZ01_TargetPoint)
      • Custom script: call RemoveLocation(udg_TZ01_CasterPoint)
      • Custom script: set udg_TZ01_Integer = GetHandleId(udg_TZ01_CasterUnit)
      • Hashtable - Save Handle OfTZ01_Lightning as (Key L) of TZ01_Integer in TZ01_HashT
      • Hashtable - Save 1.05 as (Key time) of TZ01_Integer in TZ01_HashT
      • Hashtable - Save Handle OfTZ01_TargetPoint as (Key loc) of TZ01_Integer in TZ01_HashT
      • Hashtable - Save Handle OfTZ01_TargetUnit as (Key target) of TZ01_Integer in TZ01_HashT
      • Unit Group - Add TZ01_CasterUnit to TZ01_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Tazer timer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Tazer timer <gen>
        • Else - Actions
      • Visibility - Destroy TZ01_VMOD
Loop Trigger:
  • Tazer timer
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TZ01_Group and do (Actions)
        • Loop - Actions
          • Set TZ01_TempUnit = (Picked unit)
          • Custom script: set udg_TZ01_Integer = GetHandleId(udg_TZ01_TempUnit)
          • Set TZ01_TimeReal = (Load (Key time) of TZ01_Integer from TZ01_HashT)
          • Set TZ01_TempLoc = (Position of (Load (Key target) of TZ01_Integer in TZ01_HashT))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TZ01_TimeReal Greater than 0.00
            • Then - Actions
              • Lightning - Move (Load (Key L) of TZ01_Integer in TZ01_HashT) to source (Position of TZ01_TempUnit) and target TZ01_TempLoc
              • Hashtable - Save (TZ01_TimeReal - 0.03) as (Key time) of TZ01_Integer in TZ01_HashT
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc)
            • Else - Actions
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc)
              • Lightning - Destroy (Load (Key L) of TZ01_Integer in TZ01_HashT)
              • Hashtable - Clear all child hashtables of child TZ01_Integer in TZ01_HashT
              • Unit Group - Remove TZ01_TempUnit from TZ01_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TZ01_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 6
Joined
Oct 4, 2011
Messages
226
  • Tazer timer
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TZ01_Group and do (Actions)
        • Loop - Actions
          • Set TZ01_TempUnit = (Picked unit)
          • Custom script: set udg_TZ01_Integer = GetHandleId(udg_TZ01_TempUnit)
          • Set TZ01_TempLoc2 = (Position of TZ01_TempUnit)
          • Set TZ01_TimeReal = (Load (Key time) of TZ01_Integer from TZ01_HashT)
          • Set TZ01_TempLoc = (Position of (Load (Key target) of TZ01_Integer in TZ01_HashT))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TZ01_TimeReal Greater than 0.00
            • Then - Actions
              • Lightning - Move (Load (Key L) of TZ01_Integer in TZ01_HashT) to source TZ01_TempLoc2 and target TZ01_TempLoc
              • Hashtable - Save (TZ01_TimeReal - 0.03) as (Key time) of TZ01_Integer in TZ01_HashT
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc)
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc2)
            • Else - Actions
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc)
              • Custom script: call RemoveLocation(udg_TZ01_TempLoc2)
              • Lightning - Destroy (Load (Key L) of TZ01_Integer in TZ01_HashT)
              • Hashtable - Clear all child hashtables of child TZ01_Integer in TZ01_HashT
              • Unit Group - Remove TZ01_TempUnit from TZ01_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TZ01_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
Ah i missed that lol. Should be fixed
 
Status
Not open for further replies.
Top