HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Help] Set it to ALWAYS display 1

02-21-2009, 12:28 PM#1
Tide-Arc Ephemera
Sorry for the ambiguous name...

Collapse JASS:
function TransmuteConditions takes nothing returns boolean
    return GetLearnedSkillBJ() == 'A000'
endfunction

function Transmute takes nothing returns nothing
    local real x = GetUnitX(GetTriggerUnit())
    local real y = GetUnitY(GetTriggerUnit())
    call UnitRemoveAbility( u, 'A000' )
    call SetUnitAbilityLevelSwapped( 'A000', u, 0 )
    call UnitAddAbility( u, 'A000' )
    call MoveLocation( udg_LocSPFX, x, y )
    call AdjustPlayerStateBJ( 50, GetOwningPlayer(GetTriggerUnit()), PLAYER_STATE_RESOURCE_GOLD )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
    call DecUnitAbilityLevel( GetTriggerUnit(), 'A000' )
endfunction

What it's supposed to do is something similar to what's done in The Black Road, where when I "learn" an ability, it gives me cookies (or attributes) and then it always shows up as 1 on the hero-skill card even after 5000 uses.

This always shows 2.
02-21-2009, 12:49 PM#2
wraithseeker
I do not get why you remove the ability and then how do you even set the level of the ability and then add it back again?

Collapse JASS:
call DecUnitAbilityLevel( GetTriggerUnit(), 'A000' )
What does this do? I don't remember seeing this in common.j or blizzard.j
02-21-2009, 02:05 PM#3
Bobo_The_Kodo
You wan't UnitRemoveAbility, it won't actually remove the ability from hero skills, but it will set level to 0
02-21-2009, 08:04 PM#4
Tide-Arc Ephemera
Quote:
Originally Posted by wraithseeker
I do not get why you remove the ability and then how do you even set the level of the ability and then add it back again?

Collapse JASS:
call DecUnitAbilityLevel( GetTriggerUnit(), 'A000' )
What does this do? I don't remember seeing this in common.j or blizzard.j

Oops, I thought I deleted that... but even then it shouldn't be having any effects. It's somewhere around the blizzard.j I think, it sets the ability's level down 1.


Quote:
Originally Posted by Bobo_The_Kodo
You wan't UnitRemoveAbility, it won't actually remove the ability from hero skills, but it will set level to 0
I've done that, as you can see.

EDIT!

Collapse JASS:
function TransmuteConditions takes nothing returns boolean
    return GetLearnedSkillBJ() == 'A000'
endfunction

function Transmute takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    call UnitRemoveAbility( u, 'A000' )
    call SetUnitAbilityLevelSwapped( 'A000', u, 0 )
    call UnitAddAbility( u, 'A000' )
    call MoveLocation( udg_LocSPFX, x, y )
    call AdjustPlayerStateBJ( 50, GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
endfunction

function AgilityConditions takes nothing returns boolean
    return GetLearnedSkillBJ() == 'A002'
endfunction

function Agility takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    call UnitRemoveAbility( u, 'A002' )
    call SetUnitAbilityLevelSwapped( 'A002', u, 0 )
    call UnitAddAbility( u, 'A002' )
    call SetHeroAgi( u, ( GetHeroStatBJ(bj_HEROSTAT_AGI, u, false) + 5 ), true )
    call MoveLocation( udg_LocSPFX, x, y )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
endfunction

function StrengthConditions takes nothing returns boolean
    return GetLearnedSkillBJ() == 'A001'
endfunction

function Strength takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    call UnitRemoveAbility( u, 'A001' )
    call UnitAddAbility( u, 'A001' )
    call SetUnitAbilityLevelSwapped( 'A001', u, 0 )
    call SetHeroStr( u, ( GetHeroStatBJ(bj_HEROSTAT_STR, u, false) + 5 ), true )
    call MoveLocation( udg_LocSPFX, x, y )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
endfunction

function IntelligenceConditions takes nothing returns boolean
    return GetLearnedSkillBJ() == 'A003'
endfunction

function Intelligence takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    call UnitRemoveAbility( u, 'A003' )
    call UnitAddAbility( u, 'A003' )
    call SetUnitAbilityLevelSwapped( 'A003', u, 0 )
    call SetHeroInt( u, ( GetHeroStatBJ(bj_HEROSTAT_INT, u, false) + 5 ), true )
    call MoveLocation( udg_LocSPFX, x, y )
    call AddSpecialEffectLocBJ( udg_LocSPFX, "Abilities\\Spells\\Items\\AIim\\AIimTarget.mdl" )
    call DestroyEffect( GetLastCreatedEffectBJ() )
endfunction

//===========================================================================
function InitTrig_GE_Transmute takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( t, Condition( function TransmuteConditions ) )
    call TriggerAddAction( t, function Transmute )
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( t, Condition( function StrengthConditions ) )
    call TriggerAddAction( t, function Strength )
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( t, Condition( function IntelligenceConditions ) )
    call TriggerAddAction( t, function Intelligence )
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( t, Condition( function AgilityConditions ) )
    call TriggerAddAction( t, function Agility )
    set t = null
endfunction

Strange things happening, the first one can only be learned once, but the next 3 all work but display 2s.
02-23-2009, 04:07 AM#5
Tide-Arc Ephemera
Bump?
02-23-2009, 04:12 AM#6
xombie
I am unfamiliar with The Black Road so I'm not entirely sure what you're trying to accomplish. Would you be able to try and give me a more in depth description of what the outcome it supposed to be?
02-23-2009, 04:18 AM#7
Tide-Arc Ephemera
In The Black Road, whenever you leveled up you would be given a skill point. In the hero-skill menu, there were options of Strength, Agility and Intelligence. If you selected one, you would use the point to gain an attribute of the selected type. It would not show up on the command card later on.

They've managed a way so that every time you level it up, it ALWAYS sits at 1. I've tried using a one-level only ability but it doesn't work because it learns the ability and for some reason doesn't unlearn it.

I've tried using a two-level ability but it does kind-of work because it does learn it (even though it shouldn't) and it shows up on the command card and is reselectable, but the problem is that it stays at level 2.
02-23-2009, 05:15 AM#8
Bobo_The_Kodo
Well UnitRemoveAbility works for me :[ , ill post a testmap tommorow or something

Edit: I said UnitRemoveAbility, not UnitRemoveAbility then UnitAddAbility !!, UnitRemoveAbility doesn't remove it from hero abilities ><
02-23-2009, 10:22 PM#9
xombie
Quote:
Originally Posted by Bobo_The_Kodo
UnitRemoveAbility doesn't remove it from hero abilities ><

...I'm not entirely certain that's true. Are you sure UnitRemoveAbility() sets the level of the ability on the unit to 0? What is the difference between UnitRemoveAbility and SetUnitAbilityLevel(..., 0)?
02-24-2009, 03:10 AM#10
Bobo_The_Kodo
Quote:
...I'm not entirely certain that's true. Are you sure UnitRemoveAbility() sets the level of the ability on the unit to 0? What is the difference between UnitRemoveAbility and SetUnitAbilityLevel(..., 0)?
Im 99% sure... I found it out when trying to make a passive spell with a cooldown... UnitRemoveAbility didnt remove from hero abilities but removed from command card and it said learn level 1 in menu, so I assume thats what it did... I ended up using SetPlayerAbilityAvailable
02-24-2009, 03:30 AM#11
xombie
Okay, well then I suppose its true :P