Hi I downloaded this program out of the tutorial section.
I modded it a bit but I have one more question.
I want the shop to only sell an item if 5 spells are learned, notice: not 1 spell with 5 levels but 5 abilities in total.
You can still upgrade the 5 abilities till they are maxed out.
Any Ideas?
I modded it a bit but I have one more question.
I want the shop to only sell an item if 5 spells are learned, notice: not 1 spell with 5 levels but 5 abilities in total.
You can still upgrade the 5 abilities till they are maxed out.
Any Ideas?
Code:
Actions
Set tmpItem = (Sold Item)
Set tmpUnit = (Buying unit)
-------- Lets determine which spell was bought. --------
Do Multiple ActionsFor each (Integer A) from 0 to 3, do (Actions)
Loop - Actions
Set tmpInt = (Integer A)
-------- Custom script to exit the loop when the right 'spell' was found. --------
Custom script: exitwhen (GetItemTypeId(udg_tmpItem) == udg_spellItemId[udg_tmpInt])
-------- The right sold spells is found. --------
-------- Now lets determine whether the buying hero already has this spells learnt or not. --------
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of realSpellId[tmpInt] for tmpUnit) Equal to (==) 0
Then - Actions
-------- The hero does not have this spell. Lets 'learn' the spell. --------
Unit - Add realSpellId[tmpInt] to tmpUnit
Else - Actions
-------- The hero has this spell. --------
-------- We have to determine whether it's an one level ultimate or a regular spell. --------
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of realSpellId[tmpInt] for tmpUnit) Equal to (==) 3
Then - Actions
-------- The spell is maxed out. Give gold back. --------
Player - Add 150 to (Owner of tmpUnit) Current gold
Else - Actions
-------- The spell is not maxed out. Increase the level of the spell. --------
Unit - Increase level of realSpellId[tmpInt] for tmpUnit
Item - Remove tmpItem