You think it'd be simple, but... (item ownership control)

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
I have Heroes, and I have Caches, so heroes can have extra space to store their loot.

All I want is a simple if/then/else where 'if' the owner of the item being dropped on the cache is NOT equal to the player who owns said cache, it spits the item back out.

I cannot figure out how to do this. Ridiculous, I know. :banghead:
 

Exide

I am amazingly focused right now!
Reaction score
448
I made a trigger for setting ownership in my current map, it works brilliantly. ^^
However it's in JASS, if you mind?

Either way, here it is:
JASS:

function Trig_Set_Item_Owner_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local player p = GetOwningPlayer(u)
    local item i = GetManipulatedItem()
    local player c = GetItemPlayer(i)
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    
    if (c == Player(15)) then
        call SetItemPlayer(i, p, false)
        set c = p
    endif
    
    if (c != p) then
        call UnitRemoveItem(u, i)
        call DisplayTextToPlayer(p, 0, 0, "|cffff0000This item does not belong to you!|r")
    endif
    
    set c = null
    set p = null
    set u = null
    set i = null
endfunction

//===========================================================================
function InitTrig_Set_Item_Owner takes nothing returns nothing
    local trigger Item_Owner = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( Item_Owner, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( Item_Owner, function Trig_Set_Item_Owner_Actions )
endfunction


EDIT: Then, all you need to do is to check if the owner is .... and do actions ...
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
I'm not running Newgen and have the JASS experience of a computer illiterate person :( am I still able to use that?

+rep for the assistance, regardless!
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
Oh, I have it! I just haven't ever used it... that makes me a noob, doesn't it?
 

Exide

I am amazingly focused right now!
Reaction score
448
I'm not running Newgen and have the JASS experience of a computer illiterate person :( am I still able to use that?

+rep for the assistance, regardless!

I don't use NewGen either. It works just fine with a "Vanilla" World Editor. :thup:
Simply create a trigger, name it Set Item Owner, convert it to custom text and paste my trigger in there. <3 JASS.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
It doesn't make you noob.
It just makes stuff easier and allows stuff the "vanilla" editor can't do ;) .
 

TwoHeadedBoy

New Member
Reaction score
6
What exactly does NewGen do? And does it work on a mac? If you are JASS illiterate, is there any point to newgen?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Look here.
I don't think it works on Mac's though.
And it definitely has a point;
It has highlightning which is like the best;
A function list, and a lot more.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top