Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: KodiakBehr on Fri 15/03/2013 02:32:06

Title: Randomize on load.
Post by: KodiakBehr on Fri 15/03/2013 02:32:06
Okay, this is a fun question.

Is there any way I can randomize something upon the loading of a save-game?  I want to prevent players from being able to brute-force a solution.

Thanks!
Title: Re: Randomize on load.
Post by: Gilbert on Fri 15/03/2013 02:38:26
You can detect whether a savegame is loaded by checking for the event eEventRestoreGame in the on_event() (http://www.adventuregamestudio.co.uk/manual/TextScriptEvents.htm) global function.

Just do something like below in the global script:
Code (AGS) Select

function on_event(EventType event, int data){
  if (event == eEventRestoreGame) {
    //randomise codes here
  }
}
Title: Re: Randomize on load.
Post by: KodiakBehr on Fri 15/03/2013 02:39:35
Fantastic.  Thank you kindly!
Title: Re: Randomize on load.
Post by: amateurhour on Fri 15/03/2013 19:58:17
Also you're evil for doing this : )
Title: Re: Randomize on load.
Post by: Snarky on Fri 15/03/2013 20:26:05
You should at least give players some warning (i.e. putting in some visual cue when the puzzle re-randomizes itself). Otherwise players are liable to get stuck because of the meta-logic rather than on the puzzle itself.
Title: Re: Randomize on load.
Post by: Crimson Wizard on Fri 15/03/2013 20:35:47
No warning, only hardcore. This must be in every game XD.