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

Lightning effects don't show?

Status
Not open for further replies.
It might depend on the triggers, mind posting them?

Otherwise, it might have to do with visibility. Blizzard added a field, boolean checkVisibility, to lightning (it defaults to true in GUI). When it is set to "true", it requires the start point and the end point of the lightning to both be visible in order for the lightning to appear on your screen. For example, if you have black mask/fog of war covering either the start point or the end point of the lightning, it won't show up.

Note that "visibility" depends on the player. Some players might have that part visible (e.g. a unit is nearby) whereas other players won't. In that case, the players who can see it will see it, but the other players won't.

GUI doesn't give you access to this field, but JASS does. Let's say you want to create chain lightning from "Point1" to "Point2", and you want it to be visible to players no matter what. It would look like this:
  • Set Point1 = (Position of (Triggering unit))
  • Set Point2 = (Position of (Target unit of ability being cast))
  • Custom script: set bj_lastCreatedLightning = AddLightningEx("CLPB", false, GetLocationX(udg_Point1), GetLocationY(udg_Point1), GetLocationZ(udg_Point1), GetLocationX(udg_Point2), GetLocationY(udg_Point2), GetLocationZ(udg_Point2))
Of course, you'd clear the leaks later on. In case you need an explanation of what each thing does:
  • set bj_lastCreatedLightning = -> This assigns the lightning to the GUI variable "Last created lightning". So if you want to destroy this or assign it to your own variable, you can simply use "Last created lightning". Just make sure you put those actions after the custom script action.
  • AddLightningEx -> In JASS, you have a list of functions that you can call. These functions do stuff. This one is self-explanatory. It adds lightning. The "Ex" part means it has extra arguments. The normal version doesn't have z-coordinates.
  • "CLPB" -> This is the string for "chain lightning". Don't worry about what it means. These are hard-coded. You can find a list of them here: Link (Scroll to the bottom)
  • The rest is just grabbing the (x, y, z) coordinates from Point1 and Point2.

Good luck!
 
This was my trigger.
I followed the Lightning Effects tutorial to make it:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set A4_ZapSource1 = (Center of Region 000 <gen>)
      • Custom script: set udg_A4_ZapSource1_X = GetLocationX(udg_A4_ZapSource1)
      • Custom script: set udg_A4_ZapSource1_Y = GetLocationY(udg_A4_ZapSource1)
      • Custom script: set udg_A4_ZapSource1_Z = GetLocationZ(udg_A4_ZapSource1)
      • Set A4_ZapTarget1 = (Center of Region 001 <gen>)
      • Custom script: set udg_A4_ZapTarget1_X = GetLocationX(udg_A4_ZapTarget1)
      • Custom script: set udg_A4_ZapTarget1_Y = GetLocationY(udg_A4_ZapTarget1)
      • Custom script: set udg_A4_ZapTarget1_Z = GetLocationZ(udg_A4_ZapTarget1)
      • Custom script: set udg_A4_Zap1 = AddLightningEx ("FORK", true, udg_A4_ZapSource1_X, udg_A4_ZapSource1_Y, udg_A4_ZapSource1_Z + 60, udg_A4_ZapTarget1_X, udg_A4_ZapTarget1_Y, udg_A4_ZapTarget1_Z + 60)
 
The trigger looks fine to me. Did you confirm that it wasn't any of the issues PnF brought up? Specifically this one:

it requires the start point and the end point of the lightning to both be visible in order for the lightning to appear on your screen. For example, if you have black mask/fog of war covering either the start point or the end point of the lightning, it won't show up.
 
Oh crap, you're actually right. So how should I approach this issue if I want to make the visuals of an "electric" sort of trap that zaps the player when he goes into it? Only create the lightning when the player goes into an area that would have vision of them?

EDIT: I figured out by setting the visibility check to false. However this will also show the lightning through fog.
 
Last edited:
Status
Not open for further replies.
Top