local TD = import('/Mods/Mytestmod/Modules/TransferDatas.lua')
ArmorPointsIcon.HandleEvent = function(self, event)
if event.Type == 'ButtonPress' then
local unit = GetSelectedUnits()
if unit then
local _id = unit[1]:GetEntityId()
local Skpoints = TD.GetProperty(_id,"SkillPoints")-1
if Skpoints >= 0 then
SimCallback( { Func="OnApplyPoints",
Args={ id = _id}
}
)
end
end
end
end
Callbacks.OnApplyPoints = import('/Mods/Mytestmod/Modules/TransferDatas.lua').OnApplyPoints
function OnApplyPoints(Unit)
-- LOG(repr(Unit))
local id = Unit.id
IncProperty(id,"Armor",1)
IncProperty(id,"SkillPoints",-1)
end
Statistics: Posted by Franck — 16 Jan 2016, 23:48
Statistics: Posted by Franck — 15 Jan 2016, 21:40