- Joined
- Aug 18, 2013
- Messages
- 71
Hi Guys, I'm currently working on a metamorphosis ability in jass. The issue I'm having is with ability ID's and getting their current level.
The alternate hero my caster transforms into is a completley different hero (Different Main Stat/ abilities)
Here's my current code
Specifically what isn't working is this bit of code
Any ideas?
The alternate hero my caster transforms into is a completley different hero (Different Main Stat/ abilities)
Here's my current code
JASS:
function Trig_Alternate_Personality_Coded_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03E' ) ) then
return false
endif
return true
endfunction
function Trig_Alternate_Personality_Coded_Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellAbilityUnit()) == 'H00I' ) ) then
return false
endif
return true
endfunction
function Trig_Alternate_Personality_Coded_Actions takes nothing returns nothing
//vars init
local integer level = GetHeroLevel(GetSpellAbilityUnit())
local integer experienceTotal = GetHeroXP(GetSpellAbilityUnit())
local integer abil_Q_level
local integer abil_W_level
local integer abil_E_level
local integer abil_R_level
local integer abil_Stat_level
local integer skillPoints = GetHeroSkillPoints(GetSpellAbilityUnit())
local item array items
local unit unit_New
local integer i = 0
//vars setup
set items[1] = UnitItemInSlot(GetSpellAbilityUnit(),0)
set items[2] = UnitItemInSlot(GetSpellAbilityUnit(),1)
set items[3] = UnitItemInSlot(GetSpellAbilityUnit(),2)
set items[4] = UnitItemInSlot(GetSpellAbilityUnit(),3)
set items[5] = UnitItemInSlot(GetSpellAbilityUnit(),4)
set items[6] = UnitItemInSlot(GetSpellAbilityUnit(),5)
//set abil_Q_level = GetUnitAbilityLevel( who, abilityCode)
//set abil_W_level = GetUnitAbilityLevel( who, abilityCode)
//set abil_E_level = GetUnitAbilityLevel( who, abilityCode)
set abil_R_level = GetUnitAbilityLevel( GetSpellAbilityUnit(), 'A03E')
set abil_Stat_level = GetUnitAbilityLevel( GetSpellAbilityUnit(), 'A005')
if ( Trig_Alternate_Personality_Coded_Func001C() ) then
call CreateNUnitsAtLoc( 1, 'H00J', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellAbilityUnit()), GetUnitFacing(GetSpellAbilityUnit()) )
set unit_New = GetLastCreatedUnit()
call RemoveUnit( GetSpellAbilityUnit() )
else
call CreateNUnitsAtLoc( 1, 'H00I', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellAbilityUnit()), GetUnitFacing(GetSpellAbilityUnit()) )
set unit_New = GetLastCreatedUnit()
call RemoveUnit( GetSpellAbilityUnit() )
endif
call AddHeroXP(unit_New, experienceTotal, false)
call SetHeroLevel(unit_New, level, false)
//set Abilities
call SetUnitAbilityLevel(unit_New,'A03E', abil_R_level)
call SetUnitAbilityLevel(unit_New,'A005', abil_Stat_level)
set i = 0 //saftey set
loop
exitwhen i == 6 //all inventory
//---
call UnitAddItemToSlotById(unit_New,GetItemTypeId(items[i]), i)
//---
set i = i+1 //iterator
endloop
//Clean Vars
set level = 0
set experienceTotal = 0
set abil_Q_level = 0
set abil_W_level = 0
set abil_E_level = 0
set abil_R_level = 0
set abil_Stat_level = 0
set skillPoints = 0
set i = 0 //saftey set
loop
exitwhen i == 6 //all inventory
//---
set items[i] = null
//---
set i = i+1 //iterator
endloop
set unit_New = null
set i = 0
endfunction
//===========================================================================
function InitTrig_Alternate_Personality_Coded takes nothing returns nothing
set gg_trg_Alternate_Personality_Coded = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Alternate_Personality_Coded, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Alternate_Personality_Coded, Condition( function Trig_Alternate_Personality_Coded_Conditions ) )
call TriggerAddAction( gg_trg_Alternate_Personality_Coded, function Trig_Alternate_Personality_Coded_Actions )
endfunction
JASS:
//set Abilities
call SetUnitAbilityLevel(unit_New,'A03E', abil_R_level)
call SetUnitAbilityLevel(unit_New,'A005', abil_Stat_level)