Hi, i am trying to create along with this system :
http://www.hiveworkshop.com/forums/...tem-133050/?prev=search=inventory&d=list&r=20 made by The Wicther.
A custom stat item gain. Soo for each type of item when is picked up i add custom stats the the hero.
My question is: Is better to create many many triggers or just one with many conditions? Also maybe transform it into jass ?
Thanks for your time ^^
http://www.hiveworkshop.com/forums/...tem-133050/?prev=search=inventory&d=list&r=20 made by The Wicther.
A custom stat item gain. Soo for each type of item when is picked up i add custom stats the the hero.
My question is: Is better to create many many triggers or just one with many conditions? Also maybe transform it into jass ?
JASS:
unction Trig_item_stats_Conditions takes nothing returns boolean
if ( not ( GetItemTypeId(GetOrderTargetItem()) == 'kysn' ) ) then
return false
endif
return true
endfunction
function Trig_item_stats_Actions takes nothing returns nothing
// Then here I add the custom stats
call ModifyHeroStat( bj_HEROSTAT_STR, udg_u, bj_MODIFYMETHOD_ADD, 5 )
call ModifyHeroStat( bj_HEROSTAT_AGI, udg_u, bj_MODIFYMETHOD_ADD, 4 )
endfunction
//===========================================================================
function InitTrig_item_stats takes nothing returns nothing
set gg_trg_item_stats = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_item_stats, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_item_stats, Condition( function Trig_item_stats_Conditions ) )
call TriggerAddAction( gg_trg_item_stats, function Trig_item_stats_Actions )
endfunction
JASS:
function Trig_item_stats_Func002C takes nothing returns boolean
if ( not ( GetItemTypeId(GetOrderTargetItem()) == 'kysn' ) ) then
return false
endif
return true
endfunction
function Trig_item_stats_Func003C takes nothing returns boolean
if ( not ( GetItemTypeId(GetOrderTargetItem()) == 'ratf' ) ) then
return false
endif
return true
endfunction
function Trig_item_stats_Actions takes nothing returns nothing
// With conditions
if ( Trig_item_stats_Func002C() ) then
call ModifyHeroStat( bj_HEROSTAT_AGI, udg_u, bj_MODIFYMETHOD_ADD, 4 )
call ModifyHeroStat( bj_HEROSTAT_STR, udg_u, bj_MODIFYMETHOD_ADD, 5 )
else
endif
if ( Trig_item_stats_Func003C() ) then
call ModifyHeroStat( bj_HEROSTAT_AGI, udg_u, bj_MODIFYMETHOD_ADD, 700 )
else
endif
endfunction
//===========================================================================
function InitTrig_item_stats takes nothing returns nothing
set gg_trg_item_stats = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_item_stats, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddAction( gg_trg_item_stats, function Trig_item_stats_Actions )
endfunction
Thanks for your time ^^