This system is really work,, but! it only works when i get the code and load it in a single game, so it could be 2 heroes in game but it was only a test map. anyway,,, it works my items back, the charges was back,, i seems good, but when i restart the game and load my code the only thing the change was the charges of my items, example it was 4 charges when i restart my game the charges gone......... why this happen what should i do????????. anyone can help me??
Anyone can help i will give + rep
i hope i solved this.
can teach me how to upload a wider than this!!
Trigger 1
[TRIGGER=SaveLoad Save Copy
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Actions
Set SaveCount = 0
Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Set Hero = (Picked unit))
Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
Set SaveCount = (SaveCount + 1)
-------- Save players gold. --------
Set Save[SaveCount] = ((Triggering player) Current gold)
Set SaveCount = (SaveCount + 1)
-------- Save heroes level. --------
Set Save[SaveCount] = (Hero level of Hero)
Set SaveCount = (SaveCount + 1)
-------- Save heroes items. --------
Set Save[SaveCount] = (Number of items carried by Hero)
Set SaveCount = (SaveCount + 1)
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by Hero in slot (Integer A))) Not equal to (Item-type of No item)
Then - Actions
Set Item = (Item carried by Hero in slot (Integer A))
Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 1 to 1, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[1] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 2 to 2, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[2] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 3 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[3] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 4 to 4, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[4] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 5 to 5, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[5] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 6 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[6] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
-------- Show Code --------
Custom script: set udg_Code = CodeGen_Compile()
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code.[/TRIGGER]
[TRIGGER=/SaveLoad Load Copy
Events
Player - Player 1 (Red) 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 - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
Set Hero = (Last created unit)
Selection - Select (Last created unit) for (Triggering player)
Set LoadCount = (LoadCount + 1)
-------- Now load players gold --------
Player - Set (Triggering player) Current gold to Load[LoadCount]
-------- Load heroes level --------
Set LoadCount = (LoadCount + 1)
Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
-------- Now items --------
Set LoadCount = (LoadCount + 1)
For each (Integer A) from 0 to Load[LoadCount], do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
Trigger - Turn off (This trigger)
For each (Integer A) from 0 to 1, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[1]
For each (Integer A) from 2 to 2, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[2]
For each (Integer A) from 3 to 3, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[3]
For each (Integer A) from 4 to 4, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[4]
For each (Integer A) from 5 to 5, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[5]
For each (Integer A) from 6 to 6, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[6].[/TRIGGER]
Trigger 2
http://s365.photobucket.com/albums/...oo96/rj_john12/?action=view¤t=trig1.jpg
Anyone can help i will give + rep
i hope i solved this.
can teach me how to upload a wider than this!!
Trigger 1
[TRIGGER=SaveLoad Save Copy
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Actions
Set SaveCount = 0
Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Set Hero = (Picked unit))
Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
Set SaveCount = (SaveCount + 1)
-------- Save players gold. --------
Set Save[SaveCount] = ((Triggering player) Current gold)
Set SaveCount = (SaveCount + 1)
-------- Save heroes level. --------
Set Save[SaveCount] = (Hero level of Hero)
Set SaveCount = (SaveCount + 1)
-------- Save heroes items. --------
Set Save[SaveCount] = (Number of items carried by Hero)
Set SaveCount = (SaveCount + 1)
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by Hero in slot (Integer A))) Not equal to (Item-type of No item)
Then - Actions
Set Item = (Item carried by Hero in slot (Integer A))
Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 1 to 1, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[1] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 2 to 2, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[2] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 3 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[3] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 4 to 4, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[4] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 5 to 5, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[5] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
For each (Integer A) from 6 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Charges remaining in (Item carried by Hero in slot (Integer A))) Not equal to (Charges remaining in No item)
Then - Actions
Set Item_Charges[6] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
Set SaveCount = (SaveCount + 1)
Else - Actions
-------- Show Code --------
Custom script: set udg_Code = CodeGen_Compile()
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code.[/TRIGGER]
[TRIGGER=/SaveLoad Load Copy
Events
Player - Player 1 (Red) 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 - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
Set Hero = (Last created unit)
Selection - Select (Last created unit) for (Triggering player)
Set LoadCount = (LoadCount + 1)
-------- Now load players gold --------
Player - Set (Triggering player) Current gold to Load[LoadCount]
-------- Load heroes level --------
Set LoadCount = (LoadCount + 1)
Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
-------- Now items --------
Set LoadCount = (LoadCount + 1)
For each (Integer A) from 0 to Load[LoadCount], do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
Trigger - Turn off (This trigger)
For each (Integer A) from 0 to 1, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[1]
For each (Integer A) from 2 to 2, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[2]
For each (Integer A) from 3 to 3, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[3]
For each (Integer A) from 4 to 4, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[4]
For each (Integer A) from 5 to 5, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[5]
For each (Integer A) from 6 to 6, do (Actions)
Loop - Actions
Set LoadCount = (LoadCount + 1)
Item - Set charges remaining in (Item carried by Hero in slot (Integer A)) to Item_Charges[6].[/TRIGGER]
Trigger 2
http://s365.photobucket.com/albums/...oo96/rj_john12/?action=view¤t=trig1.jpg
Attachments
Last edited: