Item Muting help?

Frizz.Meister

New Member
Reaction score
0
I am having problems on my map with item stealing. I have been trying to come up with an item muting system similar to dotas. However i im finding it really hard to make and very time consuming. I have searched these forums but found no tutorial or anything.

Any help?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Maybe something like when a unit "Acquires and item", set the item into a variable and link the variable to the triggering player.
Then when a unit picks that item up, if it's not that heroes variable/item, it gets muted.

Just an idea, I don't know how it will work.
 

Grymlax

Probably not around
Reaction score
138
this would be the simpliest solution, which works the way wolfie suggested.

Trigger:
  • gets item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Custom value of (Item being manipulated)) Equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Custom value of (Item being manipulated)) Equal to 0
              • (Custom value of (Item being manipulated)) Equal to (Player number of (Owner of (Triggering unit)))
        • Then - Actions
          • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)


it simply drops the item if the one who picks it up isn't the owner of the item
 

WolfieeifloW

WEHZ Helper
Reaction score
372
And of course in the main Conditions you'd have to add the items that can be shared, so they don't get dropped.
Just do something like:
Code:
Conditions
    ((Item-Type being manipulated) is <SharableItem>) Equal to False
 

Frizz.Meister

New Member
Reaction score
0
I took a look at that map and although the system may work it is incredibly complex and trigger heavy. I've been fiiddling around with custom values and im sure there must be an easier method.

As for the drop on pick up trigger. Works well but i can see it confusing people alot.

Edit: Reviewed the map again and it makes sense but some explaination on how a muted item cant be sold (so i can make my own custom muted items) would help alot.
 

Nexor

...
Reaction score
74
Here's my Item - Player restriction system:

Trigger:
  • Item Recipes
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Item being manipulated)) Equal to 0
        • Then - Actions
          • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Item being manipulated)) Not equal to (Player number of (Owner of (Triggering unit)))
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Cinematic - Clear the screen of text messages for (All players matching ((Matching player) Equal to (Owner of (Triggering unit))))
          • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffffcc00This item...
        • Else - Actions
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
sorry for the late reply.

As for the drop on pick up trigger. Works well but i can see it confusing people alot.

you mean those debug message ?

-----------
Now, here is the explanation:

we definitely need the variable PlayerGoldState integer with arrray 12.
(or array 1, but you have to init them)
Trigger:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Set PlayerGoldState[(Integer A)] = 0


This variable will store the gold amount of players, so, when you add gold, set gold,.. (using Player - Set Property) you must also set this variable. like this:
Trigger:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Player - Set (Player((Integer A))) Current gold to 5000
      • Set PlayerGoldState[(Integer A)] = 5000

I set current gold of 12 players to 5000 and also PlayerGoldState[1 -> 12] to 5000
---
First, we work with items which are sold in merchant.
You see this trigger:
Trigger:
  • IOR Get Item Cost
    • Events
    • Conditions
    • Actions
      • Set ItemCost = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItemType Equal to Claws of Attack
        • Then - Actions
          • Set ItemCost = 800
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItemType Equal to Ring of Protection
        • Then - Actions
          • Set ItemCost = 350
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItemType Equal to Boots of Speed
        • Then - Actions
          • Set ItemCost = 150
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItemType Equal to Healing Salve
        • Then - Actions
          • Set ItemCost = 100
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItemType Equal to Clarity Potion
        • Then - Actions
          • Set ItemCost = 160
        • Else - Actions

before you run this trigger, you should set TempItemType to the type of item you need to check. The cost of item will be set to variable ItemCost
Code:
Set TempItemType = (Item-type of TempItem)
Trigger - Run IOR Get Item Cost <gen> (ignoring conditions)

When an item is sold, check the variable PlayerGoldState with the current gold amount of player 1 -> 12. If PlayerGoldState - current gold amount == ItemCost -> the player who lost the gold is the buyer. -> set custom value of the sold item to the buyer's player number.

Trigger:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Set TempPlayer = (Player((Integer A)))
      • Set TempInt = (TempPlayer Current gold)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PlayerGoldState[(Integer A)] - TempInt) Equal to ItemCost
        • Then - Actions
          • -------- we have found the buyer, set custom value of the item to his/her player number --------
          • Item - Set the custom value of TempItem to (Integer A)
          • Set PlayerGoldState[(Integer A)] = (TempPlayer Current gold)
        • Else - Actions

---
ok, now, I will assume items of Purchasable class are sharable and items of Miscellaneous class are muted items.
- with unsharable items, you will have to create two versions, a non-muted version and a muted version.
- with sharable items, of course you don't have to make a muted version.

the trigger IOR Get Muted Version and IOR Get non Muted Version just like IOR Get Item Cost, you set the variable TempItemType to the type of the item you want to get its muted/non muted version, and run the trigger, you will get the item type in TempItemVersion variable.

in the trigger: IOR Acquire Items
when a unit acquires an item, check its class, Purchasable -> it's a sharable item -> stop the trigger ( Skip remaining actions
)
if it is an unsharable item, continue checking:

if its class is... Unknown ( Unknowns is Miscellaneous, I don't know why I have to check Unknown for Miscellaneous :| ) -> it is a muted item -> check the owner. If the picker (unit who picked up the item - currently is TempUnit) is the owner, remove and add the non-muted version to picker.
if its class is not Unknown -> it is a non-muted item -> check owner, if the picker is not the owner, remove and add the muted version to picker.

---
the trigger IOR Sold Items and Unit Dies Set States are used to set the PlayerGoldState to the gold amount of the player who sells items, gets gold bounty.

-----------
In conclusion
if you want to create your own custom muted item, you have to:
- create two version of your item. a non muted and a muted version. muted version has class of Miscellaneous.
- go to trigger: IOR Get Item Cost to "register" the cost of the item, add:
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempItemType Equal to &lt;your item&gt;
    • Then - Actions
      • Set ItemCost = &lt;cost of the item&gt;
    • Else - Actions

- go to trigger: IOR Get Muted Version to "register" the muted version of the item.
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempItemType Equal to &lt;your item&gt;
    • Then - Actions
      • Set TempItemVersion = &lt;your item&#039;s muted version&gt;
    • Else - Actions

and IOR Get non Muted Version to "register" the non-muted version of the item.
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempItemType Equal to &lt;your item&#039;s muted version&gt;
    • Then - Actions
      • Set TempItemVersion = &lt;your item&gt;
    • Else - Actions


done ! :D

Note: about the "disabled icon" of the item, you would have to import them. For example: I use ReplaceableTextures\CommandButtonsDisabled\DISBTNBootsOfSpeed.blp for muted Boots of Speed -> so I have to import an icon: ReplaceableTextures\CommandButtonsDisabled\DISDISBTNBootsOfSpeed.blp
(sorry, the demo map does not have these icons, I'm a little lazy :rolleyes: )

how a muted item cant be sold

just set the field Stats - Can Be Sold to Merchants to False (in the demo map, I forgot this :p )
---------------------
I re-upload the demo map :)

EDIT: I reupload the demo map, fixed a pretty big bug :p
 

Attachments

  • [Demo] Item Owner Restriction 1.1.w3x
    19.7 KB · Views: 111

Frizz.Meister

New Member
Reaction score
0
Thanks a lot for the in depth explaination. Real big help You should make an official tutorial because im sure this would help a whole lot of people. Thanks again.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top