• 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] locals don't work

Status
Not open for further replies.
Level 28
Joined
Mar 25, 2008
Messages
2,955
ohai
Well it seems i've gotten too dumb to make my spells mui. In the past it worked not using locals (but arrays and stuff). But since i read this tutorial about using locals in gui, i wanted to check it out..
i got this trigger
  • SFX
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • Ability being cast is equal to test_sfx
  • Actions
    • Custom script: local unit udg_caster
    • Custom script: local effect udg_eff
    • Custom script: local location udg_temppoint
    • Set caster = (Triggering Unit)
    • Set temppoint = (Position of (caster))
    • Special Effect - Create a special effect at temppoint using flamestrikespawn.mdl (or similar)
    • Special Effect - Create a special effect attached to the origin of caster using orboffire.mdl (or similar)
    • Custom script: call RemoveLoaction(udg_temppoint)
    • Wait 10.00 seconds
    • Special Effect - Destroy (last created special effect)
this is exactly as in the tutorials. But the effect is simply none. So what am i doing wrong? Shall i go back to arrays? D:
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Captain Griffen is right about the local global variable only working once per trigger.
And once is sufficient for this trigger.
You do not need the variable "caster" - just use triggering unit.
You do not need for the temp_point to be local, just using the global variable will do.
So only have "eff" as a local variable.
And note that in the trigger you provided you did not use eff.
So you need something like this:
  • SFX
  • Events
  • Unit - A unit starts the effect of an ability
  • Conditions
  • Ability being cast is equal to test_sfx
  • Actions
  • Custom script: local effect udg_eff
  • Set temppoint = (Position of (Triggering unit))
  • Special Effect - Create a special effect at temppoint using flamestrikespawn.mdl (or similar)
  • Special Effect - Create a special effect attached to the origin of (Triggering Unit) using orboffire.mdl (or similar)
  • Set eff = (Last Created Special effect)
  • Custom script: call RemoveLoaction(udg_temppoint)
  • Wait 10.00 seconds
  • Special Effect - Destroy (eff)
  • Custom script: set udg_eff=null
The lines:
  • Special Effect - Create a special effect attached to the origin of (Triggering Unit) using orboffire.mdl (or similar)
  • Set eff = (Last Created Special effect)
can be substituted with:
  • Set eff = Create a special effect attached to the origin of (Triggering Unit) using orboffire.mdl (or similar)
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Only one local global variable will work per function. Of course, you don't know what a function is, and you don't really know what your code is doing, since you can't do JASS, hence you probably don't know what a function is...

Declaring a local variable is like creating a new variable everytime the trigger runs so the actions can be accessed respectively no matter how many times the trigger is running simultaneously, as far as i know. Therefore you null variables.
A function is a code used in a program performing a specific task - in warcraft the program is warcraft and the code is (more or less effective ) JASS, which i, obviously don't know and i'm really sorry for wasting your time with my problems...

So if only one local variable per trigger can be assigned, here are more than one local variables set - so is the tutorials' author wrong?
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I did not say local variable, I said local global variable.
And I will go with what PurplePoot said - only one local global variable per trigger.
So if he is correct, which I am quite certain of, then yes - the tutorial's author made a mistake.
But what I posted works.
Edit: Your trigger and the triggers of other(read that tutorial thread) do not work because of that.
 
Status
Not open for further replies.
Top