Restriction of Items: 1Sword, 1shield...

power

New Member
Reaction score
3
Hey,

I am working on an RPG and I don't want a unit to be able to hold to shields or to of the same class of item. Aka you can only have 1 charged item (Sword). I have a trigger that i was told works but it doesnt seem to. Can anyone either tell me why it isn't working or give me a trigger that does work.

Code:
Miscellaneous item
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Miscellaneous
    Actions
        Unit - Order (Hero manipulating item) to move (Item being manipulated) to inventory slot 1
        Wait 0.01 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Item-class of (Item carried by (Hero manipulating item) in slot 2)) Equal to Miscellaneous
                        (Item-class of (Item carried by (Hero manipulating item) in slot 5)) Equal to Miscellaneous
                        (Item-class of (Item carried by (Hero manipulating item) in slot 3)) Equal to Miscellaneous
                        (Item-class of (Item carried by (Hero manipulating item) in slot 4)) Equal to Miscellaneous
                        (Item-class of (Item carried by (Hero manipulating item) in slot 6)) Equal to Miscellaneous
            Then - Actions
                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: You can only wield ...
            Else - Actions
                Do nothing

The items are miscellaneous so I don't see what the problem would be.

Anyway, if anyone could help me, I would appreciate that and +rep.
 

power

New Member
Reaction score
3
I got this trigger form there and I understand it, except for the fact that it doesnt work... But its exactly - I even check it when copied in text. This is why I am asking. I'll still check some more parts of the site to find what I need. Otherwise, in the meantime any help would be great :).
 

Tinki3

Special Member
Reaction score
418
I don't like the look of that trigger, and for the record, the class "Miscellaneous" didn't work for me either.

So I tried using "Permanent", instead, and it worked :)

And now I've created a simple system that is very easy to work with :shades:

This trigger tells the game whether or not to let the hero keep the manipulated item. 'Item_Count' is increased by +1 every time the hero acquires the matching item, just so we can use that value later.
Code:
Acquire Item
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Permanent
    Actions
        Set Item_Count[(Player number of (Owner of (Hero manipulating item)))] = (Item_Count[(Player number of (Owner of (Hero manipulating item)))] + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Item_Count[(Player number of (Owner of (Hero manipulating item)))] Greater than 1
            Then - Actions
                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: You can only wield ...
            Else - Actions
                Game - Display to (All players) the text: You can wield...

This trigger decreases the Item_Count value by -1(for that player) when a hero drops a permanent-classed item, so that that variable's value cannot become greater than 2, for obvious reasons.
Code:
Drop Item
    Events
        Unit - A unit Loses an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Permanent
    Actions
        Set Item_Count[(Player number of (Owner of (Hero manipulating item)))] = (Item_Count[(Player number of (Owner of (Hero manipulating item)))] - 1)

I hope this will work for you, maybe use a different class for you swords and shields?
 

DuckieKing

Elitist Through and Through
Reaction score
51
If you use widget HP instead of classification, you can have practically unlimited numbers of item types.
Won't work if the item has been attacked, so either keep the item HP very low or stop players from attacking items.
Item - Item Life in Real Comparison
 
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