• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Items changing abilities.

Status
Not open for further replies.
Level 1
Joined
Feb 23, 2013
Messages
4
ok so i have a trigger that i had working at first, however i changed it because i thought i could do it with less conditions and actions... well i didnt test it afterwords i forgot what i did the first time and i ended up saving. i know that was dumb of me. anyway i converted this to custom text to show you what i did.. i only know gui. if someone could please tell me why the hero's spell isnt getting set back to normal when he drops/sells the armor then i would be very thankful.

function Trig_Armor_Sets_Func008C takes nothing returns boolean
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00S' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00R' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00X' ) ) then
return true
endif
return false
endfunctionfunction Trig_Armor_Sets_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == udg_Hero ) ) then
return false
endif
if ( not Trig_Armor_Sets_Func008C() ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func002Func001Func001C takes nothing returns boolean
if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(udg_Hero) == 'Hamg' ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func004Func001Func001C takes nothing returns boolean
if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func004C takes nothing returns boolean
if ( not ( GetUnitTypeId(udg_Hero) == 'Hpal' ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func006Func001Func001C takes nothing returns boolean
if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Func006C takes nothing returns boolean
if ( not ( GetUnitTypeId(udg_Hero) == 'Hmkg' ) ) then
return false
endif
return true
endfunction

function Trig_Armor_Sets_Actions takes nothing returns nothing
// Fearless Mystical
if ( Trig_Armor_Sets_Func002C() ) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_Armor_Sets_Func002Func001Func001C() ) then
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'A00U'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
return
else
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'AEsf'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
else
endif
// Ruthless Marksman
if ( Trig_Armor_Sets_Func004C() ) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_Armor_Sets_Func004Func001Func001C() ) then
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'A00T'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
return
else
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'AOww'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
else
endif
// Vicious Barbarian
if ( Trig_Armor_Sets_Func006C() ) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_Armor_Sets_Func006Func001Func001C() ) then
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'A01D'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
return
else
set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
set udg_Ability[1] = 'AEpa'
call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
else
endif
endfunction

//===========================================================================
function InitTrig_Armor_Sets takes nothing returns nothing
set gg_trg_Armor_Sets = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_PAWN_ITEM )
call TriggerAddCondition( gg_trg_Armor_Sets, Condition( function Trig_Armor_Sets_Conditions ) )
call TriggerAddAction( gg_trg_Armor_Sets, function Trig_Armor_Sets_Actions )
endfunction
 
Level 1
Joined
Feb 23, 2013
Messages
4
how do you do that?
  • ok so i have a trigger that i had working at first, however i changed it because i thought i could do it with less conditions and actions... well i didnt test it afterwords i forgot what i did the first time and i ended up saving. i know that was dumb of me. anyway i converted this to custom text to show you what i did.. i only know gui. if someone could please tell me why the hero's spell isnt getting set back to normal when he drops/sells the armor then i would be very thankful.
  • function Trig_Armor_Sets_Func008C takes nothing returns boolean
  • if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00S' ) ) then
  • return true
  • endif
  • if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00R' ) ) then
  • return true
  • endif
  • if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00X' ) ) then
  • return true
  • endif
  • return false
  • endfunction
  • function Trig_Armor_Sets_Conditions takes nothing returns boolean
  • if ( not ( GetTriggerUnit() == udg_Hero ) ) then
  • return false
  • endif
  • if ( not Trig_Armor_Sets_Func008C() ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func002Func001Func001C takes nothing returns boolean
  • if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func002C takes nothing returns boolean
  • if ( not ( GetUnitTypeId(udg_Hero) == 'Hamg' ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func004Func001Func001C takes nothing returns boolean
  • if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func004C takes nothing returns boolean
  • if ( not ( GetUnitTypeId(udg_Hero) == 'Hpal' ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func006Func001Func001C takes nothing returns boolean
  • if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(udg_Hero, GetForLoopIndexA())) ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Func006C takes nothing returns boolean
  • if ( not ( GetUnitTypeId(udg_Hero) == 'Hmkg' ) ) then
  • return false
  • endif
  • return true
  • endfunction
  • function Trig_Armor_Sets_Actions takes nothing returns nothing
  • // Fearless Mystical
  • if ( Trig_Armor_Sets_Func002C() ) then
  • set bj_forLoopAIndex = 1
  • set bj_forLoopAIndexEnd = 6
  • loop
  • exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
  • if ( Trig_Armor_Sets_Func002Func001Func001C() ) then
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'A00U'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • return
  • else
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'AEsf'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • endif
  • set bj_forLoopAIndex = bj_forLoopAIndex + 1
  • endloop
  • else
  • endif
  • // Ruthless Marksman
  • if ( Trig_Armor_Sets_Func004C() ) then
  • set bj_forLoopAIndex = 1
  • set bj_forLoopAIndexEnd = 6
  • loop
  • exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
  • if ( Trig_Armor_Sets_Func004Func001Func001C() ) then
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'A00T'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • return
  • else
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'AOww'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • endif
  • set bj_forLoopAIndex = bj_forLoopAIndex + 1
  • endloop
  • else
  • endif
  • // Vicious Barbarian
  • if ( Trig_Armor_Sets_Func006C() ) then
  • set bj_forLoopAIndex = 1
  • set bj_forLoopAIndexEnd = 6
  • loop
  • exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
  • if ( Trig_Armor_Sets_Func006Func001Func001C() ) then
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'A01D'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • return
  • else
  • set udg_Ability_StandardLevel[1] = GetUnitAbilityLevelSwapped(udg_Ability[1], udg_Hero)
  • call UnitRemoveAbilityBJ( udg_Ability[1], udg_Hero )
  • set udg_Ability[1] = 'AEpa'
  • call UnitAddAbilityBJ( udg_Ability[1], udg_Hero )
  • call SetUnitAbilityLevelSwapped( udg_Ability[1], udg_Hero, udg_Ability_StandardLevel[1] )
  • endif
  • set bj_forLoopAIndex = bj_forLoopAIndex + 1
  • endloop
  • else
  • endif
  • endfunction
  • //===========================================================================
  • function InitTrig_Armor_Sets takes nothing returns nothing
  • set gg_trg_Armor_Sets = CreateTrigger( )
  • call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_PICKUP_ITEM )
  • call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_DROP_ITEM )
  • call TriggerRegisterAnyUnitEventBJ( gg_trg_Armor_Sets, EVENT_PLAYER_UNIT_PAWN_ITEM )
  • call TriggerAddCondition( gg_trg_Armor_Sets, Condition( function Trig_Armor_Sets_Conditions ) )
  • call TriggerAddAction( gg_trg_Armor_Sets, function Trig_Armor_Sets_Actions )
  • endfunction
 
Level 1
Joined
Feb 23, 2013
Messages
4
ok so i figured that out... anyway could someone tell me what i am doing wrong? the hero has a default ability and i am trying to get it to to change it depending on the armor/item it has. however when i drop the item it will not replace the ability back to its default one.
 
Status
Not open for further replies.
Top