HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item events and workarounds

10-30-2009, 09:28 AM#1
Anachron
Hey!

I am at the moment building an very big item system, including up to 682 items for every player (12 player) or more.

Thus I am needing to hide / drop the item on pickup.

Is it possible without triggering any of these events:
Collapse JASS:
            call TriggerRegisterPlayerUnitEvent(sys, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, b2)
            call TriggerRegisterPlayerUnitEvent(sys, Player(i), EVENT_PLAYER_UNIT_DROP_ITEM, b2)
            call TriggerRegisterPlayerUnitEvent(sys, Player(i), EVENT_PLAYER_UNIT_PAWN_ITEM, b2)
            call TriggerRegisterPlayerUnitEvent(sys, Player(i), EVENT_PLAYER_UNIT_USE_ITEM, b2)
To drop / hide the items so there is never the error: Your inventory is full, even after picking 6 items?

Thanks in advance.
10-30-2009, 09:37 AM#2
Saishy
You can use tomes to do that, players can grab tomes even if their inventories are full.

You would need 3 versions of the item:

- One unit version so the player can buy it at the store even if the inventory is full
- A tome version so the player can grab it from the floor even if the inventory is full
- A normal version so the item actually works in the inventory xD

Good luck o.o/
10-30-2009, 09:40 AM#3
Anachron
Yes, that exactly what I didn't want to do.

I can't use the dropping because the events are then fired, thus creating endless loop.

I can't disable the trigger which fires events because that library requires the other, which handles the inventory.
10-30-2009, 12:45 PM#4
Saishy
Quote:
Originally Posted by Anachron
Yes, that exactly what I didn't want to do.

I can't use the dropping because the events are then fired, thus creating endless loop.

I can't disable the trigger which fires events because that library requires the other, which handles the inventory.
The workaround is making all tomes powerups and make the trigger ignore powerups.
It worked for me.

Edit: Uhm, you can't "drop" a tome, they disappear when you try to get them o.o
10-30-2009, 02:06 PM#5
grim001
Quote:
Originally Posted by Anachron
I can't disable the trigger which fires events because that library requires the other, which handles the inventory.

You can use call DisableTrigger(GetTriggeringTrigger()).
10-30-2009, 07:06 PM#6
Saishy
Quote:
Originally Posted by grim001
You can use call DisableTrigger(GetTriggeringTrigger()).
I will assume you are kidding xD

He can't disable it because another trigger requires it to run.
10-30-2009, 08:14 PM#7
grim001
Quote:
Originally Posted by Saishy
I will assume you are kidding xD

He can't disable it because another trigger requires it to run.

He can use EnableTrigger(GetTriggeringTrigger()) after whatever was triggering the infinite loop.
10-30-2009, 09:23 PM#8
Saishy
Quote:
Originally Posted by grim001
He can use EnableTrigger(GetTriggeringTrigger()) after whatever was triggering the infinite loop.
How are you going to stop the infinite loop after its starts?
10-30-2009, 09:29 PM#9
Here-b-Trollz
It doesn't start. That was the point of DisableTrigger(GetTriggeringTrigger()).
10-31-2009, 02:23 AM#10
Saishy
Quote:
Originally Posted by Here-b-Trollz
It doesn't start. That was the point of DisableTrigger(GetTriggeringTrigger()).
But... how are you going to detect the hero is going to drop a item, so he can disable the other trigger if both triggers run on item drops?
10-31-2009, 02:31 AM#11
Rising_Dusk
You design the systems intelligently so that one trigger runs after the other.
11-02-2009, 07:45 AM#12
Anachron
Well basicly I have this:

Library A

Library B requires Library A
(has the trigger).


Now Library A is able to drop the item, but
that library does not know about Library B's Trigger.
11-02-2009, 01:55 PM#13
Rising_Dusk
It sounds like library A should be merged with library B, then.
11-02-2009, 02:03 PM#14
Anachron
Nope, Library A is completely different to Library B, but uses the drop action.

I solved it. My Library A now has a dummy trigger that will be overwritten by Library B.