Snippet Item Class Restrictions

M

MikeTheGuy

Guest
I was looking at all the other inventory systems and they all seemed to involve complicated things like finding substrings or making tons of triggers. This one is simple, only needs one trigger, and works perfectly.

The idea behind this is to make an inventory system by assigning each item class an item type (ie. sword, shield, helmet, etc.), and then restricting that item class. For example, Artifact: Helmet, Purchasable: Armor, Permanent: Weapon, Charged: Shield (or weapon 2 for weapon types like claws, etc.), Campaign: Legging, Miscellaneous: Boots. And then you could use Powerup for generic items like potions, quest items, etc. The item classes can be modified any way you wish as long as each one only contains one type of item, so you could use Miscellanous for generic items and Powerup for boots, if you wanted. This is the trigger:

PHP:
inventory
    Events
        Unit - A unit Acquires an item
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Item-class of (Item being manipulated)) Equal to Artifact
                (Item-class of (Item being manipulated)) Equal to Purchasable
                (Item-class of (Item being manipulated)) Equal to Permanent
                (Item-class of (Item being manipulated)) Equal to Charged
                (Item-class of (Item being manipulated)) Equal to Campaign
                (Item-class of (Item being manipulated)) Equal to Miscellaneous
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-class of (Item being manipulated))
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                        Game - Display to (All players) the text: Sorry, you can only...
                    Else - Actions

Credits to Ghan_04 for helping me figure it out. I did not look at any other inventory system while making this so if it is already done just say the word and I will delete this.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
>I will delete this.

Can you? I don't know if you have the ability. I'd like to know, though. There was a discussion about this on another forum.

Anyway, back on topic. What other systems did you look at? Are you sure you weren't looking at things like item stacking systems? It doesn't sound like they would need to be any more difficult than yours.
 
M

MikeTheGuy

Guest
I looked at the one by AceHart because I couldn't remember the one function of how to check if the item was in the hero's inventory, but other than that, no.

I really just made this as a time-saver, so you could make one trigger rather than making a base trigger and then copying it and modifying a whole bunch of times. I didn't mean those were more difficult than mine, it's just faster to create one trigger as opposed to multiple ones.
 

Tinki3

Special Member
Reaction score
418
>if it is already done just say the word

Well, it hasn't already been done with exactly the same triggers, but,
it has been done before in terms of, "a trigger that restricts items".

It's also more of a snippet, than a system, so I renamed the title's tag.
 
M

MikeTheGuy

Guest
Thanks, I didn't know what to call it so I just put "System".

Also, I meant that if there was already another trigger exactly like that one that I didn't know about, then just to tell me and I'd erase it out of my post.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top