- Joined
- Aug 21, 2008
- Messages
- 533
I wrote this scope, and suddenly nothing is working anymore =/
when i delete it everything is working fine again, but i need it
edit: before i made it into a scope, i tested it as normal jass functions and this way it was working fine....
when i delete it everything is working fine again, but i need it
JASS:
scope Dialog initializer INIT2
globals
private dialog Dialog
private button array DialogButton
endglobals
private function Dialogfu takes nothing returns nothing
local unit u =GetTriggerUnit()
local player p=GetOwningPlayer(u)
local integer id=GetPlayerId(p)
local integer count=0
if GetUnitLevel(u) == 2 then
if GetUnitTypeId(u) == 'H000' then
call DialogClear(Dialog)
call DialogSetMessage( Dialog, "Choose your first Mastery" )
set DialogButton[id*10] = DialogAddButton( Dialog, "Defender" ,0)
//set udg_DialogButton[ id*10+1] = DialogAddButton( udg_Dialog[id], "test-do not click" ,0)
call DialogDisplay((p), Dialog,true )
loop
call SaveInteger(udg_HashTable,id,StringHash("item"+I2S(count)),GetItemTypeId(UnitItemInSlot(u,count)))
exitwhen count==5
set count=count+1
endloop
call RemoveUnit(u)
endif
endif
set u=null
set p= null
endfunction
private function Click takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u
local integer count=0
local integer id=GetPlayerId(p)
local item i
if GetClickedButton() == DialogButton[id*10] then
set u =CreateUnitAtLoc(p,'H008', GetUnitLoc(gg_unit_nfoh_0027), bj_UNIT_FACING )
call SetHeroLevel( u, 2, false )
set CamU[GetPlayerId(p)]=u
call AdjustPlayerStateBJ( -5, p, PLAYER_STATE_RESOURCE_LUMBER )
call AdjustPlayerStateBJ( -1, p, PLAYER_STATE_RESOURCE_GOLD )
endif
loop
set i =CreateItem(LoadInteger(udg_HashTable,id,StringHash("item"+I2S(count))),0,0)
call UnitAddItem(u,i)
exitwhen count==5
set count=count+1
endloop
set u=null
set p = null
endfunction
//===========================================================================
private function INIT2 takes nothing returns nothing
local trigger click = CreateTrigger( )
local trigger dia = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( dia, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddAction( dia, function Dialogfu )
call TriggerRegisterDialogEvent(click, Dialog )
call TriggerAddAction( click, function Click )
endfunction
endscope
edit: before i made it into a scope, i tested it as normal jass functions and this way it was working fine....