HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ability problem

08-22-2003, 06:09 PM#1
TheZaCrew
You can only set a ability or a variable to ability being casted. I would like to use set - ability learned by hero and set integer to level of ability being learned.

How can I do this, jass or changes in the trigger-file?
08-22-2003, 06:17 PM#2
Shvegait
Use Hero Skill Comparison, not Ability Comparison.

One note of caution: (Event Response - Learned Skill Level) is buggy. At level 1, it returns a value of 1, but for every level above that, it returns one less than it should. Your best bet would probably be to just increase a variable by 1 rather than set it equal to Learned Skill Level. If you're going to have Tomes of Retraining, just have them set all skill variables/custom value of unit for that hero to 0.
08-22-2003, 08:49 PM#3
TheZaCrew
there is no action that can set a variable to ability/skill being learned. But is it posible with jass or something els as i asked before
08-22-2003, 10:18 PM#4
Trick
I think this is what you want. The code is from a map I'm working on, and I use this to track the upgrade level of a hero skill. Note that DrugPack is Integer Array of 16 places (max num of players).

Quote:
function Trig_Drug_Pack_Level_Copy_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A005' ) ) then
return false
endif
return true
endfunction

function Trig_Drug_Pack_Level_Copy_Actions takes nothing returns nothing
set udg_DrugPack[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))] = ( udg_DrugPack[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))] + 1 )
endfunction

//===========================================================================
function InitTrig_Drug_Pack_Level takes nothing returns nothing
set gg_trg_Drug_Pack_Level = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Drug_Pack_Level, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Drug_Pack_Level, Condition( function Trig_Drug_Pack_Level_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Drug_Pack_Level, function Trig_Drug_Pack_Level_Copy_Actions )
endfunction

08-23-2003, 03:06 AM#5
Newhydra
Yes, you need to convert to jass, the function you'd use is GetLearnedSkillBJ()
08-23-2003, 12:05 PM#6
TheZaCrew
k thanks, I'll get into jass as I know php I don't think it will be hard learning a new language.:D
08-23-2003, 12:14 PM#7
Zoizite
You can write that out all in the gui. You only need to change one value in the jass.
Code:
Untitled Trigger 001
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Human Archmage - Blizzard
    Actions
        Set SkillLevel = (SkillLevel + 1)
If you're using a custom skill, you need to convert to jass.
It should look like this:
You will need to change the value in red to the code for your spell(press ctrl+D to see this)
Code:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetLearnedSkillBJ() == '[color=RED]AHbz[/color]' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    set udg_SkillLevel = ( udg_SkillLevel + 1 )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction