Inventory Help BX-TRSII

Schyy

New Member
Reaction score
5
hi guys,

i have a very big problem using Toadcops BX-TRSII Inventory System
would be very nice if someone know this system and could help me please

if there is someone who dont know the system but wanna set what it is and how it works
here is the link to the system:
http://www.wc3campaigns.net/showthread.php?t=91163

so here are the facts:

I imported the Inventory system to my map and everything worked fine
but there are some reasons i have to change the system
1. i need a diffrent style of the system but this was no problem and now i have the style i want (works fine)
2. i need a save/load system to save the equipped items in the TRSII (but this is not my problem at the moment i will go for the save/load a little later)
3. (and this is my problem at the moment) i need some items (like mana or heal potions, questitems, scrolls and so on)that could be picked up by the user and go into the normal 6 slot hero inventory of wc3 (for better and faster use in fight ofc)
so i searched the forums and found a very nice code that check the itemsclass wich go into the TRSII via a boolean
ok so i put the code into my map and i couldnt trust my eyes it worked
the items go were i want them to go (so the normal equipment items go into the TRSII Inventory and the usable items go into the normal inventory
i was very happy to see this and tryed to use an item in my normal inventory and kaboom "wc3 crit error"
i tryed again and again ... i can equip the items in the TRSII and they work fine... so TRSII works very well but only if i use an item in the normal 6 slot inventory of warcraft it will crash

so here are all the changes i made at the main code of TRSII:

so i changed the gridcreate function in TRSInv to get my own style if the inventory
TRSInv
JASS:
function CreateGridExec takes nothing returns nothing
    local real x=TRSGridX()
    local real y=TRSGridY()
    local integer i=eax
    local real xstep=TRSXstep()
    set InvPlayerX<i>=x+(i*xstep)
    set InvPlayerY<i>=y+2
    call CreateGridBR(i,null,x+(i*xstep),y,6,7,0,&quot;inv&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVINVSlotIcon(),-15.5,8.90,TRSInvSetup_IconSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null)
  // Right Side
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,1,&quot;helm&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVHelmSlotIcon(),-18.4,8.55,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Helm
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,2,&quot;shoulder&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVShoulderLeftSlotIcon(),-18.4,5.883,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Shoulder
    //call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,3,&quot;weapon&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVWeaponSlotIcon(),-18.4,3.216,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),Condition(function INVCustomReqWeaponSlot)) // Weapon
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,3,&quot;armor&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVArmorSlotIcon(),-18.4,3.216,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Armor
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,4,&quot;belt&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVBeltSlotIcon(),-18.4,0.549,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Belt
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,5,&quot;pants&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVPantsSlotIcon(),-18.4,-2.118,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Pants
  // Ring 
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,6,&quot;ring&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVRingRightSlotIcon(),-18.4,-4.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Ring
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,7,&quot;ring&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVRingRightSlotIcon(),-15.7,-4.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Ring
  
  // Left Side
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,8,&quot;amulet&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVAmuletSlotIcon(),-4.75,8.55,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Amulet
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,9,&quot;shoulder&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVShoulderRightSlotIcon(),-4.75,5.883,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Shoulder
    //call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,10,&quot;shield&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVShieldSlotIcon(),-4.75,3.216,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),Condition(function INVCustomReqWeaponSlot)) // Shield
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,10,&quot;gloves&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVGlovesSlotIcon(),-4.75,3.216,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Gloves
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,11,&quot;bracers&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVBracersSlotIcon(),-4.75,0.549,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Bracers
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,12,&quot;boots&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVBootsSlotIcon(),-4.75,-2.118,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Boots
  // Ring 
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,13,&quot;ring&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVRingLeftSlotIcon(),-4.75,-4.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Ring
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,14,&quot;ring&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVRingLeftSlotIcon(),-7.455,-4.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Ring

    set InvMinChargedSlot<i>=17
    set InvMaxChargedSlot<i>=18
  // Charms  
    call CreateGridBR(i,&quot;UseSlot1&quot;,x+(i*xstep),y,1,1,17,&quot;charged&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVCharged2SlotIcon(),-7.455,-6.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Charged
    call CreateGridBR(i,&quot;UseSlot2&quot;,x+(i*xstep),y,1,1,18,&quot;charged&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVCharged1SlotIcon(),-15.7,-6.785,TRSInvSetup_IconEquipmentSizeAspect(),0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Charged
    //Weapons
    call CreateGridBR(i,&quot;right&quot;,x+(i*xstep),y,1,1,15,&quot;weapon&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVWeaponSlotIcon(),-13.355,-5,TRSInvSetup_IconEquipmentSizeAspect()+0.05,0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),Condition(function INVCustomReqWeaponSlot)) // Weapon
    call CreateGridBR(i,&quot;left&quot;,x+(i*xstep),y,1,1,16,&quot;shield&quot;,&quot;TRS\\TRSINVtrkEx.mdx&quot;,TRSInvSetup_INVShieldSlotIcon(),-10.36,-5,TRSInvSetup_IconEquipmentSizeAspect()+0.05,0,0,function Track,function Hit,Condition(function TRSTrue),Condition(function TRSTrue),Condition(function INVCustomReqWeaponSlot)) // Shield

    
  // Merchant
    call CreateGridBR(i,null,x+(i*xstep),y,8,4,0,&quot;merchant&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVINVSlotIcon(),0.5,0.5,TRSInvSetup_IconSizeAspect(),0,0,function TrackMerch,function HitMerch,Condition(function TRSTrue),Condition(function TRSTrue),null)
  // Background
    call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;background&quot;,&quot;TRS\\TRSINVtrkBack.mdx&quot;,0,0,0,0,0,0,function Track,function Track,Condition(function TRSTrue),Condition(function TRSTrue),null)


// command buttons
   // call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;pagedown&quot;,&quot;TRS\\TRSINVtrk0x1.mdx&quot;,TRSInvSetup_PageListDownDis(),-5.5,-9.8,TRSInvSetup_PageListSize(),0,0,function Track,function INVPageDown,Condition(function TRSTrue),Condition(function TRSTrue),null) // Page Down
   // call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;pageup&quot;,&quot;TRS\\TRSINVtrk0x1.mdx&quot;,TRSInvSetup_PageListUpDis(),-5.5,10.6,TRSInvSetup_PageListSize(),0,0,function Track,function INVPageUp,Condition(function TRSTrue),Condition(function TRSTrue),null) // Page Up

   // call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;pagedownmerch&quot;,&quot;TRS\\TRSINVtrk0x1.mdx&quot;,TRSInvSetup_PageListDownDis(),15.73,-3.95,TRSInvSetup_PageListSize(),0,0,function Track,function INVPageDownMerch,Condition(function TRSInvIsByMerchant),Condition(function TRSInvIsByMerchant),null) // Page Down merchant
   // call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;pageupmerch&quot;,&quot;TRS\\TRSINVtrk0x1.mdx&quot;,TRSInvSetup_PageListUpDis(),15.73,6.95,TRSInvSetup_PageListSize(),0,0,function Track,function INVPageUpMerch,Condition(function TRSInvIsByMerchant),Condition(function TRSInvIsByMerchant),null) // Page Up merchant

    call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;sellitem&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVSellItem(),-1.25,-1.25,TRSInvSetup_INVSellItemButtonSize(),0,0,function Track,function MerchantSellItemBR,Condition(function TRSInvIsByMerchant),Condition(function TRSInvIsByMerchant),null) // Exit
    call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;buyitem&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVBuyItem(),-1.25,-3.5,TRSInvSetup_INVBuyItemButtonSize(),0,0,function Track,function MerchantBuyItemBR,Condition(function TRSInvIsByMerchant),Condition(function TRSInvIsByMerchant),null) // Exit
 
    call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;exit&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVCancelButton(),-6.5,-8.0,TRSInvSetup_INVCancelButtonSize(),0,0,function Track,function INVButtonExit,Condition(function TRSTrue),Condition(function TRSTrue),null) // Exit
    call CreateGridBR(i,null,x+(i*xstep),y,1,1,0,&quot;drop&quot;,&quot;TRS\\TRSINVtrk.mdx&quot;,TRSInvSetup_INVDropButton(),-4,-8.0,TRSInvSetup_INVDropButtonSize(),0,0,function Track,function INVDropItem,Condition(function TRSTrue),Condition(function TRSTrue),null) // Drop Item

    call StoreInteger(TRSInv,&quot;PlayerInv&quot;+I2S(i),&quot;Size&quot;,42)
    call StoreInteger(TRSInv,&quot;PlayerInv&quot;+I2S(i),&quot;MerchantSize&quot;,32)
    call StoreInteger(TRSInv,&quot;PlayerInv&quot;+I2S(i),&quot;ExtraSlots&quot;,16)
endfunction</i></i></i></i>


then i added the boolean in the EquipItem code
EquipItem
JASS:
function EquipItemCondition takes nothing returns boolean
    return not ebx32
endfunction

function EquipItemAct takes nothing returns nothing
    local boolean equiped=false
    local boolean ex=GetUnitAbilityLevel(GetManipulatingUnit(),TRSExInvId())&gt;0
if (GetItemType(GetManipulatedItem()) == ITEM_TYPE_CAMPAIGN) then
    call TRSGetInvBR(GetManipulatingUnit())
if GetItemUserData(GetManipulatedItem())==0 then
    call SetItemUserData(GetManipulatedItem(),GetCustomItemID())
endif
    call PreGenerateParBR(I2S(GetItemTypeId(GetManipulatedItem())),I2S(GetItemUserData(GetManipulatedItem())))
if GetStoredString(TRSItems,I2S(GetItemTypeId(GetManipulatedItem())),&quot;type&quot;)==&quot;charm&quot; and ex then
    call EquipItemBR(GetManipulatingUnit(),I2S(GetItemTypeId(GetManipulatedItem())),I2S(GetItemUserData(GetManipulatedItem())),true)
endif
if not ex then
   set equiped=AddItemToCusInvBR(GetManipulatingUnit(),I2S(GetItemUserData(GetManipulatedItem())))
if equiped==false then
   call UnitRemoveItem(GetManipulatingUnit(),GetManipulatedItem())
else
   call RemoveItem(GetManipulatedItem())
endif
endif
endif
endfunction

//===========================================================================
function InitTrig_EquipItem takes nothing returns nothing
    set gg_trg_EquipItem = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_EquipItem,EVENT_PLAYER_UNIT_PICKUP_ITEM)
    call TriggerAddAction(gg_trg_EquipItem,function EquipItemAct)
    call TriggerAddCondition(gg_trg_EquipItem,Condition(function EquipItemCondition))
endfunction


and the opposite in the UnequipItem code
UnequipItem
JASS:
function UnequipItemAct takes nothing returns nothing
  if (GetItemType(GetManipulatedItem()) != ITEM_TYPE_CAMPAIGN) then
   return
  endif
  if GetUnitAbilityLevel(GetTriggerUnit(),TRSExInvId())&gt;0 then
    call UnequipItemBR(GetTriggerUnit(),I2S(GetItemTypeId(GetManipulatedItem())),I2S(GetItemUserData(GetManipulatedItem())),true)
  endif
endfunction

//===========================================================================
function InitTrig_UnequipItem takes nothing returns nothing
    set gg_trg_UnequipItem = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_UnequipItem,EVENT_PLAYER_UNIT_DROP_ITEM)
    call TriggerAddAction(gg_trg_UnequipItem,function UnequipItemAct)
endfunction


i didnt changed anything else at the core or something

so these are all changes so far but it must be a reason of the Equip and Unequip code that i added because i tryed to change only the Equip and Unequip code in the DemoMap of TRSII and it also crashes...

so ...
is there anybody out there who could help me ?
ofc i will give Rep for this ! xD

Thanks & regards
Schyy
 

Schyy

New Member
Reaction score
5
thank you for your answer ...
i have noticed your request and will edit the post above right now !
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
Blarg, I read that wrong. Anyway, is there a link to this boolean insertion that I could see? Did they document any errors with modifying the system with active items?
 

Schyy

New Member
Reaction score
5
thank ya for ur reply
but i still dont get it to work

the items come into the 6 slot inventory correctly but if i use them "crit error"
i tried diffrent types of booleans in that function but the systems seems to have an function that detects an usage of an item and try to get the item data out of the gamecache (i think this is the reason for the crash) ... but i cant find the function ... and i tried very much different key words searching for... my theorie: place an item type boolean condition in this function but i dont know if my theorie is right


yes
the post is here but there arent any coments about usable items
http://www.wc3campaigns.net/showthread.php?t=91163&page=17
its in the middle of the page with 3 big code blocks
 

Schyy

New Member
Reaction score
5
The problem is solved

for everyone who got the same problem and wanna fix it
here is the instruction:

go to trigger EquipItem and add the follow line

JASS:
function EquipItemAct takes nothing returns nothing
    local boolean equiped=false
    local boolean ex=GetUnitAbilityLevel(GetManipulatingUnit(),TRSExInvId())&gt;0
///////////////Add this ////////////////
 if (GetItemType(GetManipulatedItem()) == ITEM_TYPE_CAMPAIGN) then 
//////////////////////////////////////// 
 call TRSGetInvBR(GetManipulatingUnit())


after that add the opposite to the UnequipItem trigger

JASS:
function UnequipItemAct takes nothing returns nothing
///////////////Add this ////////////////
  if (GetItemType(GetManipulatedItem()) != ITEM_TYPE_CAMPAIGN) then 
   return                                                                                     
  endif    
////////////////////////////////////////                                                                                    
 if GetUnitAbilityLevel(GetTriggerUnit(),TRSExInvId())&gt;0 then
    call UnequipItemBR(GetTriggerUnit(),I2S(GetItemTypeId(GetManipulatedItem())),I2S(GetItemUserData(GetManipulatedItem())),true)
  endif
endfunction


the last thing to change is in the TRSShowItemStats Trigger
add a condition in the init trigger

JASS:
//===========================================================================
function InitTrig_TRSShowItemStats takes nothing returns nothing
set gg_trg_TRSShowItemStats = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TRSShowItemStats, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddAction( gg_trg_TRSShowItemStats, function ShowItemStatsActions )
///////////////Add this ////////////////
call TriggerAddCondition( gg_trg_TRSShowItemStats, Condition(function ShowItemStatsActions_Condition) )   
////////////////////////////////////////
endfunction


and last but not least create the condition function in the same trigger

JASS:
function ShowItemStatsActions_Condition takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_CAMPAIGN
endfunction


thats it !

thanks for help
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top