• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Jass/GUI How do i make it so players cant move items in there inv.

Status
Not open for further replies.
Here's a trigger in jass that do that :

JASS:
function Trig_CatchInvOrder_Conditions takes nothing returns boolean
    return GetIssuedOrderId()>=852002 and GetIssuedOrderId()<=852007
endfunction

function Trig_CatchInvOrder_Actions takes nothing returns nothing
    call PauseUnit(GetTriggerUnit(),true)
    call IssueImmediateOrderById(GetTriggerUnit(),851973)
    call PauseUnit(GetTriggerUnit(),false)
endfunction

//===========================================================================
function InitTrig_CatchInvOrder takes nothing returns nothing
    set gg_trg_CatchInvOrder = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_CatchInvOrder, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddCondition( gg_trg_CatchInvOrder, Condition( function Trig_CatchInvOrder_Conditions ) )
    call TriggerAddAction( gg_trg_CatchInvOrder, function Trig_CatchInvOrder_Actions )
endfunction

You have to create a trigger called "CatchInvOrder", convert it into custom script and paste the code inside :wink:.

EDIT : You also have to disable this trigger when you use the action "Order unit to move item to inventory slot". Just disable before the action and enable just after.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
The order IDs 852002 to 852007 are for inventory movement orders. If you select an item and try to move it to a slot, you will be able to determine which slot the item was moved to by subtracting by 852002 from the order ID.

In order to reference the item that was "ordered" to another inventory position you can simply use GetOrderTargetItem( ).
 
Level 4
Joined
May 20, 2008
Messages
89
[trigger=My Trigger]Disable item drops for Hero
Events
Conditions
Actions
For each integer (Integer A) 1 to 6 do Actions:
Item - Make (Item carried by Hero in inventory slot (For loop Integer A)) undroppable.[/trigger]

+rep me if i helped :thumbs_up:
 
Level 6
Joined
Oct 10, 2009
Messages
1,425
Skore_sM
Never ask for rep.
It's actually against the rules.

@ pRo.MAPMAKER
Anyways(if I understand your problem), you're using the custom script function, in GUI. which you shouldn't be doing.

Go to the trigger and do, Edit->Convert to custom text.->then remove everything in the box that will pop up where your trigger once was -> then copy the code he gave you.
 
Status
Not open for further replies.
Top