• 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.

[JASS] Inconsistance Skill Level Requirement

Status
Not open for further replies.
Level 1
Joined
Jul 30, 2006
Messages
3
I'm trying to configure an ability to have an inconsitant lvl skip requirement:

Levels 1-10 of the ability will have a 2 lvl skip requirement.
Levels 11-15 will have a 3 lvl skip req.
Levels 16-20 will have a 4 lvl skip req.

I tried doing this through triggers and did not prevail correctly. I did several things that made since, but yet did not so my friends told me to turn to JASS. Please Help, here is my code that is not JASS based.


Code:
Unit - A unit Learns a skill
Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of (ability 1-10) for (Learning Hero)) Equal to 10
        Then - Actions
            Unit - Remove(ability 1-10) from (Learning Hero)
            Unit - Add (ability 11-15) to (Learning Hero)
            Unit - Set level of (ability 11-15) for (Learning Hero) to 10
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of (ability 11-15) for (Learning Hero)) Equal to 15
        Then - Actions
            Unit - Remove (ability 11-15) from (Learning Hero)
            Unit - Add (ability 16-20) to (Learning Hero)
            Unit - Set level of (ability 16-20) for (Learning Hero) to 15
        Else - Actions
            Do nothing

Note: all 3 versions have 20 levels in them, when i replace the older version of an ability, i set the level of the new one to w/e lvl necessary (ex: when 11-15 replaces 1-10, i set the lvl of the new one to 10)
The abilities are the same ability in object editor essentially, the only difference in them is their lvl skip requirement and editor suffix (1-10, etc)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
though many ppl say "use JASS", that usually means they know nothing about it. just because JASS is better, it is not all-powerful, as most think, and therefore do not assume that you can do anything with it

i assume the main problem you are having is that the original ability is not fully removed, and that occurs because hero abilities cannot be fully removed in wc3

i suggest giving it NO skip requirement, and unlearning it with a message whenever they attempt to learn it when they shouldnt be able to.
 
Level 5
Joined
May 22, 2006
Messages
150
This is your trigger converted into Jass:

JASS:
function Trig_UpgradeAbility_Actions takes nothing returns nothing
  local integer abilityId = GetSpellAbilityId()
  local unit triggerUnit = GetTriggerUnit()
  if GetLearnedSkillLevel() == 10 then
    call UnitRemoveAbility(triggerUnit,abilityId)
    call UnitAddAbility(triggerUnit, < - ability No.2 -> )
    call SelectHeroSkill(triggerUnit, < - ability No.2 -> )
  elseif GetLearnedSkillLevel() == 15 then
    call UnitRemoveAbility(triggerUnit,abilityId)
    call UnitAddAbility(triggerUnit, < - ability No.3 -> )
    call SelectHeroSkill(triggerUnit, < - ability No.3 -> )
  else
    call UnitRemoveAbility(triggerUnit,abilityId)
    call UnitAddAbility(triggerUnit,abilityId)
    call SetUnitAbilityLevelSwapped(abilityId,triggerUnit,10)
  endif
  set triggerUnit = null
endfunction

function InitTrig_UpgradeAbility takes nothing returns nothing
  set gg_trg_UpgradeAbility = CreateTrigger()
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(0),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(1),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(2),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(3),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(4),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(5),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(6),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(7),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(8),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(9),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(10),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(11),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerAddAction(gg_trg_UpgradeAbility,function Trig_UpgradeAbility_Actions)
endfunction

But as you said, there is a problem with your script, and theoretically the same problems should still occur.
May you describe, what goes wrong, may I find out why and fix it.
 
Level 1
Joined
Jul 30, 2006
Messages
3
I had a good explanation of why this particular one didnt work is becasue of the level 10 of the Skill 11-16 level require would be 29 instead of 19 and your character couldnt use it.

So I changed the Skill 11-16 to level 6 but it has same effects as the level 10, still no luck. Once i get level 10 of the Skill 1-10 it goes back to level 1 of Skill 1 -10.
 
Level 5
Joined
May 22, 2006
Messages
150
Oops...
I forgot something. ^^

Edited.

And now to the level problem:
Let your second abilities first level have the same values like the tenth level of the first one.
Then let your third abilities first level have the same values like the fifteenth level of the second one.

Alter the description strings and no player will see the difference.
 
Level 1
Joined
Jul 30, 2006
Messages
3
If you do that,

The Level Requirement would be pointless. it would have to start at Level 6 to have the Level Requirement correct. If we started at level one, the level requirement would be as good as gone.
 
Level 5
Joined
May 22, 2006
Messages
150
Nope. Not if you alter "reqLevel" for the second and third ability.

I worked over it all once more.
It is tested and should not malfunction:

Put this into your map initialisation:

JASS:
call SetPlayerAbilityAvailable(Player( <- PlayerId -> ), <- AbilityId No.2 -> ,false)
call SetPlayerAbilityAvailable(Player( <- PlayerId -> ), <- AbilityId No.3 -> ,false)

This is the trigger itself:

JASS:
function Trig_UpgradeAbility_Actions takes nothing returns nothing 
  local integer abilityId = GetLearnedSkill()
  local unit triggerUnit = GetTriggerUnit()
  local player unitOwner = GetOwningPlayer(triggerUnit)
  if abilityId == <- AbilityId No.1 -> and GetLearnedSkillLevel() == 10 then
    call SetPlayerAbilityAvailable(unitOwner, <- AbilityId No.1 -> ,false)
    call SetPlayerAbilityAvailable(unitOwner, <- AbilityId No.2 -> ,true)
    call UnitAddAbility(triggerUnit, <- AbilityId No.2 -> )
  elseif abilityId == <- AbilityId No.2 -> and GetLearnedSkillLevel() == 6 then
    call SetPlayerAbilityAvailable(unitOwner, <- AbilityId No.2 -> ,false)
    call SetPlayerAbilityAvailable(unitOwner, <- AbilityId No.3 -> ,true)
    call UnitAddAbility(triggerUnit, <- AbilityId No.3 -> )
  endif
  set triggerUnit = null
  set unitOwner = null
endfunction

function InitTrig_UpgradeAbility takes nothing returns nothing
  set gg_trg_UpgradeAbility = CreateTrigger()
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(0),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(1),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(2),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(3),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(4),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(5),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(6),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(7),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(8),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(9),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(10),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerRegisterPlayerUnitEvent(gg_trg_UpgradeAbility,Player(11),EVENT_PLAYER_HERO_SKILL,null)
  call TriggerAddAction(gg_trg_UpgradeAbility,function Trig_UpgradeAbility_Actions) 
endfunction

This has to be set in the three abilities:
The hero unit has to have all three in it's "heroAbilList".

first ability
- reqLevel 1
- levels 10
- levelSkip 2

second ability
- reqLevel 19
- levels 6
- levelSkip 3

third ability
- reqLevel 34
- levels 6
- levelSkip 4

Ability no.1, level 10 has to be identical to ability no.2, level 1.
Ability no.2, level 6 has to be identical to ability no.3, level 1.

Unfortunately, the maximum of content in "heroAbilList" is five...
And as purplePoot said, hero abilities cannot be removed...
 
Status
Not open for further replies.
Top