What are this spells? Sounds like items used as spells but better tell us.
k, in your maps there are powerup items and this items teach abilities. Also such an powerup Item improves the level when gaining the same item again. You want to limit an unit to have 4 different abilities only.
If you map is 1 hero per player you could add an integer array "Abilities_Learned".
When gaining an new ability increase it by 1 for that player. Abilities_Learned[player number of trigger Player] + 1
if an hero gains an powerup but the Abilities_Learned for that player is already 4 you don't add a new ability instead you give back the gold costs or recreate it whatever you like.
it looks wrong.
The goal is to add a counter to the unit, it counts the amount of new unique abilities learned. When the counter is 4 and you would gain a new ability you prevent the ability gaining.
Blizzard
Events
Unit - A unit Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to Blizzard
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Sørn Blizzard for (Triggering unit)) Equal to 10
Then - Actions
Game - Display to (Player group((Triggering player))) the text: You have maxed out ...
Set TempLoc = (Position of (Triggering unit))
Item - Create Blizzard at TempLoc
Custom script: call RemoveLocation(udg_TempLoc)
Item - Remove (Item being manipulated)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Sørn Blizzard for (Triggering unit)) Equal to 0
Then - Actions
-------- Already got 4 spells?--------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Abilities_Learned[(Player number of (Triggering player))] Less than 4
Then - Actions
Set Abilities_Learned[(Player number of (Triggering player))] = (Abilities_Learned[(Player number of (Triggering player))] + 1)
Unit - Add Sørn Blizzard to (Triggering unit)
Item - Remove (Item being manipulated)
Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIam\AIamTarget.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions
-------- Already got 4 spells, regain tome or whaterver you like --------
Else - Actions
Unit - Increase level of Sørn Blizzard for (Triggering unit)
Item - Remove (Item being manipulated)
Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIam\AIamTarget.mdl
Special Effect - Destroy (Last created special effect)
you have to increase ability_Learned, if the ability is picked the first time.
->
Set Abilities_Learned[(Player number of (Triggering player))] = (Abilities_Learned[(Player number of (Triggering player))] + 1)
multiboards display strings (Text), warcraft 3 has inbuilt integer/real to String conversation functions, use them to convert your abilities learned counter to be displayed inside the multiboard.
sure you can make it auto update on Level up, but that requiers to save the abilities learned for each hero/Player depends, if an player has more than 1 hero, if an player has only 1 hero then you can simply use the player number with 4 ability variables. If there are more than 1 hero a player you need either unit indexer or hashtable but saving abilities into an hash in GUI is not supported. Therefore you should either use player Index or an unit indexer system.Also do you think if i do it this, that i could make it so you only have to buy a spell once so when every time the hero level's up it could upgrade the spells level ? without having to buy it ofc...
sure you can make it auto update on Level up, but that requiers to save the abilities learned for each hero/Player depends, if an player has more than 1 hero, if an player has only 1 hero then you can simply use the player number with 4 ability variables. If there are more than 1 hero a player you need either unit indexer or hashtable but saving abilities into an hash in GUI is not supported. Therefore you should either use player Index or an unit indexer system.
Could look somehow like this:
Learn Blizzard
Events
Unit - A unit Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to Blizzard
Actions
Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
-------- NoAbility is an ability variable you never write onto --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Ability_Learned1[PlayerNumber] Equal to NoAbility
Then - Actions
-------- Abilty Learned1 for that hero is empty, use it to learn Blizzard --------
Set Ability_Learned1[PlayerNumber] = Blizzard
Unit - Add Blizzard to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Ability_Learned2[PlayerNumber] Equal to NoAbility
Then - Actions
Set Ability_Learned2[PlayerNumber] = Blizzard
Unit - Add Blizzard to (Triggering unit)
Else - Actions
-------- Inser Ability_Learned3 & Ability Learned4 this is only for showing purpose --------
It would also be smart to disallow learning the same ability multiple Times.
Level up
Events
Unit - A unit Gains a level
Conditions
Actions
Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
Unit - Set level of Ability_Learned1[PlayerNumber] for (Triggering unit) to (Hero level of (Triggering unit))
Unit - Set level of Ability_Learned2[PlayerNumber] for (Triggering unit) to (Hero level of (Triggering unit))
Unit - Set level of Ability_Learned3[PlayerNumber] for (Triggering unit) to (Hero level of (Triggering unit))
Unit - Set level of Ability_Learned4[PlayerNumber] for (Triggering unit) to (Hero level of (Triggering unit))
Learnable custom skills: Dat takes alot of extra abilities.Hmm was more thinking about the player could choose manually which ability to learn in the red plus sign after buying the ability once, just to prevent the tomes getting drop after being bought.