# Item Charges problem

Status
Not open for further replies.

#### ZiGOR

Level 10
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

E

#### EdgeOfChaos

Can you explain what the purpose of this is, and what the problem is?

#### ZiGOR

Level 10
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.

#### shaMewalkeR

Level 3
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?

#### ZiGOR

Level 10
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?

Yes. The trigger is supposed to work for that item and yes, each player controls only one hero

#### shaMewalkeR

Level 3
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

#### ZiGOR

Level 10
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
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.

Replies
8
Views
1K
Replies
1
Views
614
Replies
3
Views
623
Replies
2
Views
681
Replies
2
Views
781