• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Item bound

Status
Not open for further replies.
Level 5
Joined
Jan 19, 2020
Messages
102
i want add a item bound system that
binds item when a player type -save
binds item when a player types load on his load character

my current look like this

  1. //TESH.scrollpos=1
  2. //TESH.alwaysfold=0
  3. library ItemBinding initializer init
  4. private function pickupItem takes nothing returns nothing
  5. local item i = GetManipulatedItem()
  6. local unit u = GetTriggerUnit()
  7. // check if item is bound
  8. if GetItemUserData(i) == 0 then
  9. // not bound, bind it
  10. call SetItemUserData(i, GetPlayerId(GetOwningPlayer(u))+1)
  11. else
  12. // bound
  13. if GetItemUserData(i) != GetPlayerId(GetOwningPlayer(u))+1 then
  14. call UnitDropItemPoint(u, i, GetUnitX(u), GetUnitY(u))
  15. call DisplayTextToPlayer(GetOwningPlayer(u), 0., 0., "This item is bound")
  16. endif
  17. endif
  18. endfunction
  19. private function init takes nothing returns nothing
  20. set gg_trg_Item_Binding = CreateTrigger( )
  21. call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Binding, EVENT_PLAYER_UNIT_PICKUP_ITEM)
  22. call TriggerAddAction(gg_trg_Item_Binding, function pickupItem)
  23. endfunction
  24. endlibrary

can someone change it?
 
Status
Not open for further replies.
Back
Top