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

Problem with Items - Need Help

Status
Not open for further replies.
Level 9
Joined
Sep 15, 2012
Messages
311
I'm making an RPG (The 2nd Part of The Prophecy of the Dark Angel, for those who know it already) and after hours of trying I have the following problems:

a) I want to make creeps have a chance to drop either a common random item, a healing potion, a creep type based item (e.g. Bandits to drop a dagger, wolves a pelt) or nothing.

b) I make a vendor with special items and some of them have a level requirment. My idea was to make a chest (for example) to store your items that counts as Town Halls do in melee maps and upgrades a tier up every 5 lvls of the hero. I set the item to require a higher tier Town Hall (the chest in this example) and... FAIL. It totaly ignores Tech Requirement and lets me purchase the item freely.

Anyone can help? :cry:
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Setup specific drops. Each index number has a unit type with an asociated item type.
  • Set Item Types
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set lootId = (lootId + 1)
      • Set lootItemType[lootId] = Claws of Attack +15
      • Set lootUnitType[lootId] = Timber Wolf
The drop trigger.
  • Creep Item Drops
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Set Chance = (Random percentage)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 40.00
        • Then - Actions
          • -------- 40% chance to drop a random level 1 item (common item) --------
          • Item - Create (Random level 1 Permanent item-type) at tempPoint
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Chance Less than or equal to 60.00
            • Then - Actions
              • -------- 20% chance to drop a random level 1 potion-type item --------
              • Item - Create (Random level 1 Purchasable item-type) at tempPoint
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Chance Less than or equal to 80.00
                • Then - Actions
                  • -------- 20% chance to drop item based on unit type --------
                  • For each (Integer IntegerC) from 1 to lootId, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to lootUnitType[IntegerC]
                        • Then - Actions
                          • Item - Create lootItemType[IntegerC] at tempPoint
                        • Else - Actions
                • Else - Actions
      • Custom script: call RemoveLocation(udg_tempPoint)
For (b), you'll have to take a different approach: when an item is purchased, you check if the unit meets the requirements by using triggers, and if the requirements are not met, remove the item and refund the player.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) Well, I've made some table drop system a while ago, with a setup similar to the standard drop-system of Warcraft.
I've attached the map, under the trigger comment "Setup Information" are the demo-triggers which should contain enough information for you to get it up and running. The triggers under "System" are the ones you will need.

Though you shouldn't really use it if you only need it for common drops.
However, if you would like to have multiple drop tables in your map, it might prove to be useful.

2) I think you'll need triggers for this (similar to systems where you cannot pick up an item unless you meet the level requirements).
 

Attachments

  • TableDrops.w3x
    19.1 KB · Views: 31
Level 10
Joined
May 8, 2009
Messages
253
b)
  • Buying Item
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • ((Buying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Claws of Attack +15
          • (Level of (Buying unit)) Less than 6
        • Then - Actions
          • Item - Remove (Sold Item)
          • Player - Add 800 to (Owner of (Buying unit)) Current gold
        • Else - Actions
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Valid argument, you need to do these things for such a shop:

1) You need to set the items in "Techtree - Items Made", not Items Sold.
2) The shop must have the ability "Shop Sharing" (in addition to "Shop Purchase Item").
3) The shop must be owned by an ally (not neutral/enemy).

The problem is that the owner of the shop must have the techtree requirements, not the buyer.
So if an ally owns the shop and that ally meets the techtree requirements, you can buy the item - whether you meet the requirements doesn't matter.
(Edit: maybe there's a way to circumvent it? Haven't found it though).

Maybe that fits into your map, but most people would consider triggers for level requirements.
 
Level 9
Joined
Sep 15, 2012
Messages
311
Valid argument, you need to do these things for such a shop:

1) You need to set the items in "Techtree - Items Made", not Items Sold.
2) The shop must have the ability "Shop Sharing" (in addition to "Shop Purchase Item").
3) The shop must be owned by an ally (not neutral/enemy).

The problem is that the owner of the shop must have the techtree requirements, not the buyer.
So if an ally owns the shop and that ally meets the techtree requirements, you can buy the item - whether you meet the requirements doesn't matter.
(Edit: maybe there's a way to circumvent it? Haven't found it though).

Maybe that fits into your map, but most people would consider triggers for level requirements.

Excellent! That means I have to make a custom upgrade (that does nothing) for that ally and make it level 1 tier up when the player's hero reaches lvl5, 10, 15, 20.
I'm testing it right away! :grin:
 
Last edited:
Status
Not open for further replies.
Top