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

Buying Spells

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is a system for buying spells and leveling up the spells to max by Andrewgosu in GUI. Therefore, this system could be useful for GUI users.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current gold to 1800
      • Set spellItemId[0] = Purchase Breath of Fire
      • Set spellItemId[1] = Purchase Drunken Brawler
      • Set spellItemId[2] = Purchase Drunken Haze
      • Set spellItemId[3] = Purchase Storm, Earth, And Fire
      • -------- The 'buyable' spells and 'real' spells must be listed correspondingly. --------
      • Set realSpellId[0] = Breath of Fire
      • Set realSpellId[1] = Drunken Brawler
      • Set realSpellId[2] = Drunken Haze
      • Set realSpellId[3] = Storm, Earth, And Fire
  • Hero Buys Spell
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Set tmpItem = (Sold Item)
      • Set tmpUnit = (Buying unit)
      • -------- Lets determine which spell was bought. --------
      • For 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. --------
      • If (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. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • realSpellId[tmpInt] Equal to Storm, Earth, And Fire
            • Then - Actions
              • -------- The spell was an ultimate. As it's a one level spell, we have to refund the gold. --------
              • Player - Add 450 to (Owner of tmpUnit) Current gold
            • Else - Actions
              • -------- The spell was not an ultimate. --------
              • -------- We have to determine whether the normal spell is maxed out or not. --------
              • If (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




Keywords:
Buying, leveling, spells
Contents

Buying-Spells-From-Shop (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. You need to improve this, like do something with the fixed gold values. Currently it is not very impressive.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Reviewed by Maker, Buying Spells, 24th Apr 2012

You need to improve this, like do something with the fixed gold values.
Currently it is not very impressive.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
1) You would have to edit the system to add ultimates, as the system is hardcoded to have storm, earth, fire as theultimate

2) The gold amounts are static?

3) Checking if the spell is maxed only goes up to 3. What about abillities that have tons of levels?

4) According to the trigger you posted, it will loop 0-3 (again, static, you have to edit if u have more than 3) but the loop ends at exitwhen so the rest of the trigger will only function having tmpint as 3

5) Shouldnt that return a syntax error? Loop Integer A from 1 to 3 creates an exitwhen and your using a 2nd exitwhen

Rating : 1/5 Rejection. Nice try though, but there are too many of these out there and those are way more efficient
 
Level 9
Joined
Apr 23, 2011
Messages
460
The system is lacking majorly in flexibility as you cannot change things in say arrays or hashtables. Very large remakes on this trigger would be needed and like Illidans said, theres other systems like this that are simply more complete, configurable and easy to code throughout. 1/5
 
Level 1
Joined
Mar 8, 2014
Messages
5
I don't know what you guys were talking about it having hardly and flexibility. I adapted it just fine to my map :D Thank you for the system, it shall be going in my credits :)
 
being able to adapt it into your own map doesn't mean it's flexible... flexibility is being able to change/modify the "system" without needing to change the core... right now, to change this system you need to change the core... if being capable of adapted to a project is the measure of flexibility then ALL resources are flexible...
 
Top