Laiev
Hey Listen!!
- Reaction score
- 188
I just start using struct right now and, hm... Don't know why something happen, probably someone can help me...
The first comment (1) i REALLY don't know for what is, i just see it in some others spells
the second comment (2) is the syntax error, i just want use the d.u to check something in the loop, but don't know how to 'restore' the struct set'ed
the thirst comment (3) Well, i don't know if all is ok in this part... some problem say and if possible explain
any help about it is appreciate, but please, don't post link of struct tutorials.
EDIT: well, nevermind... i found the problem...
[ljass] local data d = GetData(GetExpiredTimer()) // <~ 1[/ljass] must be [ljass] local bat d = GetData(GetExpiredTimer()) // <~ 1[/ljass]
The first comment (1) i REALLY don't know for what is, i just see it in some others spells
the second comment (2) is the syntax error, i just want use the d.u to check something in the loop, but don't know how to 'restore' the struct set'ed
the thirst comment (3) Well, i don't know if all is ok in this part... some problem say and if possible explain
JASS:
scope Bats initializer Init
globals
private constant integer AbilId = 039;A034039;
private constant integer BAT = 039;u00A039;
private unit U = null
endglobals
private struct bat
unit u
timer t
endstruct
private function Acts takes nothing returns nothing
local data d = GetData(GetExpiredTimer()) // <~ 1
local integer i = 0
local integer randint = GetRandomInt (50, 300)
set U = d.u // <~ 2
loop
exitwhen i == GetUnitAbilityLevel (U, AbilId) * 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ some function here.
set i = i + 1
endloop
endfunction
private function Actions takes nothing returns nothing
local bat d = bat.create() // <~~~~~~~>
set d.u = GetTriggerUnit() // <~~~~~~~>
set d.t = NewTimer() // <~~~3~~~>
call TimerStart(d.t,2.,true,function Acts) // <~~~~~~~>
call SetData(d.t,d) // <~~~~~~~>
endfunction
private function Condi takes nothing returns boolean
if GetLearnedSkill() == AbilId and GetUnitAbilityLevel(GetTriggerUnit(),AbilId)==1 then
call Actions()
endif
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition(t, Condition(function Condi))
endfunction
endscope
any help about it is appreciate, but please, don't post link of struct tutorials.
EDIT: well, nevermind... i found the problem...
[ljass] local data d = GetData(GetExpiredTimer()) // <~ 1[/ljass] must be [ljass] local bat d = GetData(GetExpiredTimer()) // <~ 1[/ljass]