Special game events

Kajik

New Member
Reaction score
4
Hello,
there are some events in game, which I can't register to trigger (I am making map in JASS). I wonder if there is a way to catch the moment, when a player RIGHT-CLICK to item in his inventory (as he wants to drop him or move to another inventory slot). Or am I able to recognize, if player clicked on trackable with left or right mouse button?? Any toughts?
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
You don't have to use trackables for that, it's quite simple..

JASS:
scope test initializer init

    private function actions takes nothing returns nothing
        call DisplayTextToPlayer( GetOwningPlayer( GetTriggerUnit() ), 0, 0, I2S( GetIssuedOrderId() ) )
    endfunction

    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
        call TriggerAddAction( t, function actions )
    endfunction
    
endscope


Enable this script and swap items in your inventory, you'll see an order ID and you need to write that down somewhere.. Next time, using GetIssuedOrderId() you can compare the orders and.. do your thing.

Edit:
Each inventory slot has it's own order id.
 

Kajik

New Member
Reaction score
4
I think that trigger would fire when you (as a player) DROP already picked item into another inventory slot (or even the same slot). But I need to fire a trigger immediatelly after you PICK the item up (by right clicking it). By "picking it up" I don't mean picking it from ground to inventory, but to pick item which is already in your inventory.
Lets say you want to move item from inventory slot 1 to inventory slot 2:
* You right-click the item in slot 1
// NOW I want my trigger to fire
* You left click slot 2, item will move there and ISSUED_ORDER event is generated, but thats too late for me...

I hope you can imagine what I am trying to explain...
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
I know what you're trying to do, but it can't be done. Because nothing has been ordered, there is simply no way to prevent it but making an item unable to be moved from the inventory slot.

I posted the wrong event type, EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER would have displayed those messages for you.
It's the best I can do for you, I hope it still helps.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Here, this thread shows how to stack items, but more importantly, it has a function where you double-right click on an item. If you disassemble that, you should find what you're looking for.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Trackables are still unfinished, once created they cannot be removed however they can be "disabled". But this only works in the ingame screen, not the hero's inventory.
 

Kajik

New Member
Reaction score
4
Trackables are still unfinished, once created they cannot be removed however they can be "disabled". But this only works in the ingame screen, not the hero's inventory.

Yep, I know that. It was another question (not conected with inventory issue). The main idea was that there are some events in game (for example right clicking the item in inventory) which the game itself can recognise, but I don't know how to catch them in JASS (if it is even possible).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top