Trigger:
Code:
function Trig_Attack_Speed_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A003' ) ) then
return false
endif
if ( not ( GetPlayerState(GetOwningPlayer(GetTriggerUnit()), PLAYER_STATE_RESOURCE_GOLD) >= ( GetUnitAbilityLevelSwapped('A003', GetTriggerUnit()) * 40 ) ) ) then
return false
endif
return true
endfunction
function Trig_Attack_Speed_Func006C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A003', GetTriggerUnit()) == 5 ) ) then
return false
endif
return true
endfunction
function Trig_Attack_Speed_Actions takes nothing returns nothing
local integer i = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
local integer j = GetUnitAbilityLevelSwapped('A003', GetTriggerUnit())
call DisplayTextToForce( GetPlayersAll(), "hey" )
call IssueUpgradeOrderByIdBJ( udg_blacksmith[i], 'Rhla' )
call SetUnitAbilityLevelSwapped( 'A003', GetTriggerUnit(), ( j + 1 ) )
if ( Trig_Attack_Speed_Func006C() ) then
call UnitRemoveAbilityBJ( 'A003', GetTriggerUnit() )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Attack_Speed takes nothing returns nothing
set gg_trg_Attack_Speed = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attack_Speed, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Attack_Speed, Condition( function Trig_Attack_Speed_Conditions ) )
call TriggerAddAction( gg_trg_Attack_Speed, function Trig_Attack_Speed_Actions )
endfunction
This works for 3 other upgrades with the ability names 'A000', 'A001' and 'A002' and the upgrade ID's 'Rhme', 'Rhar' and 'Rugf'... It might be useful for you guys to know that with this trigger (using 'A003' and 'Rhla') ive changed the value which is supposed to be upgraded from armor to attack speed. Could that be the problem? Another thing is that the blacksmith[i] that gets ordered to start upgrading has 4 different upgrades it's able to start. is that just simply too many maybe?
gl hf :P
No comments:
Post a Comment