Help: Lock items heroes allowed to use

TDestroyer

New Member
Reaction score
0
Hello, I'm trying to make an RPG, I have a class system in my game.

How do you make it so that 1 hero can only use certain items ex:

Archer can use bow and leather armor.
Mage can use staff and robe.
Fighter can use short sword and leather armor.
etc.

As you can see, in some cases, 2 of the heroes can use the same items, and other items are solely for 1 class.

I'm already using item level and custom value for items. I tried dealing with Tech Tree stuff but i couldn't get it to work anyone have any ideas?

I would like to avoid, if i can, making arrays for every hero of the weapons they can use if possible. if i have like 100 items and 20 classes that would be so many arrays it would be ridiculous.
 

cleeezzz

The Undead Ranger.
Reaction score
268
Trigger:
  • Footman + Knight + Mask of Death
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mask of Death
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Not equal to Footman
          • (Unit-type of (Triggering unit)) Not equal to Knight
    • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)


only allows footman and knight to use the item "mask of death," unfortunately, it will be painstaking to do a lot of items.
 

TDestroyer

New Member
Reaction score
0
Yeah i was hoping that there was some sort of catch all since i plan on having over 100 items but thanks alot, but ill only use that as a last resort. Though i can use that trick for multiple items that have the same class requirements but still will take very long time...
 

TDestroyer

New Member
Reaction score
0
If there was a way to make an array of variables i would be able to do this much more simply with all the classes. Now i have like 6 or 7 if then statements... Can u do that in JASS or something?
 

Summoned

New Member
Reaction score
51
If you have a method to use custom values of items, then it's very easy to let multiple classes use the item.

Just make a system where all the "point values" for the heroes are prime numbers. Then if an item is useable by 3 different heroes, etc., multiply their "point values" together and put that as the custom value of the item.

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Custom value of (Item being manipulated)) mod (Point-value of (Unit-type of (Triggering unit)))) Not equal to 0
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your Hero cannot us...
        • Else - Actions
          • Do nothing


An example, you have Bronze Bracers, which is useable by the fighter (point value 13), warrior (23), and barbarian (3), set the custom value for that item to 13 x 23 x 3 = 897.

Edit: In the above system, any hero/unit with a point value of 1 will be able to pick up/use any item.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
and any unit with a point value of 0 will crash the game? :p

Just add a condition: point value of unit not equal to 0
 

SwedishChef

New Member
Reaction score
32
This is how i did i my map. I divided the items which can be used be certain units in different shop. Then i only checked if selling units was the right one. Dont know if it will work for you though.
 

Teach101

New Member
Reaction score
4
you can just use the item class type. It has 6 or so usable things. be like 3 triggers total if you do it like that.
would allow you to have 3 wep requirements and 3 armor requirements.
 

TDestroyer

New Member
Reaction score
0
I used Summoned's idea but since i had custom values already used for the items i just used items life instead lol, and made all items invulnerable. Thanks for all your help. BTW my new RPG is called The Forgotten Realm, ive been testing with people online every once in a while if anyone wants to play let me know. Name: TDestroyer in game. Thanks for all your help
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top