Tyman2007
Ya Rly >.
- Reaction score
- 74
Possibly simple problem.
I get an undeclared variable error for variables u and p
the errors are where the sets are in the actions where u and p is set.
I have started JASS a long time ago, (a year or 2 ago) and yet I still fail...
I've yet to fully grasp structs and how to use them
I don't know if you can call methods from inside structs inside other methods (Method 2 calls method 1)
And if you can I don't know how.
Someone told me that structs were just better to use and now I'm getting this error and I don't know what is going on.
I get an undeclared variable error for variables u and p
the errors are where the sets are in the actions where u and p is set.
JASS:
scope Fireball initializer Init
globals
private constant integer ABIL_CODE = 039;A000039; //ID of the ability
private constant integer DUMM_CODE = 039;h000039; //ID of the dummy unit (Fireball)
private constant real P_DIST = 150 //Distance from the dummy
private constant real S = 10 //Initial scale of the dummy (in percent)
private constant sound FIRE_SOUND = gg_snd_RainOfFireTarget1 //Sound of the initial cast
endglobals
private struct DATA
unit u
player p
location l1
location l2
location l3
real r1
real r2
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABIL_CODE
endfunction
private function Actions takes nothing returns nothing
local DATA d = DATA.create()
set d.u = GetSpellAbilityUnit()
set d.p = GetOwningPlayer(u)
set d.l1 = GetUnitLoc(u)
set d.l2 = GetSpellTargetLoc()
set d.l3 = PolarProjectionBJ(d.l1, P_DIST, d.r1)
set d.r1 = AngleBetweenPoints(d.l1, d.l2)
set d.r2 = DistanceBetweenPoints(d.l1, d.l2)
call PauseUnit( GetSpellAbilityUnit(), true )
call CreateUnitAtLoc( p, DUMM_CODE, d.l3, 270 )
call SetUnitScalePercent( u, S, S, S )
call PlaySoundAtPointBJ( FIRE_SOUND, 100, d.l3, 10.00 )
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trig, Condition( function Conditions ) )
call TriggerAddAction( trig, function Actions )
endfunction
endscope
I have started JASS a long time ago, (a year or 2 ago) and yet I still fail...
I've yet to fully grasp structs and how to use them
I don't know if you can call methods from inside structs inside other methods (Method 2 calls method 1)
And if you can I don't know how.
Someone told me that structs were just better to use and now I'm getting this error and I don't know what is going on.