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

[Solved] Can't stop charging

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
Hello Hivers, this is me asking for help... Again.

Im just gonna skip right to it, I was doing a sliding trigger(kinda), but the unit I want to be sliding(Its not the caster, its a spawned unit) simply won't stop moving. I've got this feeling that I am missing something obvious, but I simply can't find it. Here are the two triggers and thx in advance.

  • Lightning Rod
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Rod
    • Actions
      • Set LightningRod_Caster = (Triggering unit)
      • Set LightningRod_CasterLoc = (Position of (Triggering unit))
      • Set LightningRod_TargetLoc = (Target point of ability being cast)
      • Set LightningRod_Angle = (Angle from LightningRod_CasterLoc to LightningRod_TargetLoc)
      • Unit - Hide (Triggering unit)
      • Unit - Create 1 Flashrunner Lightning Rod Form for (Owner of (Triggering unit)) at LightningRod_CasterLoc facing Default building facing degrees
      • Set LightningRod_Ball = (Last created unit)
      • Trigger - Turn on Lightning Rod Loop <gen>
  • Lightning Rod Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set LightningRod_Loc2 = (Position of LightningRod_Ball)
      • Set LightningRod_Loc1 = (LightningRod_Loc2 offset by 15.00 towards LightningRod_Angle degrees)
      • Set LightningRod_Distance = (Distance between LightningRod_TargetLoc and LightningRod_Loc2)
      • Custom script: call SetUnitX(udg_LightningRod_Ball,GetLocationX(udg_LightningRod_Loc1))
      • Custom script: call SetUnitY(udg_LightningRod_Ball,GetLocationY(udg_LightningRod_Loc1))
      • Custom script: call RemoveLocation(udg_LightningRod_Loc1)
      • Custom script: call RemoveLocation(udg_LightningRod_Loc2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LightningRod_Distance Greater than 0.00
        • Then - Actions
          • Set LightningRod_Distance = ((Distance between LightningRod_Loc2 and LightningRod_Loc1) / 15.00)
        • Else - Actions
          • Set LightningRod_Distance = (Distance between LightningRod_TargetLoc and LightningRod_Loc2)
          • Trigger - Turn off Lightning Rod Loop <gen>
          • Custom script: call SetUnitX(udg_LightningRod_Caster,GetLocationX(udg_LightningRod_TargetLoc))
          • Custom script: call SetUnitY(udg_LightningRod_Caster,GetLocationY(udg_LightningRod_TargetLoc))
          • Unit - Unhide LightningRod_Caster
          • Unit - Create 1 Dummy for (Owner of LightningRod_Caster) at LightningRod_TargetLoc facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add War Stomp (Neutral Hostile 1) to (Last created unit)
          • Unit - Set level of War Stomp (Neutral Hostile 1) for (Last created unit) to (Level of Lightning Rod for LightningRod_Caster)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Kill LightningRod_Ball
          • Unit - Remove LightningRod_Ball from the game
          • Custom script: call RemoveLocation(udg_LightningRod_Loc1)
          • Custom script: call RemoveLocation(udg_LightningRod_Loc2)
          • Custom script: call RemoveLocation(udg_LightningRod_CasterLoc)
          • Custom script: call RemoveLocation(udg_LightningRod_TargetLoc)
Wall of trigger-text criticals strikes you for 1 zillion damage!

Anyway help much appreciated.
 
You have to substract value form Distance variable instead of '/ 15' - this way it never reaches 0. Don't remove locations in loop trigger if you actually need to for futher purposes.

Use (Triggering player) instead of (Owner of (Triggering unit)).
Using Kill unit action is pointless if you follow it by Remove unit one.
I don't know what you are trying to archieve with this distance manipulation - elaborate please. Don't use 0.00, use a bit higher value to avoid bugs.

  • Lightning Rod
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Rod
    • Actions
      • Set LightningRod_Caster = (Triggering unit)
      • Set LightningRod_CasterLoc = (Position of (Triggering unit))
      • Set LightningRod_TargetLoc = (Target point of ability being cast)
      • Set LightningRod_Angle = (Angle from LightningRod_CasterLoc to LightningRod_TargetLoc)
      • Unit - Hide (Triggering unit)
      • Unit - Create 1 Flashrunner Lightning Rod Form for (Triggering player) at LightningRod_CasterLoc facing Default building facing degrees
      • Set LightningRod_Ball = (Last created unit)
      • Trigger - Turn on Lightning Rod Loop <gen>
  • Lightning Rod Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set LightningRod_Loc2 = (Position of LightningRod_Ball)
      • Set LightningRod_Loc1 = (LightningRod_Loc2 offset by 15.00 towards LightningRod_Angle degrees)
      • Set LightningRod_Distance = (Distance between LightningRod_TargetLoc and LightningRod_Loc2)
      • Custom script: call SetUnitX(udg_LightningRod_Ball,GetLocationX(udg_LightningRod_Loc1))
      • Custom script: call SetUnitY(udg_LightningRod_Ball,GetLocationY(udg_LightningRod_Loc1))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LightningRod_Distance Greater than 30.00
        • Then - Actions
          • Set LightningRod_Distance = ((Distance between LightningRod_Loc2 and LightningRod_Loc1) / 15.00)
        • Else - Actions
          • Set LightningRod_Distance = (Distance between LightningRod_TargetLoc and LightningRod_Loc2)
          • Trigger - Turn off Lightning Rod Loop <gen>
          • Custom script: call SetUnitX(udg_LightningRod_Caster,GetLocationX(udg_LightningRod_TargetLoc))
          • Custom script: call SetUnitY(udg_LightningRod_Caster,GetLocationY(udg_LightningRod_TargetLoc))
          • Unit - Unhide LightningRod_Caster
          • Unit - Create 1 Dummy for (Owner of LightningRod_Caster) at LightningRod_TargetLoc facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add War Stomp (Neutral Hostile 1) to (Last created unit)
          • Unit - Set level of War Stomp (Neutral Hostile 1) for (Last created unit) to (Level of Lightning Rod for LightningRod_Caster)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Remove LightningRod_Ball from the game
          • Custom script: call RemoveLocation(udg_LightningRod_CasterLoc)
          • Custom script: call RemoveLocation(udg_LightningRod_TargetLoc)
      • Custom script: call RemoveLocation(udg_LightningRod_Loc1)
      • Custom script: call RemoveLocation(udg_LightningRod_Loc2)
 
Level 7
Joined
May 15, 2009
Messages
192
Woah! Thx for the quick reply, it now works perfectly. +rep... As soon as I can rep u again :| (Sorry!)

And btw the distance stuff was just something I saw on another trigger, and I was getting pretty frustrated/confused with this not working and just copied, was rather pointless.

And also Spinnaker, if you'd like I could mention you in my map along with Maker, you have both helped me a great deal with my triggering, and I want to give you a special place in the credits. With your permission.
 
Status
Not open for further replies.
Top