• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Unlearning Spells Help

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
My map features dummy items, which will learn you the spell if you use the item.
That part works fine.

But you are also able to unlearn each spell individual, and when you unlearn the spell it´s dummy item will spawn at your location. And I have no clue how to recognize what spell the player is unlearning thus what dummy item should be dropped.

Background information:
- Each spell only has one level.
- You unlearn spells by purchasing an item (unlearn first spell, unlearn second spell etc) which are used automatically.
- It's for 4 players.

Current learn trigger:
(It's just the basics for now and text part needs work lol.)
  • Learn Firebolt
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Firebolt [Fire]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Only4Spell[(Player number of (Owner of (Triggering unit)))] Less than 4
              • (Level of Firebolt for (Triggering unit)) Equal to 0
            • Then - Actions
              • Unit - Add Firebolt to (Triggering unit)
              • Set Only4Spell[(Player number of (Owner of (Triggering unit)))] = (Only4Spell[(Player number of (Owner of (Triggering unit)))] + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Only4Spell[(Player number of (Owner of (Triggering unit)))] Less than 4
                  • (Level of Firebolt for (Triggering unit)) Equal to 1
                • Then - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You already know this spell.
                • Else - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You can only have 4 spell.
        • Else - Actions
Problem:
Don't know how to see what spells has been learned at what time etc etc So I can trace back: Unlearn 2, oh second spell is fire bolt, unlearn fire bolt and create learn firebolt dummy item.

Can somebody spoon feed me? With some sample triggers if can.
I'll give you rep
 
Level 9
Joined
Nov 4, 2007
Messages
931
I would probably do it like this:
  • Unit - Remove FirstAbility[Player Number of (Triggering Player)]
  • Unit - Add Firebolt to (Triggering Unit)
  • Set FirstAbility[Player Number of (Triggering Player)] = Firebolt
Using this should remove any previous first ability of the unit, add the new ability, then save the new ability in case you want to replace it again, hope this helped, some of this may be excess of what your looking for, so you might night need as many integers inside the Ability variable array.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
set an String with arrays :)
If Spell [1] = None Then set Spell [1] = Firebolt Else If Spell [2] = None Then Spell [2] = Firebolt, ETC and when u unlearn u change the string back to None

That's actually something I can make working. Great help.
It's been a while since I made maps so my brains need some retraining. :p

Though I'll have huge unlearn triggers, a check for every string (about 200 spells lol). xD
 
Status
Not open for further replies.
Top