|
获得xx物品时,增加一定量的魔法值然后删除物品.
当魔法值为0时无法移动.
但是却发现都无法执行,求问题所在.
//获得物品增加"燃料"
function FuelFeedConditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetTriggerUnit())
return i=='H00J' or i=='h00E'
endfunction
function FuelFeed takes nothing returns nothing
local item i = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer id = GetItemTypeId(i)
if id=='pres' then
call PauseUnit(u,false)
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+(50*I2R(GetItemCharges(i))))
call AddFadingTextTag("+"+I2S(50*GetItemCharges(i)),GetUnitX(u),GetUnitY(u),255,220,0,200)
call RemoveItem(i)
else
call DoNothing()
endif
set i = null
set u = null
endfunction
//===========================================================================
function InitTrig_FuelFeed takes nothing returns nothing
set gg_trg_FuelFeed = CreateTrigger()
call TriggerAddCondition( gg_trg_FuelFeed, Condition( function FuelFeedConditions ) )
call TriggerAddAction( gg_trg_FuelFeed, function FuelFeed )
endfunction
//"燃料"为0时无法移动.
function FuelSystemConditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetTriggerUnit())
return i=='H00J' or i=='h00E'
endfunction
function FuelSystem takes nothing returns nothing
local unit u = GetTriggerUnit()
local real fuel = GetUnitState(u,UNIT_STATE_MANA)
if fuel<0.5 then
call IssueImmediateOrder(u,"stop")
endif
set u = null
endfunction
//===========================================================================
function InitTrig_FuelSystem takes nothing returns nothing
set gg_trg_FuelSystem = CreateTrigger()
call TriggerAddCondition( gg_trg_FuelSystem, Condition( function FuelSystemConditions ) )
call TriggerAddAction( gg_trg_FuelSystem, function FuelSystem )
endfunction |
|