Frictional Games Forum (read-only)
[SCRIPT] Saving the game when the player interacts with something like a bed - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Saving the game when the player interacts with something like a bed (/thread-16407.html)

Pages: 1 2


Saving the game when the player interacts with something like a bed - Skiveo - 06-22-2012

How do people make it so that when you click something for example a bed the game saves, this would be really helpfull

Thanks


RE: Saving the game when the player interacts with something like a bed - drunkmonk - 06-22-2012

AutoSave();


RE: Saving the game when the player interacts with something like a bed - i3670 - 06-22-2012

Well first you need to create a script area and tick the interact-box, write the callback etc.

Then I believe you use
AutoSave();

EDIT:
Dammit! Ninjad.


RE: Saving the game when the player interacts with something like a bed - drunkmonk - 06-22-2012

sorry for the vivid response i was caught up in my custom story lol


RE: Saving the game when the player interacts with something like a bed - Skiveo - 06-22-2012

Hm it won't work, this is what I did (not sure if I did it right >_<)
I putted down a bed first made a script area and in the .hps file I typed:

SetEntityPlayerInteractCallback("ScriptArea_1", "Save", false);

and then:


void Save(string &in asChild, string &in asParent, int alState)
{
AutoSave();
SetMessage("Messages", "PopUp5", 0);
///////this is so that the player will see the game is save.
}


RE: Saving the game when the player interacts with something like a bed - drunkmonk - 06-22-2012

(06-22-2012, 09:12 PM)Skiveo Wrote: Hm it won't work, this is what I did (not sure if I did it right >_<)
I putted down a bed first made a script area and in the .hps file I typed:

SetEntityPlayerInteractCallback("ScriptArea_1", "Save", false);

and then:


void Save(string &in asChild, string &in asParent, int alState)
{
AutoSave();
SetMessage("Messages", "PopUp5", 0);
///////this is so that the player will see the game is save.
}
its not SetEntityInteractCallback, you have to use AddEntityCollideCallback("Player", "ScriptArea_1", "Save", true, 1);


RE: Saving the game when the player interacts with something like a bed - Skiveo - 06-22-2012

Thanks, it works, is there also a way that when the player steps on the bed he will ''fall asleep''?


RE: Saving the game when the player interacts with something like a bed - drunkmonk - 06-22-2012

(06-22-2012, 09:20 PM)Skiveo Wrote: Thanks, it works, is there also a way that when the player steps on the bed he will ''fall asleep''?
along the same lines as before, have your script area on the bed and when the player enters the area have the screen fade out and use FadePlayerRollTo.
Something like this
AddEntityCollideCallback("Player", "ScriptArea_2", "Sleep", true, 1);

void Sleep(string &in asParent, string &in asChild, int alState)
{
FadeOut(10.0);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetPlayerCrouching(true);
FadePlayerRollTo(50,150,150);
}
//may need to play around with it a little


RE: Saving the game when the player interacts with something like a bed - Skiveo - 06-22-2012

Ok, just one more thing, how do I take away the Save and Exit button when you press escape? (not just for me but for everyone who downloads it)


RE: Saving the game when the player interacts with something like a bed - drunkmonk - 06-22-2012

(06-22-2012, 09:33 PM)Skiveo Wrote: Ok, just one more thing, how do I take away the Save and Exit button when you press escape? (not just for me but for everyone who downloads it)
I'm not sure that you can