• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Set Upgrade Range

Status
Not open for further replies.
Level 1
Joined
Jul 5, 2021
Messages
2
Hi. I was wondering if there was an easy* way to make upgrades only purchasable from a certain range, much how like how items behave. I'm making a unit that's a "trainer" for the hero and I'd like it if you could only get upgrades if you go visit him.
Note: I am not learning abilities from him. Mainly just stat upgrades. Thus the use of upgrades.

*by easy I mean a quick ability/number change in the object editor, a basic trigger, or something to that effect.

I would prefer to not use multiple dummy items/upgrades to have multiple triggers give me the real upgrades if I can avoid it. Thanks.
 

Uncle

Warcraft Moderator
Level 72
Joined
Aug 10, 2018
Messages
7,800
Possible solutions:

- Use Powerups since they do this already.

- Make a Enters/Leaves region trigger that enables the "trainer" when you come within range and disables the trainer when you leave. You can use the Pause action to disable the unit while you're not nearby and Unpause to enable it. If your map is multiplayer then this can cause problems. Instead of pausing you could also Disable/Enable the upgrades. Additionally, you'd need to gain control of this unit to research the upgrades.

- If Powerups are too limiting, use Powerup items and have them represent the upgrades through triggers. If done properly using Arrays/Hashtables you wouldn't need more than 2 triggers to do so.

Item Upgrades example:
  • Setup IU
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet IU_Hashtable = (Last created hashtable)
      • -------- --------
      • -------- Keep track of the upgrades: --------
      • -------- Make sure the [indexes] match! --------
      • Set VariableSet IU_Upgrades[1] = Iron Forged Swords
      • Set VariableSet IU_Upgrades[2] = Iron Plating
      • -------- --------
      • -------- Keep track of the items: --------
      • -------- Make sure the [indexes] match! --------
      • Set VariableSet IU_Items[1] = Iron Forged Swords (Item)
      • Set VariableSet IU_Items[2] = Iron Plating (Item)
      • -------- --------
      • -------- Keep track of the total number of items OR upgrades (it's the same amount either way): --------
      • Set VariableSet IU_Total = 2
      • -------- --------
      • -------- Store the items/upgrades into the hashtable: --------
      • For each (Integer IU_Loop) from 1 to IU_Total, do (Actions)
        • Loop - Actions
          • -------- Store the upgrade id in the hashtable using the matching item-type id as it's key: --------
          • Custom script: set udg_IU_Id = udg_IU_Items[udg_IU_Loop]
          • Custom script: set udg_IU_Id2 = udg_IU_Upgrades[udg_IU_Loop]
          • Hashtable - Save IU_Id2 as IU_Id of 0 in IU_Hashtable.
  • Acquire IU
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Item-type of (Item being manipulated)) is A powerup.) Equal to True
    • Actions
      • -------- Get the "item-type id" of the item being manipulated: --------
      • Set VariableSet IU_AcquiredItem = (Item being manipulated)
      • Custom script: set udg_IU_Id = GetItemTypeId(udg_IU_AcquiredItem)
      • -------- --------
      • -------- Load the upgrade from the hashtable using the acquired item's "item-type id": --------
      • Custom script: set udg_IU_Upgrades[0] = LoadInteger(udg_IU_Hashtable, 0, udg_IU_Id)
      • -------- --------
      • -------- Research the loaded upgrade: --------
      • Player - Set the current research level of IU_Upgrades[0] to 1 for (Owner of (Triggering unit))
 

Attachments

  • Item Upgrades.w3m
    18.3 KB · Views: 9
Last edited:
Level 1
Joined
Jul 5, 2021
Messages
2
Thanks for the suggestions. I'll probably go with the pause/unpause option. I don't intend on making the map multiplayer so should be fine.
 
Status
Not open for further replies.
Top