| 08-01-2004, 10:21 AM | #1 |
Is there any way I can detect if a hero's invetory is full? I'm looking for something like: Condition: (Inventory of (Triggering Unit)) Equal to Full yada yada...etc if possible... |
| 08-01-2004, 12:50 PM | #2 |
Easily, just not the way you expected. Variables - slotsfull - integer Code:
For each integer A from 1 to 6 if/then/else multiple conditions If - Conditions Item in slot (integer A) of (Your Hero) Not equal to (empty) Then - Actions slotsfull = slotsfull + 1 Else - Actions if/then/else multiple conditions If - Conditions Slotsfull = 6 Then - Actions //do whatever you want to here if they have their inventory full. Else - Actions |
| 08-01-2004, 03:41 PM | #3 |
Not knocking on your code or anything, but just FYI, you can combine that into one trigger like this: Code:
Actions:
For each integer 1-6 do:
If- Condition: Item in slot (integer A) of (Your Hero) equal to (empty)
Then do: Trigger- Skip remaining actions
Else do: Do nothing
<add actual inventory is full actions here>Just thought I'd share some programming tricks that reduce CPU load and code length. |
| 08-01-2004, 08:08 PM | #4 |
sweet, thanks guys! |
| 08-01-2004, 10:56 PM | #5 |
Or the easier: local item it=CreateItem('ratf') if(UnitAddItem(udg_unit, it) then call RemoveItem(it) //Units inventory is not full else call RemoveItem(it) //Units inventory is full |
| 08-01-2004, 11:50 PM | #6 |
Obviously weaddar is more experienced at coding :) But that trigger might interfere with other triggers. |
| 08-02-2004, 02:22 AM | #7 |
Not to mention the workaround (I generally hate workarounds). :) |
