Guest User

Tyler Howard - Odyssey Savegame Unrealscript

a guest
Mar 5th, 2013
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function SaveGameAtTarget(Vector loc)
  2. {
  3.     local Odyssey_SaveGameState SGS;
  4.     local int i;
  5.  
  6.     SGS = new () class'Odyssey_SaveGameState';
  7.     SGS.AbilitiesUnlocked = abilityInventory.AbilitiesFlags;
  8.    
  9.     SGS.currentLevel = SaveGameState.currentLevel;
  10.  
  11.     SGS.posX = loc.X;
  12.     SGS.posY = loc.Y;
  13.     SGS.posZ = loc.Z;
  14.  
  15.     SGS.bLevelStart = SaveGameState.bLevelStart;
  16.     SGS.CheckpointInt = SaveGameState.CheckpointInt;
  17.  
  18.     for(i = 0; i < 11; ++i)
  19.     {
  20.         SGS.earthMap[i] = SaveGameState.earthMap[i];
  21.         SGS.WindMap[i] = SaveGameState.WindMap[i];
  22.         SGS.LightMap[i] = SaveGameState.LightMap[i];
  23.     }
  24.  
  25.     for(i = 0; i < 14; ++i)
  26.     {
  27.         if(SGS.MotherMap[i] > 0)
  28.             SGS.MotherMap[i] = SaveGameState.MotherMap[i];
  29.     }
  30.  
  31.     for(i = 0; i < 4; ++i)
  32.     {
  33.         SGS.EarthSW[i] = SaveGameState.EarthSW[i];
  34.         SGS.WindSW[i] = SaveGameState.WindSW[i];
  35.         SGS.LightSW[i] = SaveGameState.LightSW[i];
  36.         SGS.MotherSW[i] = SaveGameState.MotherSW[i];
  37.     }
  38.  
  39.     //ScrubFileName("..\\..\\..\\Saves\\SaveGameState\\odysseysave.bin");
  40.     class'Engine'.static.BasicSaveObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\odysseysave2.bin", true, 1);
  41.     //`log("Saved game");
  42. }
  43.  
  44. exec function LoadGameSave(string savefilename)
  45. {
  46.     local Odyssey_SaveGameState SGS;
  47.     local Vector loc;
  48.     local int i;
  49.  
  50.     SGS = new () class'Odyssey_SaveGameState';
  51.  
  52.     if( class'Engine'.static.BasicLoadObject(SGS, "..\\..\\..\\Saves\\SaveGameState\\"$savefilename, true, 1) )
  53.     {
  54.         SaveGameState.AbilitiesUnlocked = SGS.AbilitiesUnlocked;
  55.         SaveGameState.currentLevel = SGS.currentLevel;
  56.  
  57.         abilityInventory.AbilitiesFlags = SaveGameState.AbilitiesUnlocked;
  58.        
  59.         if(!SGS.bLevelStart)
  60.         {
  61.             loc.X = SGS.posX;
  62.             loc.Y = SGS.posY;
  63.             loc.Z = SGS.posZ;
  64.             SaveGameState.CheckpointInt = SGS.CheckpointInt;
  65.             Pawn.setLocation(loc);
  66.         }
  67.  
  68.         SaveGameState.CheckpointInt = SGS.CheckpointInt;
  69.  
  70.         //touchup code:
  71.  
  72.         for(i = 0; i < 11; ++i)
  73.         {
  74.             SaveGameState.earthMap[i] = SGS.earthMap[i];
  75.             SaveGameState.WindMap[i] = SGS.WindMap[i];
  76.             SaveGameState.LightMap[i] = SGS.LightMap[i];
  77.         }
  78.  
  79.         for(i = 0; i <14; ++i)
  80.             SaveGameState.MotherMap[i] = SGS.MotherMap[i];
  81.  
  82.         for(i = 0; i < 5; ++i)
  83.         {
  84.             SaveGameState.EarthSW[i] = SGS.EarthSW[i];
  85.             SaveGameState.WindSW[i] = SGS.WindSW[i];
  86.             SaveGameState.LightSW[i] = SGS.LightSW[i];
  87.             SaveGameState.MotherSW[i] = SGS.MotherSW[i];
  88.         }
  89.  
  90.     }
  91.     else
  92.     {
  93.         SaveGameState.AbilitiesUnlocked=0;
  94.         SaveGameState.currentLevel=Wind;
  95.     }
  96.     //`log("Loaded game");
  97. }
RAW Paste Data