• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Item Charges problem

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi there!
I have a problem with item charges. Take a look please:
Tell me where I have a mistake?
  • aquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bag of Carrots
        • Then - 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
                  • (Charges remaining in (Item being manipulated)) Equal to 1
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                      • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                      • ((Triggering unit) has an item of type Bag of Carrots) Equal to True
                    • Then - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Int = 0
                      • Set Carrots_Owner = (Triggering unit)
                      • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + 1)
                      • Item - Remove (Item being manipulated)
                      • Unit - Add Weight 5 hero to (Triggering unit)
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
                    • Else - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Int = 0
                      • Set Carrots_Owner = (Triggering unit)
                      • Unit - Add Weight 5 hero to (Triggering unit)
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item being manipulated)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                      • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                      • ((Triggering unit) has an item of type Bag of Carrots) Equal to True
                    • Then - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Int = (Charges remaining in (Item being manipulated))
                      • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                      • Item - Remove (Item being manipulated)
                      • Unit - Add Weight 5 hero to Carrots_Owner
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
                    • Else - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Int = (Charges remaining in (Item being manipulated))
                      • Unit - Add Weight 5 hero to Carrots_Owner
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to ((Charges remaining in (Item being manipulated)) + 0)
        • Else - Actions
  • lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bag of Carrots
        • Then - Actions
          • Set Carrots_Int = 0
          • Unit - Remove Weight 5 hero from (Triggering unit)
        • Else - Actions
  • sell
    • Events
      • Unit - A unit Pawns an item (to shop)
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Bag of Carrots
        • Then - Actions
          • Set Carrots_Int = 0
          • Unit - Remove Weight 5 hero from (Triggering unit)
        • Else - Actions
 

EdgeOfChaos

E

EdgeOfChaos

Can you explain what the purpose of this is, and what the problem is?
 
Level 10
Joined
Mar 17, 2012
Messages
579
Can you explain what the purpose of this is, and what the problem is?

Sorry, I was very hurry so I didn't have time to do it :)
Hero picks up an item (Bag of Carrots) and it have to stack charges if he picks up the same item. Every stack have to reduce his agility by 5 (weight 5 kg).

The problem is that it doesn't work properly.
 
Level 3
Joined
Jul 16, 2014
Messages
63
It can probably be done a lot easier bro, depending on your map.
Is this trigger only supposed to work for that single item-tyoe(bag of carrots)?
Does each player only control 1 unit with an inventory or several?
 
Level 3
Joined
Jul 16, 2014
Messages
63
Which part of the trigger isn't working?
Is the item not stacking?
Does the unit not lose the agility that it's supposed to?
Does the unit not gain agility when selling/dropping the item?
Or all of the above? :b

Could look through the entire trigger, but would be way faster if we knew what to look for :)
 
Level 10
Joined
Mar 17, 2012
Messages
579
Which part of the trigger isn't working?
Is the item not stacking?
Does the unit not lose the agility that it's supposed to?
Does the unit not gain agility when selling/dropping the item?
Or all of the above? :b

Could look through the entire trigger, but would be way faster if we knew what to look for :)

Item is stacking :D
Unit doesn't have to lose an agility, it have to gain an ability "Attribute bonus" that has -5/-10/-15... agility.
When the hero picks un an item - ability is given once and that's all

UPDATE:

Solved:


  • aquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bag of Carrots
        • Then - 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
                  • (Charges remaining in (Item being manipulated)) Equal to 1
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                      • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                    • Then - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Owner = (Triggering unit)
                      • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + 1)
                      • Item - Remove (Item being manipulated)
                      • Unit - Add Weight 5 hero to (Triggering unit)
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
                    • Else - Actions
                      • Set Carrots_Triggered = (Item being manipulated)
                      • Set Carrots_Owner = (Triggering unit)
                      • Unit - Add Weight 5 hero to (Triggering unit)
                      • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item being manipulated)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Charges remaining in (Item being manipulated)) Greater than 1
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Bag of Carrots
                          • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                        • Then - Actions
                          • Set Carrots_Owner = (Triggering unit)
                          • Set Carrots_Triggered = (Item being manipulated)
                          • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                          • Item - Remove (Item being manipulated)
                          • Unit - Add Weight 5 hero to Carrots_Owner
                          • Unit - Set level of Weight 5 hero for Carrots_Owner to (0 + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
                        • Else - Actions
                          • Set Carrots_Owner = (Triggering unit)
                          • Set Carrots_Triggered = (Item being manipulated)
                          • Unit - Add Weight 5 hero to Carrots_Owner
                          • Unit - Set level of Weight 5 hero for Carrots_Owner to ((Charges remaining in (Item being manipulated)) + 0)
                    • Else - Actions
        • Else - Actions
  • lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Bag of Carrots
        • Then - Actions
          • Unit - Remove Weight 5 hero from (Triggering unit)
        • Else - Actions
  • sell
    • Events
      • Unit - A unit Pawns an item (to shop)
    • Conditions
    • Actions
      • -------- Bag of Carrots --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Bag of Carrots
        • Then - Actions
          • Unit - Remove Weight 5 hero from (Triggering unit)
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top