• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Restacking apples

Status
Not open for further replies.
Level 30
Joined
Jul 23, 2009
Messages
1,029
So I am trying to make a little system that makes apples stack together when picked up but im not very good a GUI so I need some help on this one :/

  • Stack apples
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Apple
    • Actions
      • Set Apples = (Apples + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Apples Greater than 1
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Item - Set charges remaining in Apple_item to ((Charges remaining in Apple_item) + 1)
        • Else - Actions
          • Set Apple_item = (Item being manipulated)
For some reason when the unit uses an apple from the stack it makes the whole stack disappear so I tried to make this trigger below to remake the stack with a fixed number of charges depending on the number of the "apples" integer wich increases by 1 and when an apple is picked up and should decrease when an apple is used/dropped :(

  • Reduce apples
    • Events
      • Unit - A unit Uses an item
      • Unit - A unit Loses an item
    • Conditions
      • (Hero manipulating item) Equal to Hero
      • (Item-type of (Item being manipulated)) Equal to Apple
      • Apples Greater than 1
    • Actions
      • Set Apples = (Apples - 1)
      • Hero - Create Apple and give it to Hero
      • Set Apple_item = (Last created item)
      • Item - Set charges remaining in Apple_item to Apples
What happens is: When picking up the apples only 1 can go into the inventory, the rest just appear on the ground around the hero...
 
Level 1
Joined
Jun 13, 2010
Messages
5
  • Events
    • Unit - A unit Loses an item
I think the problem is this condition. Because when you remove the apple from game, the hero loses the apple. So you can remove this event, or add 2 to the apple count in Trigger 1
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Hmm I tried this "system" - maybe it's something like that you need?:

  • JummieApple
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Apple
    • Actions
      • Set AppleAmount[(Player number of (Owner of (Triggering unit)))] = (AppleAmount[(Player number of (Owner of (Triggering unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AppleAmount[(Player number of (Owner of (Triggering unit)))] Equal to 1
        • Then - Actions
          • Set AppleItem[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Item - Remove (Last dropped item)
          • Item - Set charges remaining in AppleItem[(Player number of (Owner of (Triggering unit)))] to (AppleAmount[(Player number of (Owner of (Triggering unit)))] + 1)
Greetings
~ The Bomb King > Dr. Boom
 
Status
Not open for further replies.
Top