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

[Trigger] Jass / Gui Bug

Status
Not open for further replies.
Level 17
Joined
Jun 28, 2008
Messages
776
I heard of the bug where you declare a local variable in gui with the same name as the global variable and then you can use the local in the gui trigger instead of the global.

Now what I want to know is how to declare it

is it

  • Custom script: local location udg_Pos_Local_1 = null
or

  • Custom script: local location Pos_Local_1 = null
if the Global variable is Pos_Local_1

Here is my spell that I am making and it uses the above mentioned

  • Cast Sand Storm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sand Storm
    • Actions
      • Custom script: local location udg_Pos_Local_1 = null
      • Custom script: local location udg_Pos_Local_2 = null
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer x = 0
      • -------- ---------------- --------
      • Set Pos_Local_1 = (Position of (Triggering unit))
      • -------- ---------------- --------
      • Custom script: loop
      • -------- ---------------- --------
      • Custom script: exitwhen GetUnitCurrentOrder(u) != String2OrderIdBJ("chemicalrage")
      • Custom script: exitwhen x == 50
      • Set Pos_Local_2 = (Pos_Local_1 offset by (Random real number between 0.00 and 400.00) towards (Random angle) degrees)
      • Special Effect - Create a special effect at Pos_Local_2 using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • Wait 0.01 seconds
      • Custom script: set x = x + 1
      • Custom script: call RemoveLocation(udg_Pos_Local_2)
      • -------- ---------------- --------
      • Custom script: endloop
      • -------- ---------------- --------
      • Custom script: call RemoveLocation(udg_Pos_Local_1)
I know it would be better if I do it in Jass, but it has to be GUI.

The problem with the spell is that Pos_Local_1 is always the center of the map.

Thanks for your help.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
However, its udg_Pos_Local_1, but afaik, you can use it only once per trigger (it, referring to the local exploit).

Correct, although you can still have multiple "normal" locals in a trigger. So basically you can declare 4 "normal" local variables, and then after each wait action you set global variables equal to the normal local variables. For example:

  • Custom script: local unit u
  • Set Unit = (Target unit of issued order)
  • Custom script: set u = udg_Unit
  • // Do stuff with Unit
  • Wait 2.0 seconds
  • Custom script: set udg_Unit = u
  • // Do stuff with Unit
  • Wait 2.0 seconds
  • Custom script: set udg_Unit = u
  • Custom script: set u = null
Either way, with the amount of custom scripts you're already using in this trigger, people will go eeeq anyway, so I think it's better if you just jass the whole thing.
 
Status
Not open for further replies.
Top