Trigger doesnt work like I wanted

Level 8
Joined
Nov 24, 2016
Messages
218
In my map, i made a trigger that would automaticly learn abilities for certain types of heroes, whenever they got trained and gained levels from 1 to 10.
It works on my side, if i train that hero he gets his abilities automaticly, bot for some reason when enemy AI trains him, he doens't (i can tell becouse i forced 1 hero to have aura at level 1). I dont know whats wrong, is it enemy AI scripts or anyting else. Would be thankful for help.

Here is my map (well not mine exacy but im doing edit of blizzard scenario)
 

Attachments

  • (4)monolith.w3x
    13.4 MB · Views: 4

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Try adding a short Wait before the Learning:
  • Actions
    • Wait 0.10 game-time seconds
    • ... Learn skills
Try different values, sometimes 0.10 is too short.

Another issue may be that the AI has already learned a skill before you have a chance to do anything. In other words, it runs it's own learning logic before the Events run. In that case you may need to manipulate the skills manually:
  • Paladin
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Paladin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Trained unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Hero - Learn skill for (Trained unit): Devotion Aura
        • Else - Actions
          • Hero - Modify unspent skill points of (Trained unit): Subtract 999 points
          • Unit - Decrease level of Holy Light for (Trained unit)
          • Unit - Decrease level of Divine Shield for (Trained unit)
          • Unit - Set level of Devotion Aura for (Trained unit) to 1
Not sure if decreasing the level of a Level 1 ability will "Unlearn" it. If this all doesn't work, try adding a Wait before you move onto some other solution.
 
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,594
It is very likely that the AI script is doing its own thing. Just ran some tests with default Paladin and the moment I used ai script my skill-assigning triggers no longer worked.
You could import modified version of the ai scripts you use so that you can include your own skill setup. This is example on what they have in human.ai script:
JASS:
function set_skills takes nothing returns nothing

    set skill[ 1] = HOLY_BOLT
    set skill[ 2] = DEVOTION_AURA
    set skill[ 3] = HOLY_BOLT
    set skill[ 4] = DIVINE_SHIELD
    set skill[ 5] = HOLY_BOLT
    set skill[ 6] = RESURRECTION
    set skill[ 7] = DEVOTION_AURA
    set skill[ 8] = DEVOTION_AURA
    set skill[ 9] = DIVINE_SHIELD
    set skill[10] = DIVINE_SHIELD

    call SetSkillArray(1,PALADIN)
    call SetSkillArray(2,PALADIN)
    call SetSkillArray(3,PALADIN)

...
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
Nichilus got it right, here's the problem (e.g. in Wolf.ai)


1736799301671.png


It has a built in function related to hero skills
 
Top