1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  4. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  5. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  6. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  7. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Item-drop-system

Discussion in 'Trigger (GUI) Editor Tutorials' started by SlayerII, Mar 6, 2009.

  1. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Only 1 item of every type- the item-drop system

    only 1 item of every type- the Item-drop-system

    I know there is already a tutorial about this somewhere but if you follow it correctly you would need for every item class as many triggers as players are aviable. So 5 itemclasses*8players=40Triggers.
    I was able do that in one trigger.(without jass and only 1 variable):grin:


    What is a item-drop-system?

    If you ever have played one of the (o)rpg's you know that you are only allowed to carry only 1 item per type. So if you have 2 weapons 1 will be dropped and a message apears.In my system you are able to have 6 items classes.

    How to start?


    First of all you have to decide which item classes you will need.Lets say: weapon,offhand,armor,helmet,boots.
    There are some standard item classes(called permanent ,campaign etc...). Now you just have to give them new names(note: only in your head they still have their names). So all weapons are artifacts, all armors are campaign etc... . Now give all your items their item class.
    In this case every time you create a weapon you have to give it the class artifact.
    Then you have to make a integer variable named item_integer.
    (Thanks septimus for this)

    The trigger

    • test all in one Copy
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Item-class of (Item being manipulated)) Equal to Permanent
            • (Item-class of (Item being manipulated)) Equal to Artifact
            • (Item-class of (Item being manipulated)) Equal to Charged
            • (Item-class of (Item being manipulated)) Equal to Campaign
      • Actions
        • Set iteminteger = 0
        • 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))
              • Then - Actions
                • Set iteminteger = (iteminteger + 1)
              • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • iteminteger Greater than 1
          • Then - Actions
            • Hero - Drop (Item being manipulated) from (Hero manipulating item)
            • Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
          • Else - Actions


    What have we done? First off all we made a event and some conditions. This will make the trigger fire every time a hero acquieres a item which have one of the classes in the conditions. If you don't understand this please go to a easier tutorial.


    The next step is to set our integer to 0. Wy? Cause we change it in the trigger, but need it as 0 again when the trigger fires again.

    • Set iteminteger = 0


    Now lets start the important step.Now we make a loop which cheks the inventory for items with the same class as the acquired item. everytime it found a item our integer is growing bigger. So at least 1 time cause of the item itself.
    • 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))
          • Then - Actions
            • Set iteminteger = (iteminteger + 1)
          • Else - Actions


    After this our integer could be only 1 or 2.
    Now ,depending on the integer, we do nothing(integer=1) or we make the acquired item drop(integer=2).

    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • iteminteger Greater than 1
      • Then - Actions
        • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
      • Else - Actions


    Don't forget a nice message like: You cant carry 2 items of the same class.

    Hope everything is clear.
     
    Last edited: Dec 6, 2009
  2. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,176
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    I would give 3 reason of why this tutorial would likely to be rejected.

    1) Lot's of spelling/grammar error.
    2) There is a existense of such a tutorial.
    3) The trigger wasn't at optimize and most efficient way.

    Making it this way is much efficient and smooth.

    • Melee Initialization
      • Events
        • Unit - A unit Acquires an item
      • Conditions
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Item-class of (Item being manipulated)) Equal to Permanent
          • Then - Actions
            • Set Item_Integer = 0
            • For each (Integer Slot_Integer) 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 Slot_Integer)) Equal to Permanent
                  • Then - Actions
                    • Set Item_Integer = (Item_Integer + 1)
                  • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Item_Integer Greater than 1
              • Then - Actions
                • Hero - Drop (Item being manipulated) from (Hero manipulating item)
              • Else - Actions
          • Else - Actions
     
  3. Just_Spectating

    Just_Spectating

    Joined:
    May 16, 2007
    Messages:
    7,023
    Resources:
    46
    Models:
    11
    Icons:
    9
    Skins:
    26
    Resources:
    46
    i also made a system similar to this you can find linked in my sig.
     
  4. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    @septimus

    1) ok i try to make this better today.
    2) I said this at the beginning of my tutorial.(i only found TaaZ's one)
    3) nice trigger but in that case i would have to copy it and change it for evry class. But i m going to test your idea with the integer instead of the bolean which should make the trigger even shorter and smoother. Ty for your ggod reply.
    You forgot the message :wink:

    Little question to you; is the Slot_item integer more efficent as the A integer at the loop?
     
    Last edited: Mar 8, 2009
  5. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,176
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    They are both the same. However, it was always recommend to make variable integer for it.

    It was quite difficult to be explain, to make it simple. I would just said "You cannot have your cake and eat it at the same time"

    Ask Dr Super Good about it, he can elaborate about this matter better than I do.
     
  6. Grantclan

    Grantclan

    Joined:
    Aug 7, 2008
    Messages:
    87
    Resources:
    0
    Resources:
    0
    i did everything this said and it still didnt work
     
  7. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    it works proberly for me and everyone i know that he is using it maybe you made a msitake
     
    Last edited: Jun 10, 2009
  8. Ricardo Irving

    Ricardo Irving

    Joined:
    May 10, 2009
    Messages:
    493
    Resources:
    0
    Resources:
    0
    A mistake? This is almost the same style of inventory I was gonna use for my canceled ORPG - and I made lots of mistakes.

    Try this (note, not sure if it will work...): In lose item trigger, turn off acquire item trigger, then turn on acquire trigger to prevent getting 2 of a kind able to be picked up. And, In acquire item trigger, turn off lose item trigger then turn on lose item trigger.
     
  9. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    im not sure is this a write palace to post but.....

    is it possible to drop item being manipulated if he already has one of that (item being manipulated in his inventory?

    so you stop heroes from having 2 same item type in inventory
     
  10. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Thats exactly what the tutorial tries to teach you :con:
     
  11. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    sry,i didn´t read it at all xD

    i did my trigger on this way i think its good

    • HERO ACQUIRES AN ITEM
      • Events
        • Unit - A unit Acquires an item
      • Conditions
      • Actions
        • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Hero manipulating item) has an item of type (Item-type of (Last dropped item))) Not equal to True
          • Then - Actions
            • Set HERO = (Hero manipulating item)
            • Trigger - Run GIVE ITEM <gen> (checking conditions)
          • Else - Actions
            • Set PLAYER_G = (Player group((Owner of (Hero manipulating item))))
            • Game - Display to PLAYER_G the text: You cannot have 2 items of same type!
            • Custom script: call DestroyForce(udg_PLAYER_G)


    • GIVE ITEM
      • Events
      • Conditions
      • Actions
        • Trigger - Turn off HERO ACQUIRES <gen>
        • Hero - Give (Last dropped item) to HERO
        • Trigger - Turn on HERO ACQUIRES <gen>
     
  12. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    i would add a contidion to avoid droping consumables.
    and there shouldn't be a problem writing all in one trigger instead of using the run trigger function-there is no problem turning off the whole trigger .
    In this case you also dont have use variables.
    (players dont leak so you dont have to save him in a player group)

    ermm and your trigger only drops if its exactly the same item if you want to drop for example a item of the same class lets say weapon you have to use my trigger at the begiining but maybe thats noz what you want.
     
  13. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    i tried doing it all in one trigger but it cant work,all i get is fast crashing of warcraft
    its because without turn off,on action trigger is runing 10000 times second

    (condition- (hero manipulating) an item has an item of type (last dropped item) didnt work too)
     
  14. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    i write it wait shortly...
    edit:
    • Untitled Trigger 005
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • -------- whatever you want... --------
      • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Triggering unit) has an item of type (Item-type of (Last dropped item))) Equal to True
          • Then - Actions
            • -------- message and that it was.... --------
          • Else - Actions
            • Trigger - Turn off (This trigger)
            • Hero - Give (Last dropped item) to (Triggering unit)
            • Trigger - Turn on (This trigger)


    Thsis hould work-outherwise try out my trigger in the tutrial but use item type instaed of item class
     
  15. ALiEN95

    ALiEN95

    Joined:
    Mar 4, 2009
    Messages:
    1,148
    Resources:
    1
    Spells:
    1
    Resources:
    1
    warcraft crash.....

    BTW are you sure player groups don´t leak?,lot of people said that they do
    i also don´t believe sound can leak -.-
     
  16. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Player gruo leaks but single players dont do so far i know
    and well try to use my trigger from the tuturial and just change the item class thing to item type thing if you want. Jsut tried a smaller verison for you but looks like the contition really crashes
     
  17. Ricardo Irving

    Ricardo Irving

    Joined:
    May 10, 2009
    Messages:
    493
    Resources:
    0
    Resources:
    0
    I used a system like this (only it had pickup and drop item triggers, two triggers in total) for my cancelled ORPG: Isles of Occturra.
     
  18. Noobsmoke

    Noobsmoke

    Joined:
    Nov 20, 2007
    Messages:
    631
    Resources:
    1
    Spells:
    1
    Resources:
    1
    this is an very easy trigger
     
  19. Blaxor

    Blaxor

    Joined:
    Sep 6, 2008
    Messages:
    411
    Resources:
    7
    Models:
    1
    Icons:
    6
    Resources:
    7
    Nice and easy to follow tutorial, was way easier and efficient than the inventory system I did once when I was working on a RPG (Still have the map but I'm going to start over once I'm "done" with my hero arena)
     
  20. SlayerII

    SlayerII

    Joined:
    Aug 21, 2008
    Messages:
    526
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Name which is shown at tutorials is very bad, but i cant change it. Maybe someone help me to change name to current title