can this two systems combine and same time will Work?
i have a system by the_witchers bag system want to combine with this
save/load trigger
means when i use the bag system(with items inside)
next i save it(with save/load system).
did the bag have any items? after the load event? and how?
the save/load trigger was GUI and the ba system was vjass ,,
how to combine it and work? anyone can help , and anyone will help + rep ,, sure it was.. just need to solve this big problem....
Here was the Save/load Trigger
Or go to this section for better quality.
http://www.hiveworkshop.com/forums/triggers-scripts-269/can-possible-207957/
anyone can help,, again + rep to anyone who participate..
i have a system by the_witchers bag system want to combine with this
save/load trigger
means when i use the bag system(with items inside)
next i save it(with save/load system).
did the bag have any items? after the load event? and how?
the save/load trigger was GUI and the ba system was vjass ,,
how to combine it and work? anyone can help , and anyone will help + rep ,, sure it was.. just need to solve this big problem....
Here was the Save/load Trigger
Or go to this section for better quality.
http://www.hiveworkshop.com/forums/triggers-scripts-269/can-possible-207957/
- SaveLoad Init Copy
- Events
- Map initialization
- Conditions
- Actions
- -------- Some configurables --------
- Set SaveLoad_Alphabet = aA5bB0cCdDeE9fFgGhH8iIj1JkK4lLmMn7NoOp3PqQrRsStTu2UvV6wWxXyYzZ
- Set SaveLoad_CheckName = True
- Set SaveLoad_HyphenSpace = 4
- Set SaveLoad_Lower = |c002a4580
- Set SaveLoad_Number = |cffffcc00
- Set SaveLoad_Upper = |cff1142aa
- -------- Store all the items you want to be able to be saved below. --------
- Set SaveLoad_Item[1] = Claws of Attack +15
- Set SaveLoad_Item[2] = Crown of Kings +5
- Set SaveLoad_Item[3] = Kelen's Dagger of Escape
- Set SaveLoad_Item[4] = Mask of Death
- Set SaveLoad_Item[5] = Orb of Frost
- Set SaveLoad_Item[6] = Ring of Protection +5
- Set SaveLoad_Item[7] = Potion of Healing
- Set SaveLoad_ItemCount = 7
- -------- Store all the heroes you want to be able to be saved below. --------
- Set SaveLoad_Hero[1] = Blood Mage
- Set SaveLoad_HeroCount = 1
- -------- Save pet --------
- Set SaveLoad_Pet[1] = Rifleman
- Set SaveLoad_PetCount = 1
- -------- Don't modify below this line. --------
- Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
- Set SaveLoad_Char = <Empty String>
- Set Load[0] = 0
- Set LoadCount = 0
- Custom script: call CodeGen_Init()
- SaveLoad Init Copy
- Events
- Map initialization
- Conditions
- Actions
- -------- Some configurables --------
- Set SaveLoad_Alphabet = aA5bB0cCdDeE9fFgGhH8iIj1JkK4lLmMn7NoOp3PqQrRsStTu2UvV6wWxXyYzZ
- Set SaveLoad_CheckName = True
- Set SaveLoad_HyphenSpace = 4
- Set SaveLoad_Lower = |c002a4580
- Set SaveLoad_Number = |cffffcc00
- Set SaveLoad_Upper = |cff1142aa
- -------- Store all the items you want to be able to be saved below. --------
- Set SaveLoad_Item[1] = Claws of Attack +15
- Set SaveLoad_Item[2] = Crown of Kings +5
- Set SaveLoad_Item[3] = Kelen's Dagger of Escape
- Set SaveLoad_Item[4] = Mask of Death
- Set SaveLoad_Item[5] = Orb of Frost
- Set SaveLoad_Item[6] = Ring of Protection +5
- Set SaveLoad_Item[7] = Potion of Healing
- Set SaveLoad_ItemCount = 7
- -------- Store all the heroes you want to be able to be saved below. --------
- Set SaveLoad_Hero[1] = Blood Mage
- Set SaveLoad_HeroCount = 1
- -------- Save pet --------
- Set SaveLoad_Pet[1] = Rifleman
- Set SaveLoad_PetCount = 1
- -------- Don't modify below this line. --------
- Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
- Set SaveLoad_Char = <Empty String>
- Set Load[0] = 0
- Set LoadCount = 0
- Custom script: call CodeGen_Init()
- SaveLoad Load Rnjm
- Events
- Player - Player 1 (Red) types a chat message containing -load as A substring
- Player - Player 2 (Blue) types a chat message containing -load as A substring
- Player - Player 3 (Teal) types a chat message containing -load as A substring
- Player - Player 4 (Purple) types a chat message containing -load as A substring
- Player - Player 5 (Yellow) types a chat message containing -load as A substring
- Player - Player 6 (Orange) types a chat message containing -load as A substring
- Player - Player 7 (Green) types a chat message containing -load as A substring
- Player - Player 8 (Pink) types a chat message containing -load as A substring
- Conditions
- (Substring((Entered chat string), 1, 6)) Equal to -load
- Actions
- -------- Check if load is valid --------
- Set Code = (Substring((Entered chat string), 7, 999))
- Custom script: call CodeGen_Load(udg_Code)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- SaveLoad_Valid Equal to False
- Then - Actions
- Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
- Skip remaining actions
- Else - Actions
- -------- Start loading, load the hero first. --------
- Set LoadCount = 0
- Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Unit - Remove (Picked unit) from the game)
- Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
- Set Hero = (Last created unit)
- Set PETOwner = (Last created unit)
- Set PETOwnerLoc = (Position of PETOwner)
- Selection - Select (Last created unit) for (Triggering player)
- Unit - Create 1 SaveLoad_Pet[Load[LoadCount]] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
- Set PETDummy[(Player number of (Owner of PETOwner))] = (Last created unit)
- Unit - Order PETDummy[(Player number of (Owner of PETOwner))] to Right-Click PETOwner
- -------- Now load players gold --------
- Set LoadCount = (LoadCount + 1)
- Player - Set (Triggering player) Current gold to Load[LoadCount]
- -------- Now load players Lumber --------
- Set LoadCount = (LoadCount + 1)
- Player - Set (Triggering player) Current lumber to Load[LoadCount]
- -------- Load heroes EXP --------
- Set LoadCount = (LoadCount + 1)
- Hero - Set Hero experience to Load[LoadCount], Hide level-up graphics
- -------- Now items --------
- Set LoadCount = (LoadCount + 1)
- For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions)
- Loop - Actions
- Set LoadCount = (LoadCount + 1)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Load[LoadCount] Not equal to 0
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Load[LoadCount] Equal to 1
- Then - Actions
- Set LoadCount = (LoadCount + 1)
- Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
- Set LoadCount = (LoadCount + 1)
- Item - Set charges remaining in (Last created item) to Load[LoadCount]
- Else - Actions
- Set LoadCount = (LoadCount + 1)
- Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
- Set LoadCount = (LoadCount + 1)
- Else - Actions
- Set LoadCount = (LoadCount + 2)
JASS:
library BagSystem initializer Init
//
// The_Witcher 's
// Bag System
//
// With this System you're able to give as many bags as you want to EVERY unit you want!
// The unit only needs to have the Inventory(hero) ability for an inventory with 6 slots
// you just need to create two useable items: one for next bag and one for previous bag
//
// you can add and remove bags whenever you want
//
//functions:
// InitBackpackForUnit takes unit u, integer maxbags
// if you want a unit to use bags, you need to init that with this function
//
// AddBagsToUnit takes unit towhich, integer bags
// with this function you can higher or lower the amount of bags of a unit (add a negative number for the 'bags' value to lower it)
// if there are items in the removed bag they will be dropped
//
// RemoveBackpack takes unit u
// this function simply removes every bag from the unit
// if you want the unit to use bags again, you have to use InitBackpackForUnit once again
//
//
// the SETUP part
globals
// this is the rawcode of the item for next bag
private constant integer NEXT_BAG_ID = 'I001'
// this is the rawcode of the item for previous bag
private constant integer PREV_BAG_ID = 'I002'
//false= on previous bag is the number of the previous and on next bag the number of the next bag
//true = on previous and next bag is the number of the current bag
private constant boolean DISPLAY_CURRENT_BAG = true
endglobals
//---------------------------------------------------------
//-----------Don't modify anything below this line---------
//---------------------------------------------------------
private struct data
unit u
integer array first[99]
integer array firstc[99]
integer array second[99]
integer array secondc[99]
integer array third[99]
integer array thirdc[99]
integer array fourth[99]
integer array fourthc[99]
integer max
integer bag = 1
endstruct
globals
private hashtable h = InitHashtable()
private integer Key = StringHash("Data")
endglobals
private function BagChange takes nothing returns nothing
local unit u = GetTriggerUnit()
local data dat = LoadInteger(h,GetHandleId(u),Key)
local item ite = GetManipulatedItem()
local integer itemID = GetItemTypeId(ite)
if (itemID == PREV_BAG_ID) or (itemID == NEXT_BAG_ID) then
call RemoveItem(UnitItemInSlot(u,4))
call RemoveItem(UnitItemInSlot(u,5))
set dat.first[dat.bag] = GetItemTypeId(UnitItemInSlot(u, 0))
set dat.firstc[dat.bag] = GetItemCharges(UnitItemInSlot(u, 0))
call RemoveItem(UnitItemInSlot(u,0))
set dat.second[dat.bag] = GetItemTypeId(UnitItemInSlot(u, 1))
set dat.secondc[dat.bag] = GetItemCharges(UnitItemInSlot(u, 1))
call RemoveItem(UnitItemInSlot(u,1))
set dat.third[dat.bag] = GetItemTypeId(UnitItemInSlot(u, 2))
set dat.thirdc[dat.bag] = GetItemCharges(UnitItemInSlot(u, 2))
call RemoveItem(UnitItemInSlot(u,2))
set dat.fourth[dat.bag] = GetItemTypeId(UnitItemInSlot(u, 3))
set dat.fourthc[dat.bag] = GetItemCharges(UnitItemInSlot(u, 3))
call RemoveItem(UnitItemInSlot(u,3))
if itemID == PREV_BAG_ID then
set dat.bag = dat.bag - 1
if dat.bag <= 0 then
set dat.bag = dat.max
endif
else
set dat.bag = dat.bag + 1
if dat.bag >= dat.max + 1 then
set dat.bag = 1
endif
endif
call UnitAddItemToSlotById(u,dat.first[dat.bag],0)
call SetItemCharges(UnitItemInSlot(u, 0),dat.firstc[dat.bag])
call UnitAddItemToSlotById(u,dat.second[dat.bag],1)
call SetItemCharges(UnitItemInSlot(u, 1),dat.secondc[dat.bag])
call UnitAddItemToSlotById(u,dat.third[dat.bag],2)
call SetItemCharges(UnitItemInSlot(u, 2),dat.thirdc[dat.bag])
call UnitAddItemToSlotById(u,dat.fourth[dat.bag],3)
call SetItemCharges(UnitItemInSlot(u, 3),dat.fourthc[dat.bag])
call UnitAddItemToSlotById(u,PREV_BAG_ID,4)
call UnitAddItemToSlotById(u,NEXT_BAG_ID,5)
if DISPLAY_CURRENT_BAG then
call SetItemCharges(UnitItemInSlot(u, 4),dat.bag)
call SetItemCharges(UnitItemInSlot(u, 5),dat.bag)
else
if dat.bag == dat.max then
call SetItemCharges(UnitItemInSlot(u, 4),dat.bag-1)
call SetItemCharges(UnitItemInSlot(u, 5),1)
elseif dat.bag == 1 then
call SetItemCharges(UnitItemInSlot(u, 4),dat.max)
call SetItemCharges(UnitItemInSlot(u, 5),dat.bag+1)
else
call SetItemCharges(UnitItemInSlot(u, 4),dat.bag-1)
call SetItemCharges(UnitItemInSlot(u, 5),dat.bag+1)
endif
endif
endif
set u = null
set ite = null
endfunction
function InitBackpackForUnit takes unit u, integer maxbags returns nothing
local data dat = data.create()
set dat.u = u
set dat.max = maxbags
call UnitRemoveItemFromSlot(u,4)
call UnitRemoveItemFromSlot(u,5)
call UnitAddItemToSlotById(u,PREV_BAG_ID,4)
call UnitAddItemToSlotById(u,NEXT_BAG_ID,5)
if DISPLAY_CURRENT_BAG then
call SetItemCharges(UnitItemInSlot(u, 4),1)
call SetItemCharges(UnitItemInSlot(u, 5),1)
else
call SetItemCharges(UnitItemInSlot(u, 4),dat.max)
call SetItemCharges(UnitItemInSlot(u, 5),2)
endif
call SaveInteger(h,GetHandleId(u),Key,dat)
endfunction
function AddBagsToUnit takes unit towhich, integer bags returns nothing
local data dat = LoadInteger(h,GetHandleId(towhich),Key)
local integer s = dat.max + bags
local item ite
if s < 0 then
set s = 0
endif
if bags < 0 then
loop
exitwhen dat.max == s
set ite = CreateItem(dat.first[dat.max],GetUnitX(towhich),GetUnitY(towhich))
call SetItemCharges(ite, dat.firstc[dat.max])
set ite = CreateItem(dat.second[dat.max],GetUnitX(towhich),GetUnitY(towhich))
call SetItemCharges(ite, dat.secondc[dat.max])
set ite = CreateItem(dat.third[dat.max],GetUnitX(towhich),GetUnitY(towhich))
call SetItemCharges(ite, dat.thirdc[dat.max])
set ite = CreateItem(dat.fourth[dat.max],GetUnitX(towhich),GetUnitY(towhich))
call SetItemCharges(ite, dat.fourthc[dat.max])
set dat.first[dat.max] = 0
set dat.second[dat.max] = 0
set dat.third[dat.max] = 0
set dat.fourth[dat.max] = 0
set dat.firstc[dat.max] = 0
set dat.secondc[dat.max] = 0
set dat.thirdc[dat.max] = 0
set dat.fourthc[dat.max] = 0
set dat.max = dat.max - 1
endloop
else
set dat.max = dat.max + bags
endif
set ite = null
endfunction
function RemoveBackpack takes unit u returns nothing
local data dat = LoadInteger(h,GetHandleId(u),Key)
local integer i = 0
local integer ii = 0
call RemoveItem(UnitItemInSlot(u, 4))
call RemoveItem(UnitItemInSlot(u, 5))
set ii = 0
loop
exitwhen i > 3
call UnitRemoveItemFromSlot(dat.u,i)
set i = i + 1
endloop
set i = 1
loop
exitwhen i > dat.max
set i = i + 1
call UnitAddItemToSlotById(u,dat.first[i],0)
call SetItemCharges(UnitItemInSlot(u, 0),dat.firstc[i])
call UnitAddItemToSlotById(u,dat.second[i],1)
call SetItemCharges(UnitItemInSlot(u, 1),dat.secondc[i])
call UnitAddItemToSlotById(u,dat.third[i],2)
call SetItemCharges(UnitItemInSlot(u, 2),dat.thirdc[i])
call UnitAddItemToSlotById(u,dat.fourth[i],3)
call SetItemCharges(UnitItemInSlot(u, 3),dat.fourthc[i])
set ii = 0
loop
exitwhen ii == 4
call UnitRemoveItemFromSlot(dat.u,ii)
set ii = ii + 1
endloop
endloop
call dat.destroy()
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_USE_ITEM, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddAction(t, function BagChange)
endfunction
endlibrary
JASS:
library AdvancedItemHandlingSystem initializer Init
// The_Witcher's
//
// <<advanced item system>>
//
// This system improves the Warcraft III item engine
//
// If a unit gets an item which it already has it stacks (only if item has charges!)
// In addition this works even if the inventory is full!!!
//
// If you double-right-click an item with charges in your inventory it splits up
// and if you move a item onto an equal item and they are stackable they stack
//
// No Setup Part! Don't touch anything fully automatic :)
private struct data
unit u
item ite
integer index
real x
real y
endstruct
globals
private data array DATAS
private integer total = 0
private hashtable h = InitHashtable()
private timer tim = CreateTimer()
private trigger trg = CreateTrigger( )
endglobals
private function IsInventoryFull takes unit u returns boolean
local integer i = 0
loop
exitwhen i == 6
if UnitItemInSlot(u, i) == null then
return false
endif
set i = i + 1
endloop
return true
endfunction
private function ItemWalk takes nothing returns boolean
local integer i = 0
local unit u = GetTriggerUnit()
local item ite = GetOrderTargetItem()
local data dat
if IsInventoryFull(u) and GetItemCharges(ite)!= 0 then
loop
exitwhen i > 5
if GetItemTypeId(ite) == GetItemTypeId(UnitItemInSlot(u, i)) and UnitHasItem(u,ite)== false then
call IssuePointOrder( u, "move", GetItemX(ite),GetItemY(ite) )
if LoadInteger(h,GetHandleId(u),0) == 0 then
set dat = data.create()
set DATAS[total] = dat
set dat.index = total
set total = total + 1
set dat.u = u
set dat.ite = ite
set dat.x = GetItemX(ite)
set dat.y = GetItemY(ite)
call SaveInteger(h,GetHandleId(u),0,dat)
else
set dat = LoadInteger(h,GetHandleId(u),0)
set dat.u = u
set dat.ite = ite
set dat.x = GetItemX(ite)
set dat.y = GetItemY(ite)
endif
set i = 100
endif
set i = i + 1
endloop
set dat = LoadInteger(h,GetHandleId(u),0)
if i < 10 and dat != 0 then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
endif
set u = null
set ite = null
return false
endfunction
private function ItemStack takes nothing returns boolean
local integer i = 0
local integer id
local item k
local item m = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer ite = GetItemTypeId(m)
local integer c = GetItemCharges(m)
local integer it
if GetItemCharges(GetManipulatedItem()) > 0 then
loop
exitwhen i > 6
set it = GetItemTypeId(UnitItemInSlot(u, i - 1))
set k = UnitItemInSlot(u, i - 1)
if ( ( it == ite ) and( m != k ) ) then
call SetItemCharges( k, GetItemCharges(k) + c )
call RemoveItem( m )
set i = 10
endif
set i = i + 1
endloop
endif
set k = null
set m = null
set u = null
return false
endfunction
private function ItemTake takes nothing returns nothing
local real dx
local real dy
local item it
local integer i
local integer ii = 0
local data dat
loop
exitwhen ii >= total
set dat = DATAS[ii]
set dx = GetItemX(dat.ite) - GetUnitX(dat.u)
set dy = GetItemY(dat.ite) - GetUnitY(dat.u)
if ( dx * dx + dy * dy < 10000 ) and IsItemOwned(dat.ite) == false then
set i = 0
loop
exitwhen i > 5
set it = UnitItemInSlot(dat.u,i)
if GetItemTypeId(dat.ite) == GetItemTypeId(it) then
set i = 5
endif
set i = i + 1
endloop
call SetItemCharges( it, GetItemCharges(it) + GetItemCharges(dat.ite) )
call RemoveItem( dat.ite )
set total = total - 1
set DATAS[ii] = DATAS[total]
set DATAS[ii].index = ii
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
call IssueImmediateOrder(dat.u,"stop")
endif
set ii = ii + 1
endloop
set it = null
endfunction
private function ItemWalkAbort1 takes nothing returns boolean
local data dat = LoadInteger(h,GetHandleId(GetTriggerUnit()),0)
if dat != 0 and( GetOrderPointX() != dat.x or GetOrderPointY() != dat.y )then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
return false
endfunction
private function ItemWalkAbort2 takes nothing returns boolean
local data dat = LoadInteger(h,GetHandleId(GetTriggerUnit()),0)
if dat != 0 then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
return false
endfunction
private function ItemSplit takes nothing returns boolean
local integer i = GetItemCharges(GetOrderTargetItem())
if GetIssuedOrderId() > 852001 and GetIssuedOrderId() < 852008 then
if GetOrderTargetItem() == UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002) then
if i > 1 then
set i = i/2
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) - i)
call DisableTrigger(trg)
call UnitAddItemByIdSwapped(GetItemTypeId(GetOrderTargetItem()), GetTriggerUnit())
call EnableTrigger(trg)
call SetItemCharges(bj_lastCreatedItem, i)
endif
else
if i > 0 and GetItemTypeId(GetOrderTargetItem()) == GetItemTypeId(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)) then
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) + GetItemCharges(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)))
call RemoveItem(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002))
endif
endif
endif
return false
endfunction
private function Init takes nothing returns nothing
local trigger a = CreateTrigger( )
local trigger b = CreateTrigger( )
local trigger c = CreateTrigger( )
local integer i = 0
call TimerStart( tim, 0.05, true, function ItemTake )
loop
call TriggerRegisterPlayerUnitEvent(a, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
call TriggerRegisterPlayerUnitEvent(b, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
call TriggerRegisterPlayerUnitEvent(c, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
call TriggerRegisterPlayerUnitEvent(trg, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( a, Condition( function ItemWalkAbort1 ) )
call TriggerAddCondition( a, Condition( function ItemWalkAbort2 ) )
call TriggerAddCondition( c, Condition( function ItemWalk ) )
call TriggerAddCondition( c, Condition( function ItemSplit ) )
call TriggerAddCondition( trg, Condition( function ItemStack ) )
endfunction
endlibrary
anyone can help,, again + rep to anyone who participate..