• 🏆 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!

Giving and removing abilities.

Status
Not open for further replies.
Level 2
Joined
Aug 23, 2011
Messages
11
Currently my map I have planned is sooner or later going to run into the problem of abilities. So here's what I would like to know:

Currently my method is that I would like players to purchase their ability spellbooks and to have up to two at a time only. Now my problem is that I don't know how to limit the amount of these abilities to two or how to make sure one gets removed when another 1 is purchased, to make sure they don't end up with three.

The abilities within the spellbook aren't a problem for me. It's just getting rid of the abilities themselves and limiting the abilities to two.

Any help would greatly be appreciated, and sorry if I'm in the wrong section, thanks guys and gals <3
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could save the count into a hashtable. Then you could save the spell book ability ids for the unit. When the unit gets the first book, save it as 1. Update the count. When you get the second, save it as 2.

When you get another one and you have two books, remove 1, save 2 as 1 and the new one as 2.

For example
  • Custom script: call SaveInteger(hastable, unitId, 1, abilId)
 
Last edited:
SO... how does spellbook work?... since it IS my corrent project I gonna make detail of whatever I know!


Cleave Spellbook:
A spellbook copied attack that has 12 maximum 1 minimum ability in it, and only one skill in it which is "Cleave (netural hostile)" with 4 levels.
Each time a unit cast "Roar" and it is a melee unit, the unit will also have cleave based on the level of the raor. so the spell book can give each unit 12 skills at the same time, those skill are invisable and stays untill the buff removed. all explained into details below. good luck.




  • initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set A = (Integer A)
          • Player - Disable Cleave Spellbook for (Player(A))

  • berserk
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar
    • Actions
      • Unit - Add Cleaving Attack Ulty to (Triggering unit)
      • Unit - Set level of Cleaving Attack Ulty for (Triggering unit) to (Level of (Ability being cast) for (Triggering unit))
      • Trigger - Add to upon death <gen> the event (Unit - (Picked unit) Dies)
      • Trigger - Turn on every second 1 time <gen>
  • upon death
    • Events
    • Conditions
    • Actions
      • Unit - Remove Cleave Spellbook from (Dying unit)
  • every second 1 time
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set MAX = 0
      • Set ug = (Units in (Playable map area) matching ((Level of Ultimate Shield Book for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ug is empty) Equal to True
        • Then - Actions
        • Else - Actions
          • Set MAX = (MAX + 1)
          • Unit Group - Pick every unit in ug and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Ultimate Shield) Equal to False
                • Then - Actions
                  • Unit - Remove Ultimate Shield Book from (Picked unit)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ug)
      • Set ug = (Units in (Playable map area) matching ((Level of Cleaving Attack Roar for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ug is empty) Equal to True
        • Then - Actions
        • Else - Actions
          • Set MAX = (MAX + 1)
          • Unit Group - Pick every unit in ug and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff War Cry) Equal to False
                • Then - Actions
                  • Unit - Remove Cleave Spellbook from (Picked unit)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ug)
      • Set ug = (Units in (Playable map area) matching ((Level of Cleaving Attack Ulty for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ug is empty) Equal to True
        • Then - Actions
        • Else - Actions
          • Set MAX = (MAX + 1)
          • Unit Group - Pick every unit in ug and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Berserk) Equal to False
                • Then - Actions
                  • Unit - Remove Cleaving Attack Ulty from (Picked unit)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ug)
      • Set ug = (Units in (Playable map area) matching ((Level of Leave No Trace (unit) for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ug is empty) Equal to True
        • Then - Actions
        • Else - Actions
          • Set MAX = (MAX + 1)
          • Unit Group - Pick every unit in ug and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Critical Hits ) Equal to False
                • Then - Actions
                  • Unit - Remove Leave No Trace (unit) from (Picked unit)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ug)
      • Set ug = (Units in (Playable map area) matching ((Level of Ninja Movements for (Matching unit)) Not equal to 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ug is empty) Equal to True
        • Then - Actions
        • Else - Actions
          • Set MAX = (MAX + 1)
          • Unit Group - Pick every unit in ug and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Ninja Momements ) Equal to False
                • Then - Actions
                  • Unit - Remove Ninja Movements from (Picked unit)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ug)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MAX Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
The last trigger show how to handle the massive other amount of spellsbooks - just allways and only keep in mind that 2 spellbook will become one spell book and that new spellbook can have 12 spells or it wont work, giving passive such as reincanication critical armor - are allowed, but not more than 12 total, the best is to let unit effect itself and since each unit have usually 4 spells , you could make some expetionals to make roar that give critical to any unit it hits :grin:.
 
Level 2
Joined
Aug 23, 2011
Messages
11
...I wish I was good with triggers X.X

Alright, instead of doing this myself, Ima just see if someone is willing to input this set of triggers in my map when it gets to that stage.

Thanks anyways guys! Appreciate it!

Alright thanks guys, Ima just get another willing individual to implement them into my map when it reaches that stage.
 
Last edited by a moderator:
Status
Not open for further replies.
Top