- Joined
- Jul 12, 2004
- Messages
- 4
i am using a predone bagsystem and want to modify it but when i tired i crashed the trigger
reason i want to midify it is becuase i have a 1 weapon/armor/amulet rule per hero and want to restrict what can be put into a bag
i am pretty new to jass but not to java or basic any help would be apreciated
reason i want to midify it is becuase i have a 1 weapon/armor/amulet rule per hero and want to restrict what can be put into a bag
Code:
function Trig_pick_one_up_Actions takes nothing returns nothing
local string s=GetHerostr(GetManipulatingUnit())
local integer it=bp()
local integer slot=GetSlot(GetManipulatingUnit(),GetManipulatedItem())
local string bps=GetBPStr(GetManipulatedItem())
if(GetItemTypeId(GetManipulatedItem())==it)then
call SetItemInvulnerableBJ( GetManipulatedItem(), true )
if(GetState(s)==0 and GetBps(s)=="")then
if(bps!="")then
call SetBps(s,bps)
else
set bps=CreateBPStr(GetManipulatedItem())
call SetBps(s,bps)
endif
call SetPos(s,slot)
elseif(s!="" and GetBps(s)!="" and GetState(s)==0)then
call UnitRemoveItem(GetManipulatingUnit(),GetManipulatedItem())
call SimError( GetOwningPlayer( GetManipulatingUnit() ), "You can't hold two backpacks!")
elseif(s=="" and IsUnitType(GetManipulatingUnit(), UNIT_TYPE_HERO) and not( IsUnitHidden(GetManipulatingUnit() )))then
call CreateHerostr(GetManipulatingUnit())
endif
endif
endfunction
//===========================================================================
function InitTrig_pick_one_up takes nothing returns nothing
set gg_trg_pick_one_up = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_pick_one_up, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_pick_one_up, function Trig_pick_one_up_Actions )
endfunction