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

Need help with lightnings (using custom scripts)

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

Well, I'm making some tests with lightning management through custom scripts, as I'm planning to make my first serious spell, which graphic effect is almost entirely composed of lightning effects.
However, I don't know why the hell one of my triggers does not work, it gets disabled, says that there's a compile error, or something like that. Obviously, the issue is in the custom script, but as I'm still a noob with this kind of things, I can't found the problem.
:goblin_cry:

The trigger that gets disabled is the "Loop" trigger. The used variables are as follow:
- L: Lightning variable.
- Loc01: Point variable.
- LZ: Real variable.

Here are the triggers:


This trigger creates the lightning at ground level.
  • Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divinity Cage
    • Actions
      • Set Loc01 = (Center of (Target))
      • Custom script: set udg_L = AddLightningEx("HWPB", true, GetLocationX(udg_Loc01), GetLocationY(udg_Loc01), 0, GetLocationX(udg_Loc01), GetLocationY(udg_Loc01), 0)

This trigger should elevate the lightning to a Z height of 500.00.
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: call MoveLightningEx(udg_L, true, GetLocationX(Loc01), GetLocationY(Loc01), 0, GetLocationX(Loc01), GetLocationY(Loc01), udg_LZ)
      • Set LZ = (LZ + 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LZ Higher than or equal to 500.00
        • Then - Actions
          • Set LZ = 500.00
        • Other - Actions
          • Set LZ = (LZ + 1.00)


As I said, these are just tests, so don't bother with leaks, or things like that, I'll make sure to remove them all when I make the true spell. Also, the loop trigger should get disabled when the lightning gets to 500.00 height, I know that too, but this is a test, so it doesn't matter. For now, I just need to know what's wrong with that trigger.
Maybe it's some stupid error, I don't know... Someone can help?

Thanks in advance.

Regards
 
Level 9
Joined
Apr 19, 2011
Messages
447
You didn't add the udg_ prefix to Loc01 variable.

CRAP...
:goblin_jawdrop:

I KNEW IT WAS SOME KIND OF STUPID ERROR...! I noticed that I wans't adding the udg_ prefixes, but somehow I added them only in the first trigger, I forgot to add them in the second...
Really, I feel embarrassed right now...

Well, thank you for pointing how messed up I am. XD

And for the LZ increasing twice, I just was playing around with the variables, and forgot to remove that, but it's not important for now.

Regards
 
Level 9
Joined
Apr 19, 2011
Messages
447
Sorry for the double post, but it's just that I found a new problem related to the same thing.
I began making the spell itself. Basicly, for the first stance of the spell, eight pillars of light should appear around the caster in an octogonal shape.
The trigger does not show any compile error, so I don't think the problem is because of bad syntax.

The used variables are as follow:
- COUNTER: Integer variable.
- TempLoc01: Point variable.
- TempLoc02: Point variable.
- TempReal: Real variable.
- TempLight: Lightning variable.
- Divinity_Cage: Hastable variable.
- Divinity_Cage_Casters: Unit group variable.

Here are the triggers:

Nothing special, just creating the hashtable.
  • Initialize
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Divinity_Cage = (Last created hashtable)

The following trigger is the one that's not working properly. Basicly, the eight pillars do not show at all. Where's the problem?
This trigger should create the eight lightning pillars around the caster.
  • Start Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divinity Cage
    • Actions
      • Unit group - Add (Triggering unit) to Divinity_Cage_Casters
      • For each (Integer COUNTER) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set TempLoc01 = (Position of (Triggering unit))
          • Set TempLoc02 = (TempLoc01 offset by 500.00 towards (45.00 x (Real(COUNTER))) degrees)
          • Hashtable - Save Handle Of TempLoc02 as COUNTER of (Key (Triggering unit)) in Divinity_Cage
          • Custom script: set udg_TempLight = AddLightningEx("HWPB", true, GetLocationX(udg_TempLoc02), GetLocationY(udg_TempLoc02), 0, GetLocationX(udg_TempLoc02), GetLocationY(udg_TempLoc02), 0)
          • Hashtable - Save Handle Of(Last created lightning effect) as (8 + COUNTER) of (Key (Triggering unit)) in Divinity_Cage

This trigger should elevate the eight pillars to a 600.00 height.
  • Loop Lightning 01
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit group - Pick every unit in Divinity_Cage_Casters and do (Actions)
        • Loop - Actions
          • For each (Integer COUNTER) from 1 to 8, do (Actions)
            • Loop - Actions
              • Set TempLight = (Load (8 + COUNTER) of (Key (Picked unit)) in Divinity_Cage)
              • Set TempLoc01 = (Load COUNTER of (Key (Picked unit)) in Divinity_Cage)
              • Set TempReal = (Load 0 of (Key (Picked unit)) from Divinity_Cage)
              • Custom script: call MoveLightningEx(udg_TempLight, true, GetLocationX(udg_TempLoc02), GetLocationY(udg_TempLoc02), 0, GetLocationX(udg_TempLoc02), GetLocationY(udg_TempLoc02), udg_TempReal)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 0 of (Key (Picked unit)) from Divinity_Cage) Higher than or equal to 600.00
            • Then - Actions
              • Hashtable - Save 600.00 as 0 of (Key (Picked unit)) in Divinity_Cage
            • Other - Actions
              • Hashtable - Save ((Load 0 of (Key (Picked unit)) from Divinity_Cage) + 15.00) as 0 of (Key (Picked unit)) in Divinity_Cage
I hope this time isn't something stupid like missing udg_ prefixes, or things like that...
Thanks in advance.
 
Last edited:
Status
Not open for further replies.
Top