- Joined
- Sep 11, 2006
- Messages
- 172
I've been working on an item system that prevents heroes from picking up more than one type of item. I've set item levels for all my equipment categories, and have tried to set up a trigger that has conditions for the item's level.
I put a test message into the trigger to see what the value of the item variable was and it was counting items in the inventory twice. To fix this, I added a function that subtracted 1 from the variable after the inventory count loop. This seemed to work at first until I realized that it was still counting every item I picked up despite its item level.
The condition
-
Mono
-
Events
- Unit - A unit Acquires an item
- Conditions
-
Actions
- Set Item = 0
-
For each (Integer LoopIndex[1]) from 1 to 6, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Item level of (Item carried by (Hero manipulating item) in slot LoopIndex[1])) Equal to (Item level of (Item being manipulated))
-
Then - Actions
- Set Item = (Item + 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Item Greater than 1
-
Then - Actions
- Hero - Drop (Item being manipulated) from (Hero manipulating item)
- Game - Display to (All players) the text: You may only carry ...
- Else - Actions
-
If - Conditions
- Trigger - Run Item Check <gen> (ignoring conditions)
-
Events
I put a test message into the trigger to see what the value of the item variable was and it was counting items in the inventory twice. To fix this, I added a function that subtracted 1 from the variable after the inventory count loop. This seemed to work at first until I realized that it was still counting every item I picked up despite its item level.
-
Mono
-
Events
- Unit - A unit Acquires an item
- Conditions
-
Actions
- Set Item = 0
-
For each (Integer LoopIndex[1]) from 1 to 6, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Item level of (Item carried by (Hero manipulating item) in slot LoopIndex[1])) Equal to (Item level of (Item being manipulated))
-
Then - Actions
- Set Item = (Item + 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Set Item = (Item - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Item Greater than 1
-
Then - Actions
- Game - Display to (All players) the text: (String(Item))
- Hero - Drop (Item being manipulated) from (Hero manipulating item)
- Game - Display to (All players) the text: You may only carry ...
- Else - Actions
-
If - Conditions
- Trigger - Run Item Check <gen> (ignoring conditions)
-
Events
The condition
- (Item level of (Item carried by (Hero manipulating item) in slot LoopIndex[1])) Equal to (Item level of (Item being manipulated))