• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Lightning Effect Problem

Status
Not open for further replies.
Level 3
Joined
Apr 8, 2016
Messages
58
hey guys, how to remove lightning effect on my skill?
i tried to add this trigger
  • Lightning - Destroy A_PKk_Lightning
but, when i add this, the lightning effect doesn't appear
.. but when i didn't add that, the lightning effect is appear, but it will be permanently


  • Panah Kekuatan
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Panah Kekuatan
    • Actions
      • Set A_PKk_Caster = (Casting unit)
      • Set A_PKk_CP = (Position of A_PKk_Caster)
      • Set A_PKk_Target = (Target unit of ability being cast)
      • Set A_PKk_TP = (Position of A_PKk_Target)
      • Set A_PKk_Ability_Level = (Level of (Ability being cast) for A_PKk_Caster)
      • Set A_PKk_Damage = ((Real((Agility of A_PKk_Caster (Include bonuses)))) x ((Real(A_PKk_Ability_Level)) + 5.00))
      • Custom script: set udg_A_PKk_Lightning = AddLightningEx("FORK", true , GetLocationX(udg_A_PKk_CP), GetLocationY(udg_A_PKk_CP), GetLocationZ(udg_A_PKk_CP) + 70, GetLocationX(udg_A_PKk_TP), GetLocationY(udg_A_PKk_TP), GetLocationZ(udg_A_PKk_TP) + 70)
      • Unit - Cause A_PKk_Caster to damage A_PKk_Target, dealing A_PKk_Damage damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_A_PKk_CP)
      • Custom script: call RemoveLocation(udg_A_PKk_TP)
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
a) using a local variable. You can make your udg_variable local for a single thread as far as I know. You simply have to add a custom script at the start of the trigger: local udg_A_PKk_Lightning. Then use wait.
if this does not work, use a "true" local variable for the lightning at the start of the trigger in a custom script: local lightning l and then use that "l" instead of your global.

b) if there is only one lightning per player, you may store the lightning in an array, take the player number as array position.

c) use a timer, to pass data to it. this is advanced, so I assume you will try other methods before.

d) search for a system on the hive, that manages lightning effects for you.

3) ...?
 
Level 3
Joined
Apr 8, 2016
Messages
58
here sir

  • Panah Kekuatan
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Panah Kekuatan
    • Actions
      • Set A_PKk_Caster = (Casting unit)
      • Set A_PKk_CP = (Position of A_PKk_Caster)
      • Set A_PKk_Target = (Target unit of ability being cast)
      • Set A_PKk_TP = (Position of A_PKk_Target)
      • Set A_PKk_Ability_Level = (Level of (Ability being cast) for A_PKk_Caster)
      • Set A_PKk_Damage = ((Real((Agility of A_PKk_Caster (Include bonuses)))) x ((Real(A_PKk_Ability_Level)) + 5.00))
      • Custom script: set udg_A_PKk_Lightning = AddLightningEx("FORK", true , GetLocationX(udg_A_PKk_CP), GetLocationY(udg_A_PKk_CP), GetLocationZ(udg_A_PKk_CP) + 70, GetLocationX(udg_A_PKk_TP), GetLocationY(udg_A_PKk_TP), GetLocationZ(udg_A_PKk_TP) + 70)
      • Lightning - Destroy A_PKk_Lightning
      • Unit - Cause A_PKk_Caster to damage A_PKk_Target, dealing A_PKk_Damage damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_A_PKk_CP)
      • Custom script: call RemoveLocation(udg_A_PKk_TP)
 
Oh, right, so it's not appearing because it's being immediately destroyed, so you're going to have to use a wait or timer. A wait would be a quick solution, but waits are known to be unreliable because they never return the exact time you set it to. Imo it would just be easier to use one of the various lightning systems on the Hive, but if you don't want to get into that, do what Emm-A- suggested and use a local variable to store your lightning effect, apply a wait after removing your locations, then destroy the lightning effect.
 
Level 3
Joined
Apr 8, 2016
Messages
58
lightningspell-png.116277


my spell is just like that, but mine is single target spell
 
Well since it's single-target, better use a lightning system then, otherwise the lightning effect won't track your target, even if it's supposed to exist for a brief moment. Personally, I'd use [System] Timed Lightnings v1.0.1.1 but that's a vJASS system, so you'll need JNGP for that to work. If you have that already, then fantastic. Otherwise Simple Lightning Handling System v1.21 [GUI] would be my second choice.

For the vJASS version, you don't actually need to code in JASS at all. If you look at the demo map, the example of unit-to-unit lightning is in GUI:
  • U2U
    • Events
    • Conditions
    • Actions
      • Set u1 = Blood Mage 0001 <gen>
      • Set u2 = Blood Mage 0002 <gen>
      • Set r5 = (Random real number between 0.00 and 100.00)
      • Set r6 = (Random real number between 0.00 and 100.00)
      • Custom script: set bj_lastCreatedLightning = AddLightningEx("AFOD", true, GetUnitX(udg_u1), GetUnitY(udg_u1), udg_r5, GetUnitX(udg_u2), GetUnitY(udg_u2), udg_r6)
      • Custom script: call TimedL.U2U(bj_lastCreatedLightning, udg_u1, udg_u2, GetRandomReal(udg_DurMin,udg_DurMax), udg_r5, udg_r6, 1, 0)
u1 is your caster, u2 is your target. r5 is the lightning's height on the caster and r6 is the lightning's height on the target. As per the system's instructions, the unit-to-unit method takes the following arguments:
//static method U2U takes lightning l, unit s, unit t, real time, real z1, real z2, real startAlpha, real endAlpha returns nothing so you should be able to replace those quite easily.

For the GUI version, it's really straightforward. Just follow the example given in the system itself:
  • UNIT TO UNIT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Unit2Unit
    • Actions
      • -------- ---------- --------
      • -------- Requirement for Unit2Unit function --------
      • -------- ---------- --------
      • -------- LH_DurationSet = The duration of the Lightning --------
      • -------- LH_LightningNameSet = The name of the Lighting --------
      • -------- LH_UnitSourceSet = The source of the Lightning starts from this unit --------
      • -------- LH_UnitTargetSet = The target of the Lightning from source to this unit --------
      • -------- ---------- --------
      • Set LH_DurationSet = 1.00
      • Set LH_LightningNameSet = AFOD
      • Set LH_UnitSourceSet = (Triggering unit)
      • Set LH_UnitTargetSet = (Target unit of ability being cast)
      • Trigger - Run LH Unit2Unit <gen> (ignoring conditions)
 
Status
Not open for further replies.
Top