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.
 
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 :).
 
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?
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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