• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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.
Top