hi
I create system of manipulations for player which leave from the game
It is necessary to make so the unit would sell all available things in his inventory
Here is my code of test triggers:
sorry for bad English
Please help me
I create system of manipulations for player which leave from the game
It is necessary to make so the unit would sell all available things in his inventory
Here is my code of test triggers:
JASS:
function AddWaitTime takes nothing returns nothing
set udg_wait = udg_wait + 0.01
endfunction
function SimpleSellWithSleep takes nothing returns nothing
local item Item
local unit u = gg_unit_Hpal_0000 //SellTarget
local unit c = gg_unit_ngme_0002 //Shop
local integer i = 1
local real x = GetUnitX(c)
local real y = GetUnitY(c)
loop
set Item = UnitItemInSlot(u,i)
if Item != null then
call IssueTargetOrder(u,"smart",Item)
call IssueTargetOrder(u,"smart",c)
call TriggerSleepAction(udg_wait)
endif
set i = i + 1
exitwhen i > 5
endloop
set u = null
set c = null
set Item = null
endfunction
function SimpleSell takes nothing returns nothing
local item Item
local unit u = gg_unit_Hpal_0000 //SellTarget
local unit c = gg_unit_ngme_0002 //Shop
local integer i = 1
local real x = GetUnitX(c)
local real y = GetUnitY(c)
loop
set Item = UnitItemInSlot(u,i)
if Item != null then
call IssueTargetOrder(u,"smart",Item)
call IssueTargetOrder(u,"smart",c)
endif
set i = i + 1
exitwhen i > 5
endloop
set u = null
set c = null
set Item = null
endfunction
function InitTrig_Test takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t,Player(0),"sell",false)
call TriggerAddAction(t, function SimpleSell)
set t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t,Player(0),"sellwait",false)
call TriggerAddAction(t, function SimpleSellWithSleep)
set t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t,Player(0),"addwait",false)
call TriggerAddAction(t, function AddWaitTime)
set t = null
call SetPlayerState(Player(0),PLAYER_STATE_RESOURCE_GOLD, 1000000)
endfunction
sorry for bad English
Please help me