Hi there, i have a problem with my Save-Load Funktions... and i have no idea what i did wrong :D It used to work a while ago, but now it does not... nothing is restored and i don´t know where the mistake is....
Ok First Trigger : We need to preload, or else it doesn´t load after restarting the game :
**SaveGHOST**(ThistriggersavestheUnititsItems,anditsSkills(informofintegers)EventsGame-PlayerAnyPlayertypesachatmessagecontaining"SaveGhost",matchingExactlyLocalVariablesPlayer=(OwnerofHeroGHOST)<Integer>CarriedItems=(Emptyunitgroup)<UnitGroup[10]>x=1<Integer>y=0<Integer>ItemCount=0<Integer>ConditionsActionsBank-Openbank"NimoSaveGhost"forplayerPlayerBank-StoreunitHeroGHOSTas"GHOST"ofsection"HEROES"inbank(Lastopenedbank)------- CommentBank-StoreunitHeroes[Player]as"Hero"ofsection"Heroes"inbank(Lastopenedbank)UnitGroup-Addallunitsin(AllitemscarriedbyHeroes[Player])toCarriedItems[Player]Variable-SetItemCount=(NumberofAnyunitsinCarriedItems[Player])General-Foreachintegeryfrom0to10withincrement1,do(Actions)ActionsBank-Storeunit(UnitxfromCarriedItems[Player])as("Item"+(String(x)))ofsection"Items"inbank(Lastopenedbank)Variable-Modifyx:+1Bank-StoreintegerItemCountas"ItemCount"ofsection"Items"inbank(Lastopenedbank)------- CommentSAVEIntegerVariable(Player,(Lastopenedbank))------- CommentGeneral-Wait2.0GameTimesecondsBank-Savebank(Lastopenedbank)UI-Display("Saved for "+(Nameofplayer(OwnerofHeroGHOST)))for(Allplayers)toSubtitlearea
-------------------
So far so good, no Errors in this Trigger (at least it says so :D )
And then the Load Trigger :
**loadPlayer1**EventsGame-PlayerAnyPlayertypesachatmessagecontaining"LoadGhost",matchingExactlyLocalVariablesPlayer=1<Integer>x=1<Integer>y=0<Integer>Itemstobeloaded=NoUnit<Unit>ConditionsActions------- CommentBank-Openbank"NimoSaveGhost"forplayer1UI-Display("Loading for "+(NameofplayerPlayer))for(Allplayers)toSubtitleareaGeneral-Wait1.0GameTimesecondsBank-Restore"Hero"ofsection"Heroes"frombank(Lastopenedbank)forplayerPlayerat(CenterofDeckung1A)facing0.0General-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(Lastrestoredunit))==Hero-GhostThenVariable-SetHeroGHOST=(Lastrestoredunit)Unit-Set(Lastrestoredunit)MovementSpeedto0.0Unit-DisabletheMoveabilityfor(Lastrestoredunit)------- CommentVariable-SetRessEnergiezellen[Player]=(Load"Energiecell"ofsection"Ress"frombank(Lastopenedbank)asintegervalue)Variable-SetRessMetalle[Player]=(Load"Metal"ofsection"Ress"frombank(Lastopenedbank)asintegervalue)Dialog-SetDialogItemRessourcen[Player][0]textto(Text(RessMetalle[Player]))for(Playergroup(Player))Dialog-SetDialogItemRessourcen[Player][1]textto(Text(RessEnergiezellen[Player]))for(Playergroup(Player))Variable-SetIntegerLevelUpgradeSchadenGhostWaffe1[Player]=(Load"WaffeGhost1Schaden"ofsection"Items"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSchadenGhostWaffe2[Player]=(Load"WaffeGhost2Schaden"ofsection"Items"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSchildundPanzerGhostWaffe1[Player]=(Load"WaffeGhost1ShieldBonus"ofsection"Items"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeQucikdrawGhostWaffe2[Player]=(Load"WaffeGhost1Quickdraw"ofsection"Items"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeReichweiteGhostWaffe1[Player]=(Load"WaffeGhost1Range"ofsection"Items"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeHitpointsGhost[Player]=(Load"GhostHP"ofsection"Upgrade"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost1[Player]=(Load"SkillGhost1"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost1Range[Player]=(Load"SkillGhost1Range"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost2[Player]=(Load"SkillGhost2"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost3[Player]=(Load"SkillGhost3"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost4[Player]=(Load"SkillGhost4"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost5[Player]=(Load"SkillGhost5"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost6[Player]=(Load"SkillGhost6"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost7[Player]=(Load"SkillGhost7"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetIntegerLevelUpgradeSkillGhost8[Player]=(Load"SkillGhost8"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)Variable-SetTarnenergieproRunde=(Load"Tarnenergie"ofsection"Skills"frombank(Lastopenedbank)asintegervalue)------- CommentGeneral-Wait1.0GameTimesecondsVariable-SetHeroes[Player]=(Lastrestoredunit)Trigger-RunLoadP2WaffeGhost1Schaden(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2WaffeGhost2Schaden(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2WaffeGhost1SchieldPanzer(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2WaffeGhost1Range(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2Hitpoints(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2WaffeGhost1Quickdraw(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost1(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost1Range(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost2(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost3(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost4(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost5(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost6(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost7(IgnoreConditions,Don't Wait until it finishes)Trigger-RunLoadP2SkillGhost8(IgnoreConditions,Don't Wait until it finishes)ElseGeneral-Wait1.0GameTimesecondsUnitGroup-AddHeroes[Player]toHeroesUnitGroup------- CommentPlayer-ModifyplayerPlayerMinerals:SetTo(Load"Mineral"ofsection"Ress"frombank(Lastopenedbank)asintegervalue)Player-ModifyplayerPlayerVespene:SetTo(Load"Vespene"ofsection"Ress"frombank(Lastopenedbank)asintegervalue)General-Foreachintegeryfrom1to(Load"count"ofsection"Items"frombank(Lastopenedbank)asintegervalue)withincrement1,do(Actions)ActionsBank-Restore("Item"+(String(x)))ofsection"Items"frombank(Lastopenedbank)forplayerPlayerat(PositionofHeroes[Player])facing0.0Variable-SetItemstobeloaded=(Lastrestoredunit)Unit-Createone(Unittypeof(Lastrestoredunit))itemintheinventoryofHeroes[Player]Unit-RemoveItemstobeloadedfromthegameVariable-Modifyx:+1UI-Display("Loading complete"+(NameofplayerPlayer))for(Allplayers)toSubtitlearea------- Comment
-----------------
And there i get an TriggerError "could not get "bank" from paramenter in (value) ", and i have NO clue why. It doesn´t matter if i restart the map or do it in the same session, it won´t restore anything. But the Bank got saved, i have the File on my HDD (C:\Users\MyName\Documents\StarCraft II Beta\Banks), and when i open it, there is everything in there...
In your save trigger, you have the line:
Bank - Open bank "NimoSaveGhost" for player Player
When you open a bank, you can't use a variable for the player number, you need to change this line to:
Bank - Open bank "NimoSaveGhost" for player 1
You'll probably want to put these into the same trigger as your preload statements. Also, you'll have to make a global bank array ( I called it BankSaveFile ) to hold these:
Bank - Open bank "NimoSaveGhost" for player 1
Variable - Set variable BankSaveFile[1] = (Last opened bank)
Bank - Open bank "NimoSaveGhost" for player 2
Variable - Set variable BankSaveFile[2] = (Last opened bank)
Bank - Open bank "NimoSaveGhost" for player 3
Variable - Set variable BankSaveFile[3] = (Last opened bank)
etc..
Then reference them in your save trigger wherever you have (Last opened bank), use BankSaveFile[Player] instead.
Hi, well , the problem is not the Save Trigger, as i have the XML File on my harddisk, and it is everything in there that i wanted to be saved (all integers, all units and so on...) The Problem is the Load Trigger...
And i had global Bank Arrays before, didn´t work either, thats why i changed it, but it did not help anything :D.
Try moving the XML file and see if it's recreated if you run the map and try to save.
Also, are you saving some info in another trigger? There are quite a few load statements that load from sections that aren't saved in your save trigger.
You're saving the number of items under "ItemCount", but loading as "count".. the names need to be the same for it to work.
In the Save Trigger there is an Action Definition, ( SAVE Integer Variable(Player, (Last opened bank))
) which does basicly nothing else than save all the Integer Values. I tried it both ways, with action defintion and as single ""save integer in bank" actions within the trigger, nothing changed. However, heres the Action definition :
And i tested it : i deleted the XML, and it got recreated. I even tried a new trigger, in which i ONLY try to recreate the unit, but doens´t work either... i have no idea, maybe it works with the release version... well see tomorrow
Ok, it was a simple, but annoying Bug. I simpy deleted the "restore Unit" Action in the Load trigger, createt a new one with EXACT the same paramenters, and its working again....
im havinga similar, but more issolated problem, my preload and sync trigger is working for some save files, but not all.
in my map i have 6 save files, for 12 players, and i was doing testing on my map in single player and files 1,2 4,6 will load, but 3 and 4 wont when i start a new game. but ALL of them work with saving/loading all the correct info in the same game, so im left to think it's the preload trigger at map initialization. but i've proof read it at least 10 times and i cant find inconsistencies. what could be causing this? I really need to know becase im making a ORPG and i dont want people to have to keep starting over because my save files arny loading =(
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi there, i have a problem with my Save-Load Funktions... and i have no idea what i did wrong :D It used to work a while ago, but now it does not... nothing is restored and i don´t know where the mistake is....
Ok First Trigger : We need to preload, or else it doesn´t load after restarting the game :
--------------------------------------------So far so good, no Errors in this Trigger (at least it says so :D )
And then the Load Trigger :
-----------------And there i get an TriggerError "could not get "bank" from paramenter in (value) ", and i have NO clue why. It doesn´t matter if i restart the map or do it in the same session, it won´t restore anything. But the Bank got saved, i have the File on my HDD (C:\Users\MyName\Documents\StarCraft II Beta\Banks), and when i open it, there is everything in there...
In your save trigger, you have the line:
Bank - Open bank "NimoSaveGhost" for player Player
When you open a bank, you can't use a variable for the player number, you need to change this line to:
Bank - Open bank "NimoSaveGhost" for player 1
You'll probably want to put these into the same trigger as your preload statements. Also, you'll have to make a global bank array ( I called it BankSaveFile ) to hold these:
Bank - Open bank "NimoSaveGhost" for player 1
Variable - Set variable BankSaveFile[1] = (Last opened bank)
Bank - Open bank "NimoSaveGhost" for player 2
Variable - Set variable BankSaveFile[2] = (Last opened bank)
Bank - Open bank "NimoSaveGhost" for player 3
Variable - Set variable BankSaveFile[3] = (Last opened bank)
etc..
Then reference them in your save trigger wherever you have (Last opened bank), use BankSaveFile[Player] instead.
@Glynn: Go
Hi, well , the problem is not the Save Trigger, as i have the XML File on my harddisk, and it is everything in there that i wanted to be saved (all integers, all units and so on...) The Problem is the Load Trigger...
And i had global Bank Arrays before, didn´t work either, thats why i changed it, but it did not help anything :D.
Try moving the XML file and see if it's recreated if you run the map and try to save.
Also, are you saving some info in another trigger? There are quite a few load statements that load from sections that aren't saved in your save trigger.
You're saving the number of items under "ItemCount", but loading as "count".. the names need to be the same for it to work.
Wait, what? Really?
@Glynn: Go
In the Save Trigger there is an Action Definition, ( SAVE Integer Variable(Player, (Last opened bank)) ) which does basicly nothing else than save all the Integer Values. I tried it both ways, with action defintion and as single ""save integer in bank" actions within the trigger, nothing changed. However, heres the Action definition :
And i tested it : i deleted the XML, and it got recreated. I even tried a new trigger, in which i ONLY try to recreate the unit, but doens´t work either... i have no idea, maybe it works with the release version... well see tomorrow
Ok, it was a simple, but annoying Bug. I simpy deleted the "restore Unit" Action in the Load trigger, createt a new one with EXACT the same paramenters, and its working again....
Well, case closed :D
Quote from Glynn:
When you open a bank, you can't use a variable for the player number, you need to change this line to:
----
Thanks for this. It's absolutely retarded you have to do this, but nothing a switch can't fix.
im havinga similar, but more issolated problem, my preload and sync trigger is working for some save files, but not all.
in my map i have 6 save files, for 12 players, and i was doing testing on my map in single player and files 1,2 4,6 will load, but 3 and 4 wont when i start a new game. but ALL of them work with saving/loading all the correct info in the same game, so im left to think it's the preload trigger at map initialization. but i've proof read it at least 10 times and i cant find inconsistencies. what could be causing this? I really need to know becase im making a ORPG and i dont want people to have to keep starting over because my save files arny loading =(