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

if player p == no player

Status
Not open for further replies.
Level 12
Joined
Mar 24, 2011
Messages
1,082
What...
1.Player P is not assigned variable ?
2.Player P is not playing ?
3.Player P is not equal to player №X ?
4.Get only Player P and do stuff for him ?

By the title I suppose you want 1. but the rest... got it messed.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
I don't know it is working propery for me, this is what I try to do. It is supposed to protect items from other players.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local player owner = GetOwningPlayer(u)
      • Custom script: local integer h = GetHandleId(u)
      • Custom script: call SavePlayerHandle(udg_hash, h, 1, owner)
  • Untitled Trigger 003
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer h = GetHandleId(u)
      • Custom script: local player owner = LoadPlayerHandle(udg_hash, h, 1)
      • Custom script: if owner == null then
      • Custom script: call SavePlayerHandle(udg_hash, h, 1, owner)
      • Custom script: else
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Custom script: endif
the hashtable is in a init trigger ofc
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
well first of all, the item loses trigger is completely worthless

second of all,

  • Untitled Trigger 003
  • Events
    • Unit - A unit Acquires an item
  • Conditions
  • Actions
    • Custom script: local integer i = GetItemUserData(GetManipulatedItem())
    • Custom script: local integer i2 = GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1
    • Custom script: if i == 0 then
    • Custom script: call SetItemUserData(GetManipulatedItem(), i2)
    • Custom script: elseif i != i2 then
    • Hero - Drop (Item being manipulated) from (Triggering unit)
    • Custom script: endif
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
!= stands for Not Equal To

try to put some debugs in? should work... my item claim system is way more complicated cuz its not normal wc3 inventory
 
Status
Not open for further replies.
Top