HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Local Variables

06-12-2005, 04:08 PM#1
TGhost
Hello, im having a bit of a problem here. Its my first time using local variables, and im not good at it, as you can see. My problem is, that before i tryed to make the variables local, it all worked, but now it doesn't seem to work, any suggestions?.
I followed a tutorial on blizzards forums, and i named the local variables just like the global ones, but it doesn't seem to work. Oh yea, and if anyone wonders, i made the 5 diffrent effect variables, because i don't know how to do local arrays yet :\ . Thanks in advance.

Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Stormstrike
Actions
Custom script: local unit udg_SSCaster
Custom script: local location udg_SSPoint
Custom script: local effect udg_SSEffects1
Custom script: local effect udg_SSEffects2
Custom script: local effect udg_SSEffects3
Custom script: local effect udg_SSEffects4
Custom script: local effect udg_SSEffects5
Set SSCaster = (Casting unit)
Set SSPoint = (Position of (Casting unit))
Unit - Turn collision for SSCaster Off
Special Effect - Create a special effect attached to the chest of SSCaster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
Set SSEffects1 = (Last created special effect)
Special Effect - Create a special effect attached to the left hand of SSCaster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
Set SSEffects2 = (Last created special effect)
Special Effect - Create a special effect attached to the right hand of SSCaster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
Set SSEffects3 = (Last created special effect)
Special Effect - Create a special effect attached to the left foot of SSCaster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
Set SSEffects4 = (Last created special effect)
Special Effect - Create a special effect attached to the right foot of SSCaster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
Set SSEffects5 = (Last created special effect)
Unit - Pause SSCaster
Animation - Change SSCaster's animation speed to 20.00% of its original speed
Animation - Play SSCaster's slam animation, using only Rare animations
Wait 3.00 seconds
Set SSPoint = (Position of SSCaster)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (500.00, 500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (500.00, -500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (-500.00, -500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (-500.00, 500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (-500.00, 0.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (500.00, 0.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (0.00, 500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Create 1 Dummy_Caster for Player 1 (Red) at SSPoint facing Default building facing degrees
Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (SSPoint offset by (0.00, -500.00))
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Special Effect - Create a special effect at SSPoint using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
Wait 1.80 seconds
Unit - Unpause SSCaster
Special Effect - Destroy SSEffects1
Special Effect - Destroy SSEffects2
Special Effect - Destroy SSEffects3
Special Effect - Destroy SSEffects4
Special Effect - Destroy SSEffects5
Unit - Turn collision for SSCaster On
06-12-2005, 10:50 PM#2
Vexorian
You can only use the trick with one variable.

Get Into JASS if you want to use more than 1 local variable
06-13-2005, 05:43 AM#3
TGhost
ok, and thanks. Actually i was making the spell for your contest, but its not done, and without Multi Instanceability, it won't get a good grade. So maybe im gonna try to learn Jass.

EDIT: Actually, after playing alittle around, i managed to make it multi instanceable. I just changed all the SSCaster to Triggering Unit, and made only the casting point local. But i had to sacrafise the 5 pheonix fire special effects.
06-13-2005, 10:10 AM#4
Guest
Actually, you could convert your script into custom text, then copy the code for the 5 phoenix fire special effects. You will see that SSCaster would be... returnunit(SSCaster)...(I'm using WEU, so when I put in a variable in the unit field for SE, I use JASS code and put in the local variable's name) Now, because you have copied the SE code, call it in Custom Scripts. At the returnunit() part, remove that function and replace it with the local variable.
Since my explanation wasn't clear anough... here's an example.
Code:
Hands of the Shadow start
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Hands of the Shadow 
    Actions
        Custom script: local location caster=GetUnitLoc( GetSpellAbilityUnit() )
        Custom script: local location target=GetUnitLoc( GetSpellTargetUnit() )
        Custom script: call AddSpecialEffectLocBJ( caster, "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" )
        Wait 0.25 seconds
        Custom script: call AddSpecialEffectLocBJ( target, "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" )
        Custom script: call SetUnitPositionLoc( GetSpellTargetUnit(), caster )

Now if I used GUI, and I would use the local var, here's what I will get in JASS:
Code:
Hands of the Shadow start
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Hands of the Shadow 
    Actions
        Custom script: local location caster=GetUnitLoc( GetSpellAbilityUnit() )
        Custom script: local location target=GetUnitLoc( GetSpellTargetUnit() )
        Custom script: call AddSpecialEffectLocBJ( returnunit(caster), "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" )
        Wait 0.25 seconds
        Custom script: call AddSpecialEffectLocBJ( returnunit(target), "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" )
        Custom script: call SetUnitPositionLoc( GetSpellTargetUnit(), caster )

Hope that helped...
06-13-2005, 12:30 PM#5
TGhost
I know i can still make the special effects, but the problem is destroying them again, because if i use a global variable for storing the effect, if the spell is casted again, by another unit. The effects on the first unit won't be destroyed.
06-15-2005, 11:13 AM#6
Guest
Then use DestroyEffectBJ( local )