Capitán

Barra de Salud : 
Mensajes : 149
Reputación : 30 Monedas de oro : 525 Monedas de Platino : 0 ![save/load Item charges [Resuelto] Empty](https://2img.net/i/fa/empty.gif)
Inventario : ![save/load Item charges [Resuelto] Empysl10](https://i.servimg.com/u/f73/18/43/73/24/empysl10.png) ![save/load Item charges [Resuelto] Empysl10](https://i.servimg.com/u/f73/18/43/73/24/empysl10.png)
![save/load Item charges [Resuelto] Empty](https://2img.net/i/fa/empty.gif) | (#) Tema: save/load Item charges [Resuelto] Mar Mar 14, 2017 12:43 pm | |
| Tengo el sIstema de TriggerHappy "CODEGEN" este es como tengo el trigger [gui]CodeGen Save Acontecimientos Jugador - Jugador 1 (rojo) types a chat message containing -save as Una correspondencia exacta Jugador - Jugador 2 (azul) types a chat message containing -save as Una correspondencia exacta Jugador - Jugador 3 (teja) types a chat message containing -save as Una correspondencia exacta Jugador - Jugador 4 (morado) types a chat message containing -save as Una correspondencia exacta Jugador - Jugador 5 (amarillo) types a chat message containing -save as Una correspondencia exacta Jugador - Jugador 6 (naranja) types a chat message containing -save as Una correspondencia exacta Condiciones Acciones Set SaveCount = 0 Grupo de unidad - Pick every unit in (Units owned by (Triggering player) matching ((((Matching unit) is Un hà  roe) Igual a True) and ((Unit-type of (Matching unit)) No igual a Quest Info))) and do (Set Hero = (Picked unit)) Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero)) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Hero experience of Hero) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Fuerza of Hero (Excluir bonuses)) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Agilidad of Hero (Excluir bonuses)) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Inteligencia of Hero (Excluir bonuses)) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = ((Triggering player) Oro actual) -------- -------- Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = ((Triggering player) Madera actual) -------- -------- Set Save[SaveCount] = (Number of items carried by Hero) For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions) Bucle: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones (Item-type of (Item carried by Hero in slot Integer_A_Replacement)) No igual a (Item-type of Sin objeto) Entonces: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Or - Any (Conditions) are true Condiciones (Charges remaining in (Item carried by Hero in slot Integer_A_Replacement)) Mayor que 0 Entonces: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 1 Set SaveCount = (SaveCount + 1) Set Item = (Item carried by Hero in slot Integer_A_Replacement) Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item)) Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Charges remaining in (Item carried by Hero in slot Integer_A_Replacement)) Otros: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 2 Set SaveCount = (SaveCount + 1) Set Item = (Item carried by Hero in slot Integer_A_Replacement) Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item)) Set SaveCount = (SaveCount + 1) Otros: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 0 Set SaveCount = (SaveCount + 2) -------- -------- Set SaveLoad_Directory = Save Set SaveLoad_Filename = (((1Historia) + (Name of (Triggering player))) + ('s + ( + (((Name of Hero) + ) + .txt)))) -------- -------- Custom script: set udg_Code = CodeGen_Compile() Partida - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code[/gui]
[gui]CodeGen Load Acontecimientos Jugador - Jugador 1 (rojo) types a chat message containing -load as Una subcadena Jugador - Jugador 2 (azul) types a chat message containing -load as Una subcadena Jugador - Jugador 3 (teja) types a chat message containing -load as Una subcadena Jugador - Jugador 4 (morado) types a chat message containing -load as Una subcadena Jugador - Jugador 5 (amarillo) types a chat message containing -load as Una subcadena Jugador - Jugador 6 (naranja) types a chat message containing -load as Una subcadena Condiciones LoadCheck[(Player number of (Triggering player))] Igual a False (String((Substring((Entered chat string), 1, 6))) as Minúsculas) Igual a -load Acciones Secuencia cinematográfica - Clear the screen of text messages for (Player group((Triggering player))) Set InicioCheck[(Player number of (Triggering player))] = True 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) Si: Condiciones SaveLoad_Valid Igual a False Entonces: Acciones Partida - Display to (Player group((Triggering player))) for 10.00 seconds the text: SaveLoad_Error Skip remaining actions Otros: Acciones -------- -------- Set LoadCount = 0 Grupo de unidad - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is Un hà roe) Igual a True)) and do (Unidad - Remove (Picked unit) from the game) Unidad - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Center of Renacer ) facing Vista edificio predeterminada degrees Set Hero = (Last created unit) Set player_heroe_numeroentero = ((Player number of (Owner of (Last created unit))) - 1) Set Player_Heroes[(Player number of (Triggering player))] = (Last created unit) Set Player_LoadHeroe[(Player number of (Triggering player))] = True Set SP_Max[(Player number of (Triggering player))] = (SP_Max[(Player number of (Triggering player))] + 1) Custom script: set HERO[udg_player_heroe_numeroentero]=bj_lastCreatedUnit Selección - Select (Last created unit) for (Triggering player) -------- -------- Set LoadCount = (LoadCount + 1) Hà roe - Set (Last created unit) experience to Load[LoadCount], Ocultar level-up graphics -------- -------- Set LoadCount = (LoadCount + 1) Hà roe - Modify Fuerza of Hero: Añadir Load[LoadCount] -------- -------- Set LoadCount = (LoadCount + 1) Hà roe - Modify Agilidad of Hero: Añadir Load[LoadCount] -------- -------- Set LoadCount = (LoadCount + 1) Hà roe - Modify Inteligencia of Hero: Añadir Load[LoadCount] -------- -------- Set LoadCount = (LoadCount + 1) Jugador - Set (Triggering player) Oro actual to Load[LoadCount] -------- -------- Set LoadCount = (LoadCount + 1) Jugador - Set (Triggering player) Madera actual to Load[LoadCount] -------- -------- Set LoadCount = (LoadCount + 1) For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions) Bucle: Acciones Set LoadCount = (LoadCount + 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Load[LoadCount] No igual a 0 Entonces: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Load[LoadCount] Igual a 1 Entonces: Acciones Set LoadCount = (LoadCount + 1) Hà roe - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero Set LoadCount = (LoadCount + 1) Otros: Acciones Set LoadCount = (LoadCount + 1) Hà roe - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero Set LoadCount = (LoadCount + 1) Objeto - Set charges remaining in (Last created item) to (Load[LoadCount]) Otros: Acciones Set LoadCount = (LoadCount + 2)[/gui]
El sistema guarda el objeto.. pero no las cargas siempre me aparece 1 solo ejemplo tengo 20 pociones.! y me aparece a usar el comando load aparece 1sola..
uso el sistema en jass de stacksplit para acumulacion de objetos.
[jass]//TESH.scrollpos=0 http://TESH.alwaysfold=0 //===================================================================================== // Easy Item Stack 'n Split v2.7.4 // by Dangerb0y //===================================================================================== library EasyItemStacknSplit initializer onInit //===================================================================================== // // This system adds some much needed item stacking, item splitting, and full inventory // functionality to Warcraft III. // // A couple of useful functions are also included... // // - UnitInventoryFull( unit ) // Returns true if all of a unit's inventory slots are occupied, else false. // // - UnitStackItem( unit, item ) // Works like UnitAddItem(), but will try to stack items even if inventory is full. // If excess items from an item stack are dropped, returns the item, else null. // //===================================================================================== // SYSTEM PARAMETERS //===================================================================================== globals // Allow item splitting with double right-click? private boolean SPLIT = true // Amount to split from stack... (0 = half) private integer SPLIT_SIZE = 1 // Allow consecutively split items to stack together? private boolean SPLIT_STACK = true private real SPLIT_STACK_DELAY = 2.00 // Allow split items to be dropped if no inventory slots are open? private boolean SPLIT_DROP = true // Use item levels to determine stack limit? (false = unlimited stacks) private boolean USE_ITEM_LEVEL = false // Full inventory error sound filename... (null = disabled) private string ERROR_SOUND = "null" endglobals //===================================================================================== // DO NOT EDIT BELOW THIS LINE //=====================================================================================
globals private unit array tu private unit array su private item array ti private item array si private item array sii private real array sc private integer tt = 0 private integer st = 0 private timer t = CreateTimer() endglobals //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // PUBLIC FUNCTION : UnitInventoryFull( unit ) // Checks if all the inventory slots of a unit are occupied. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function UnitInventoryFull takes unit u returns boolean local integer is = UnitInventorySize( u ) local integer s = 0 loop exitwhen s >= is if UnitItemInSlot(u, s) == null then return false endif set s = s + 1 endloop return true endfunction //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // PUBLIC FUNCTION : UnitStackItem( unit, item ) // Works like UnitAddItem() with full inventory functionality. // Returns true if excess items are dropped. Otherwise false. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= function UnitStackItem takes unit u, item i returns boolean local integer ic = GetItemCharges( i ) local integer is local integer il local integer it local item ii local integer iic local integer s = 0 local real px local real py local real ua // Check if the item is a powerup if IsItemPowerup(i) then return false endif // Make sure the item has charges if ic <= 0 then // If not we just give it to the unit call DisableTrigger( gg_trg_EasyItemStacknSplit ) call UnitAddItem( u, i ) call EnableTrigger( gg_trg_EasyItemStacknSplit ) else // Set vars set is = UnitInventorySize( u ) set il = GetItemLevel( i ) set it = GetItemTypeId( i ) // We can remove the item, we have all the data we need from it call RemoveItem( i ) // Look for items of the same type and try stack onto them loop set ii = UnitItemInSlot( u, s ) set iic = GetItemCharges( ii ) if ii != null and (not USE_ITEM_LEVEL or il == 0 or iic < il) and GetItemTypeId(ii) == it then if USE_ITEM_LEVEL and il > 0 and iic + ic > il then call SetItemCharges( ii, il ) set ic = iic + ic - il else call SetItemCharges( ii, iic + ic ) set ic = 0 endif endif set s = s + 1 exitwhen ic <= 0 or s >= is endloop // If there are any charges left over, look for open slots if ic > 0 then set px = GetUnitX( u ) set py = GetUnitY( u ) set s = 0 loop set ii = UnitItemInSlot( u, s ) if ii == null then set ii = CreateItem( it, px, py ) if USE_ITEM_LEVEL and il > 0 and ic > il then call SetItemCharges( ii, il ) set ic = ic - il else call SetItemCharges( ii, ic ) set ic = 0 endif call DisableTrigger( gg_trg_EasyItemStacknSplit ) call UnitAddItem( u, ii ) call EnableTrigger( gg_trg_EasyItemStacknSplit ) endif set s = s + 1 exitwhen ic <= 0 or s >= is endloop // If there are still charges left over, drop them on the ground if ic > 0 then set ua = GetUnitFacing( u ) set px = GetUnitX( u ) + 100 * Cos( ua * bj_DEGTORAD ) set py = GetUnitY( u ) + 100 * Sin( ua * bj_DEGTORAD ) loop if ic > il then set iic = il set ic = ic - il else set iic = ic set ic = 0 endif set ii = CreateItem( it, px, py ) call SetItemCharges( ii, iic ) exitwhen ic <= 0 endloop return true endif endif endif // Nothing dropped return false endfunction //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // TEXTMACRO : EasyItemStacknSplit_PLAYITEMSOUND( soundname, unitvar ) // Plays item sound for player if the triggering unit is nearby. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //! textmacro EasyItemStacknSplit_PLAYITEMSOUND takes FILENAME set str = "Sound\\Interface\\$FILENAME$.wav" if GetLocalPlayer() != p then set str = "" endif set snd = CreateSound( str, false, true, false, 12700, 12700, "" ) call AttachSoundToUnit( snd, u ) call SetSoundVolume( snd, 75 ) call SetSoundDistances( snd, 600.0, 1024.0 ) call SetSoundDistanceCutoff( snd, 1536.0 ) call StartSound( snd ) call KillSoundWhenDone( snd ) //! endtextmacro
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // CONTROLLER : TimerController // EVENTS : Global Timer (t) expires (periodically, 0.05) // Runs through full-stack and split-stack queues, and works its magic. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= private function TimerController takes nothing returns nothing local unit u local item i local item ii local integer x = 0 local integer o local real px local real py local player p local string str local sound snd // Run through full-stack queue if tt > 0 then loop set u = tu[x] set i = ti[x] if u != null and i != null and not IsItemOwned(i) and GetWidgetLife(i) > 0 and GetWidgetLife(u) > 0 then set o = GetUnitCurrentOrder( u ) set px = GetItemX( i ) - GetUnitX( u ) set py = GetItemY( i ) - GetUnitY( u ) if px * px + py * py <= 22500 or o != 851986 then if o == 851986 then set p = GetOwningPlayer( u ) // Play the "Item Get" sound //! runtextmacro EasyItemStacknSplit_PLAYITEMSOUND( "PickUpItem" ) call IssueImmediateOrder( u, "stop" ) call SetUnitFacing( u, bj_RADTODEG * Atan2(GetItemY(i) - GetUnitY(u), GetItemX(i) - GetUnitX(u)) ) if UnitStackItem(u, i) then // Play the "Item Drop" sound //! runtextmacro EasyItemStacknSplit_PLAYITEMSOUND( "HeroDropItem1" ) endif endif set tt = tt - 1 if tt > 0 then set tu[x] = tu[tt] set ti[x] = ti[tt] set x = x - 1 endif endif elseif u != null or i != null then call IssueImmediateOrder( u, "stop" ) set tt = tt - 1 if tt > 0 then set tu[x] = tu[tt] set ti[x] = ti[tt] set x = x - 1 endif endif set x = x + 1 exitwhen x >= tt endloop endif // Run through split-stack queue if SPLIT_STACK and st > 0 then set x = 0 loop set u = su[x] set i = si[x] set ii = sii[x] set px = sc[x] if u != null and i != null and ii != null and px > 0 and UnitHasItem(u, i) and UnitHasItem(u, ii) then set sc[x] = px - 0.05 else set st = st - 1 if st > 0 then set su[x] = su[st] set si[x] = si[st] set sii[x] = sii[st] set sc[x] = sc[st] set x = x - 1 endif endif set x = x + 1 exitwhen x >= st endloop endif // Pause timer if not needed if tt <= 0 and (not SPLIT_STACK or st <= 0) then call PauseTimer( t ) endif set u = null set i = null set p = null set snd = null endfunction
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // CONTROLLER : CancelController // EVENTS : Unit Targets Point // Flushes trigger-unit and target-item from timer queue. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= private function CancelController takes nothing returns boolean local integer x = 0 if tt > 0 then loop if tu[x] == GetTriggerUnit() and (GetOrderPointX() != GetItemX(ti[x]) or GetOrderPointY() != GetItemY(ti[x])) then set tt = tt - 1 if tt > 0 then set tu[x] = tu[tt] set ti[x] = ti[tt] set x = x - 1 elseif not SPLIT_STACK or st <= 0 then call PauseTimer( t ) endif endif set x = x + 1 exitwhen x >= tt endloop endif return false endfunction
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // CONTROLLER : ActionController // EVENTS : Unit Acquires Item, Unit Targets Object // Main system controller. Determines unit order and runs actions accordingly. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= private function ActionController takes nothing returns boolean local item i = GetOrderTargetItem() local integer o = GetIssuedOrderId() local unit u local player p local item ii local integer is local integer iis local integer s local integer ss local boolean full local real ua local string str local sound snd if i == null then set i = GetManipulatedItem() endif set s = GetItemCharges( i ) if i != null and (o == 851971 or (s > 0 and (o == 0 or (o > 852001 and o < 852008)))) then set u = GetTriggerUnit() set is = UnitInventorySize( u ) if is > 0 then if o > 852001 and o < 852008 then // The item is being moved to another inventory slot if UnitHasItem(u, i) then set o = o - 852002 set ii = UnitItemInSlot( u, o ) if GetItemTypeId(ii) == GetItemTypeId(i) then if ii == i then // Split items if SPLIT then set full = UnitInventoryFull( u ) if s > 1 and (SPLIT_DROP or not full) then if SPLIT_SIZE > 0 then if SPLIT_SIZE >= s then set ss = s - 1 else set ss = SPLIT_SIZE endif else set ss = s / 2 endif call SetItemCharges( i, s - ss ) if SPLIT_STACK then set ii = null if st > 0 then set o = 0 loop if u == su[o] then set ii = sii[o] set iis = GetItemCharges( ii ) set s = GetItemLevel( ii ) exitwhen true endif set o = o + 1 exitwhen o >= st endloop endif endif if SPLIT_STACK and ii != null and ii != i and si[o] == i and (not USE_ITEM_LEVEL or s == 0 or iis < s) and UnitHasItem(u, ii) and GetItemTypeId(ii) == GetItemTypeId(i) then call SetItemCharges( ii, iis + ss ) set sc[o] = SPLIT_STACK_DELAY else set ua = GetUnitFacing( u ) set ii = CreateItem( GetItemTypeId(i), GetUnitX(u) + 100 * Cos(ua * bj_DEGTORAD), GetUnitY(u) + 100 * Sin(ua * bj_DEGTORAD) ) call SetItemCharges( ii, ss ) if not full then call DisableTrigger( gg_trg_EasyItemStacknSplit ) call UnitAddItem( u, ii ) call EnableTrigger( gg_trg_EasyItemStacknSplit ) if SPLIT_STACK then set o = 0 if st > 0 then loop if su[o] == u then set si[o] = i set sii[o] = ii set sc[o] = SPLIT_STACK_DELAY set o = -1 else set o = o + 1 endif exitwhen o >= st or o == -1 endloop endif if o >= 0 then if st == 0 then call TimerStart( t, 0.05, true, function TimerController ) endif set su[st] = u set si[st] = i set sii[st] = ii set sc[st] = SPLIT_STACK_DELAY set st = st + 1 endif endif else // Play the "Item Drop" sound set p = GetOwningPlayer( u ) //! runtextmacro EasyItemStacknSplit_PLAYITEMSOUND( "HeroDropItem1" ) endif endif endif endif else // Stack items set is = GetItemLevel( i ) set iis = GetItemCharges( ii ) if USE_ITEM_LEVEL and is > 0 and iis + s > is then if o < is and iis < GetItemLevel(ii) then call SetItemCharges( ii, iis + s - is ) call SetItemCharges( i, is ) endif else call SetItemCharges( ii, iis + s ) call RemoveItem( i ) endif endif endif endif elseif o == 851971 then if UnitInventoryFull(u) then // The item is being targeted with a full inventory so we add it to the timer queue set o = GetItemLevel( i ) set iis = GetItemTypeId( i ) set s = 0 loop set ii = UnitItemInSlot( u, s ) if ii != i and GetItemTypeId(ii) == iis and (not USE_ITEM_LEVEL or o == 0 or GetItemCharges(ii) < o) then set s = is + 1 else set s = s + 1 endif exitwhen s >= is endloop if s > is and GetItemCharges(i) > 0 then set s = 0 if tt > 0 then loop if tu[s] == u then set ti[s] = i set s = -1 else set s = s + 1 endif exitwhen s >= tt or s == -1 endloop endif if s >= 0 then if tt == 0 then call TimerStart( t, 0.05, true, function TimerController ) endif set tu[tt] = u set ti[tt] = i set tt = tt + 1 endif call IssuePointOrder( u, "move", GetItemX(i), GetItemY(i) ) else // Full inventory error call IssueImmediateOrder( u, "stop" ) set p = GetOwningPlayer( u ) // Play error sound if ERROR_SOUND != null and ERROR_SOUND != "" then set str = ERROR_SOUND if GetLocalPlayer() != p then set str = "" endif set snd = CreateSound( str, false, false, false, 12700, 12700, "" ) call SetSoundVolume( snd, 127 ) call StartSound( snd ) call KillSoundWhenDone( snd ) endif endif endif else // The item is being acquired so we stack it if UnitStackItem(u, i) then // Play the "Item Drop" sound set p = GetOwningPlayer( u ) //! runtextmacro EasyItemStacknSplit_PLAYITEMSOUND( "Sound\\Interface\\HeroDropItem1.wav" ) endif endif endif endif set u = null set p = null set i = null set ii = null set snd = null return false endfunction
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // CONTROLLER : PreloadController // EVENTS : Game Time Elapsed = 0.00 // Preloads sound files so that they play the first time around. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= private function PreloadController takes nothing returns boolean local string array str local sound snd local integer x = 0 set str[0] = "Sound\\Interface\\PickUpItem.wav" set str[1] = "Sound\\Interface\\HeroDropItem1.wav" if ERROR_SOUND != null and ERROR_SOUND != "" then set str[2] = ERROR_SOUND endif loop exitwhen str[x] == null set snd = CreateSound( str[x], false, false, false, 12700, 12700, "" ) call SetSoundVolume( snd, 0 ) call StartSound( snd ) call KillSoundWhenDone( snd ) set x = x + 1 endloop set snd = null call DestroyTrigger( GetTriggeringTrigger() ) return false endfunction
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // TRIGGER INITIALIZER //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= private function onInit takes nothing returns nothing local trigger CancelTrigger = CreateTrigger() local trigger PreloadTrigger = CreateTrigger() local integer x = 0 set gg_trg_EasyItemStacknSplit = CreateTrigger() loop call TriggerRegisterPlayerUnitEvent( gg_trg_EasyItemStacknSplit, Player(x), EVENT_PLAYER_UNIT_PICKUP_ITEM, null ) call TriggerRegisterPlayerUnitEvent( gg_trg_EasyItemStacknSplit, Player(x), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null ) call TriggerRegisterPlayerUnitEvent( CancelTrigger, Player(x), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null ) set x = x + 1 exitwhen x >= bj_MAX_PLAYER_SLOTS endloop call TriggerRegisterTimerEvent( PreloadTrigger, 0.00, false ) call TriggerAddCondition( gg_trg_EasyItemStacknSplit, function ActionController ) call TriggerAddCondition( CancelTrigger, function CancelController ) call TriggerAddCondition( PreloadTrigger, function PreloadController ) endfunction
endlibrary[/jass]
no se si tendra algo que ver..!!
necesito ayuda con esto y termino mi sistema de save load 
Última edición por CYK el Miér Mar 15, 2017 9:20 am, editado 1 vez |
|
Capitán

Barra de Salud : 
Mensajes : 149
Reputación : 30 Monedas de oro : 525 Monedas de Platino : 0 ![save/load Item charges [Resuelto] Empty](https://2img.net/i/fa/empty.gif)
Inventario : ![save/load Item charges [Resuelto] Empysl10](https://i.servimg.com/u/f73/18/43/73/24/empysl10.png) ![save/load Item charges [Resuelto] Empysl10](https://i.servimg.com/u/f73/18/43/73/24/empysl10.png)
![save/load Item charges [Resuelto] Empty](https://2img.net/i/fa/empty.gif) | (#) Tema: Re: save/load Item charges [Resuelto] Miér Mar 15, 2017 9:19 am | |
| Ya resolvi el tema todo era cuestion de darle un numero entero a cada objeto.! igual a los item stackables.. quedaria asi el detonador para salvar los objetos.
SAVE
[gui]Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Number of items carried by Hero) For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions) Bucle: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones (Item-type of (Item carried by Hero in slot Integer_A_Replacement)) No igual a (Item-type of Sin objeto) Entonces: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Or - Any (Conditions) are true Condiciones (Charges remaining in (Item carried by Hero in slot Integer_A_Replacement)) Mayor que 0 Entonces: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 1 Set SaveCount = (SaveCount + 1) Set Item = (Item carried by Hero in slot Integer_A_Replacement) Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item)) Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = (Charges remaining in (Item carried by Hero in slot Integer_A_Replacement)) Otros: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 2 Set SaveCount = (SaveCount + 1) Set Item = (Item carried by Hero in slot Integer_A_Replacement) Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item)) Set SaveCount = (SaveCount + 1) Otros: Acciones Set SaveCount = (SaveCount + 1) Set Save[SaveCount] = 0 Set SaveCount = (SaveCount + 2) [/gui]
y para el LOAD
[gui]Acciones Set LoadCount = (LoadCount + 1) For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions) Bucle: Acciones Set LoadCount = (LoadCount + 1) If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Load[LoadCount] No igual a 0 Entonces: Acciones If (All Conditions are True) then do (Then Actions) else do (Else Actions) Si: Condiciones Load[LoadCount] Igual a 1 Entonces: Acciones Set LoadCount = (LoadCount + 1) Héroe - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero Set LoadCount = (LoadCount + 1) Objeto - Set charges remaining in (Last created item) to Load[LoadCount] Otros: Acciones Set LoadCount = (LoadCount + 1) Héroe - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero Set LoadCount = (LoadCount + 1) Objeto - Set charges remaining in (Last created item) to Load[LoadCount] Otros: Acciones Set LoadCount = (LoadCount + 2) [/gui] |
|