Name | Type | is_array | initial_value |
AccelerationFactor | integer | No | |
Caster | unit | No | |
Count | integer | No | |
Horde_char_Select | sound | No | |
InitialUnit | unit | Yes | |
Jumpfactor | real | No | |
Mount | unit | Yes | |
obj | gamecache | No | |
PL1F | texttag | No | |
PL1hero | unit | No | |
PL1M | boolean | No | |
PL1S | boolean | No | |
PL2F | texttag | No | |
PL2hero | unit | No | |
PL2S | boolean | No | |
PL3F | texttag | No | |
PL3hero | unit | No | |
PL3S | boolean | No | |
Random_item | integer | No | |
Random_level_item | integer | No | |
Rider | unit | Yes | |
Tempgroup | group | No | |
UnitAngle | real | No |
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| Bag CE 2.1 |
| by Weaaddar |
| [email protected] |
|________________________________________________________________________________________________|
| Description: |
| ¯¯¯¯¯¯¯¯¯¯¯¯ |
| Drag and Drop Project version .9 was the first public release of this system. |
| Since then there has been so many different versions of this system . But it is still roughly |
| the same, you drag items to the bag to add them to it, and drag items to cancel to pull them |
| out. Since .9, the code has been optimized tenfold, and it now uses many generic methods |
| (This is really awesome as it means when I port DT4a or Spellbook over I don't need to have |
| have so many new interactive methods), and it now supports multiple bags, and multiple bts |
| (bag types). It also supports creqs, which allow you to define the conditions to which an item |
| may be added to a bag.For instance, you can create a potion bag that only can hold potions |
| or whatever. This is the first version to use RCCS vW, and thanks to its heavy requirements of |
| the core subsystems I have discovered many bugs in RCCS. This was a fairly easy port, because |
| DT4a A4 was so well optimized, that all I really had to do was make it use generic methods |
| I also made it that the bag shows how many more items it can store, not how many it has. |
| |
| Requirements: |
| ¯¯¯¯¯¯¯¯¯¯¯¯¯ |
| -Warcraft III: TFT v 1.17+ |
| -RCCS v. W |
| |
| Implementation: |
| ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ |
| I suggest using WEU you to copy all the abilities over, other then that copy the triggers. |
| In config make sure each ability and item is defined and set correctly, then simply create a BT|
| and place one on the map. The Bag Test trigger demonstrates how to create a BT |
| |
| Changelog: |
| ¯¯¯¯¯¯¯¯¯¯ |
|__________ |
| CE 2.1 | |
|¯¯¯¯¯¯¯¯¯¯ |
| -Hero objects are no longer instanciate on a by-need basis. |
| -You now double right click items to remove them from a bag. |
| -Fixed an error with trying to pull items out of a bag, when an inventory is full. |
| -Fixed an error when trying to put items into a bag while in another bag. |
|__________ |
| CE 2.0 | |
|¯¯¯¯¯¯¯¯¯¯ |
| -First release.Supports stack screen and attributer. |
| |
|________________________________________________________________________________________________|
function Trig_Bag_Pick_Up_Actions takes nothing returns nothing
local unit hero=GetManipulatingUnit()
local item bag=GetManipulatedItem()
if(IsItemIDBT(GetItemTypeId(bag)))then
if(Hero_IV(hero)==null)then
if(IsUnitHidden(hero) or Pitem_getPuaId(bag)==null)then
set hero=null
set bag=null
return
else
call UnitRemoveItem(hero,bag)
call SimError(GetOwningPlayer(hero),"You need to be a hero to use this item")
set hero=null
set bag=null
return
endif
endif
call SetItemInvulnerable(bag,true)
if(Bag_IV(bag)==null)then
call CreateBagByBT(bag,hero)
else
call Bag_setHero(bag,hero)
endif
endif
set hero=null
set bag=null
endfunction
//===========================================================================
function InitTrig_Bag_Pick_Up takes nothing returns nothing
set gg_trg_Bag_Pick_Up = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bag_Pick_Up, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Bag_Pick_Up, function Trig_Bag_Pick_Up_Actions )
endfunction
function Trig_Bag_Use_Actions takes nothing returns nothing
local unit hero=GetManipulatingUnit()
local item clicked=GetManipulatedItem()
local item bag=Hero_getBag(hero)
if(Hero_IV(hero)==null)then
set hero=null
set clicked=null
set bag=null
return
endif
if(Hero_getState(hero)==0)then
if(IsItemBT(clicked))then
call Hero_swapInv(hero)
call Hero_setState(hero,74)
call Hero_setBag(hero,clicked)
call Bag_setPage(clicked,Hero_nextPage(hero,Bag_IV(clicked),Bag_getPage(clicked),false))
call SetItemCharges(UnitItemInSlot(hero,5),Hero_getFree(hero) )
call SetItemCharges(clicked,IV_capacity(Bag_IV(clicked))-Vector_size(Bag_IV(clicked)) )
call Hero_setState(hero,-2)
endif
elseif(Hero_getState(hero)==-2)then
if(clicked==Hero_getCancel(hero))then
call Hero_setState(hero,74)
call Bag_setPage(bag,0)
call Hero_clearInv(hero)
call Hero_swapInv(hero)
call Hero_setState(hero,0)
elseif(clicked==Hero_getNext(hero))then
call Hero_setState(hero,74)
call Hero_clearInv(hero)
call Bag_setPage(bag,Hero_nextPage(hero,Bag_IV(bag),Bag_getPage(bag),false))
call Hero_setState(hero,-2)
elseif(IsItemBT(clicked))then
call SimError(GetOwningPlayer(hero),"You cannot use a container inside a container")
call SetItemCharges(clicked,IV_capacity(Bag_IV(clicked))-Vector_size(Bag_IV(clicked)) )
endif
endif
set hero=null
set clicked=null
set bag=null
endfunction
//===========================================================================
function InitTrig_Bag_Use takes nothing returns nothing
set gg_trg_Bag_Use = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bag_Use, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddAction( gg_trg_Bag_Use, function Trig_Bag_Use_Actions )
endfunction
function Trig_Bag_Order_Actions takes nothing returns nothing
local unit hero=GetOrderedUnit()
local integer order=GetIssuedOrderId()
local item dragged=GetOrderTargetItem()
local integer dropslot=order-852002
local item drop=UnitItemInSlot(hero,dropslot)
local item bag=Hero_getBag(hero)
local integer dragslot=GetItemSlot(hero,dragged)
if(Hero_IV(hero)==null or (order<852002 or order>852007))then
set hero=null
set dragged=null
set drop=null
set bag=null
endif
if(Hero_getState(hero)==0 and dragged!=drop)then
if(IsItemBT(drop) and not Bag_addItem(drop,dragged))then
call Hero_setState(hero,74)
call SimError(GetOwningPlayer(hero),"This container is full")
call UnitRemoveItem(hero,dragged)
call reAddItem(hero,dragged)
call Hero_setState(hero,0)
endif
elseif(Hero_getState(hero)==-2)then
if(IsItemBT(drop) and drop!=dragged)then
call Hero_setState(hero,74)
if(not Bag_addItem(drop,dragged))then
call SimError(GetOwningPlayer(hero),"This container is full")
call UnitRemoveItem(hero,dragged)
call reAddItem(hero,dragged)
else
call Bag_removeItem(bag,dragged)
call Hero_clearInv(hero)
call Bag_setPage(bag,Hero_nextPage(hero,Bag_IV(bag),Bag_getPage(bag)-1,false))
endif
call Hero_setState(hero,-2)
elseif(drop==dragged)then
call Hero_setState(hero,74)
if(not Hero_addToIV(hero,dragged))then
call SimError(GetOwningPlayer(hero),"You have no more room in your inventory")
call UnitRemoveItem(hero,dragged)
call reAddItem(hero,dragged)
else
call Bag_removeItem(bag,dragged)
call Hero_clearInv(hero)
call Bag_setPage(bag,Hero_nextPage(hero,Bag_IV(bag),Bag_getPage(bag)-1,false))
call SetItemCharges(UnitItemInSlot(hero,5),Hero_getFree(hero) )
endif
call Hero_setState(hero,-2)
else
call Vector_swapElems(Bag_IV(bag),4*(Bag_getPage(bag)-1)+dropslot,4*(Bag_getPage(bag)-1)+dragslot)
endif
endif
set hero=null
set dragged=null
set drop=null
set bag=null
endfunction
//===========================================================================
function InitTrig_Bag_Order takes nothing returns nothing
set gg_trg_Bag_Order = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bag_Order, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddAction( gg_trg_Bag_Order, function Trig_Bag_Order_Actions )
endfunction
function PaD_child takes nothing returns nothing
local timer t=GetExpiredTimer()
local item bag=T_getItem(t)
local unit hero=Bag_getHero(bag)
call Hero_clearInv(hero)
call Hero_setState(hero,74)
call Bag_setPage(bag,Hero_nextPage(hero,Bag_IV(bag),Bag_getPage(bag)-1,false))
call Hero_setState(hero,-2)
call DestroyObject(I2S(H2I(t)))
call DestroyTimer(t)
set t=null
set hero=null
set bag=null
endfunction
function PageAfterDelay takes item bag returns nothing
local timer t=CreateTimer()
call StoreInteger(objects(),I2S(H2I(t)),"m_item",H2I(bag))
call TimerStart(t,0,false,function PaD_child)
set t=null
endfunction
function Trig_Bag_Drop_Actions takes nothing returns nothing
local unit hero=GetManipulatingUnit()
local item dropped=GetManipulatedItem()
local item bag=Hero_getBag(hero)
if(Hero_IV(hero)==null or Hero_getState(hero)==74)then
return
endif
if(Hero_getState(hero)==-2)then
call Bag_removeItem(bag,dropped)
call PageAfterDelay(bag)
endif
endfunction
//===========================================================================
function InitTrig_Bag_Drop takes nothing returns nothing
set gg_trg_Bag_Drop = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bag_Drop, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddAction( gg_trg_Bag_Drop, function Trig_Bag_Drop_Actions )
endfunction