Frictional Games Forum (read-only)

Full Version: How do i increase sanity to a player?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Question in title..
I want to do it like this:
Player touches Entity=Gets Sanity (without drinking sanity potion)
I know how to increase the Insanity, but i need to increase the sanity.


Thanks for all the answers.
(06-15-2014, 01:43 PM)BIgcheker12 Wrote: [ -> ]I know how to increase the Insanity, but i need to increase the sanity.

So your saying that if the player touches an entity, they get more sane? Like the effects of the Sanity Potion? If so, quite easy! Smile

PHP Code:
void OnStart()
{
SetEntityPlayerInteractCallback("<Name_Of_Item_to_interact_with>""give_me_sanity"false);
}
//Change the Name_of_Item... to the item you're touching in the Level Editor :3, still within the ""

void give_me_sanity(string &in asEntity)
{
AddPlayerSanity(10.0f);


Change the false in the SetEntityPlayerInteractCallback to true if you only want the player to get their sanity once.
And Change the 10.0f to however much Sanity you want the player to receive.

If you want the "sanity effect" to show up (screen flashes white), instead of AddPlayerSanity, use either:

PHP Code:
GiveSanityBoost();
//OR
GiveSanityBoostSmall(); 

ALL of Amnesia's scripts can be found at the wiki at this page:
https://wiki.frictionalgames.com/doku.ph..._functions
(06-15-2014, 01:53 PM)Romulator Wrote: [ -> ]
(06-15-2014, 01:43 PM)BIgcheker12 Wrote: [ -> ]I know how to increase the Insanity, but i need to increase the sanity.

So your saying that if the player touches an entity, they get more sane? Like the effects of the Sanity Potion? If so, quite easy! Smile

PHP Code:
void OnStart()
{
SetEntityPlayerInteractCallback("<Name_Of_Item_to_interact_with>""give_me_sanity"false);
}
//Change the Name_of_Item... to the item you're touching in the Level Editor :3, still within the ""

void give_me_sanity(string &in asEntity)
{
AddPlayerSanity(10.0f);


Change the false in the SetEntityPlayerInteractCallback to true if you only want the player to get their sanity once.
And Change the 10.0f to however much Sanity you want the player to receive.

If you want the "sanity effect" to show up (screen flashes white), instead of AddPlayerSanity, use either:

PHP Code:
GiveSanityBoost();
//OR
GiveSanityBoostSmall(); 

ALL of Amnesia's scripts can be found at the wiki at this page:
https://wiki.frictionalgames.com/doku.ph..._functions

Alright 2 more questions: 1. Whats the max sanity you can have? And 2. Can you make it work, that when you touch this item, your game will be auto-saved?

Trying to do something completely new Big Grin
MAX sanity = 100 ... you will fall on the ground with the high pitch sound.
Like AddPlayerSanity(100); // will be the highest number available ( max sanity )
---
void give_me_sanity(string &in asEntity)
{
AddPlayerSanity(10.0f);
AutoSave();
}
(06-15-2014, 02:07 PM)DnALANGE Wrote: [ -> ]MAX sanity = 100 ... you will fall on the ground with the high pitch sound.

Actually, other way around, when Sanity is 0, you fall on the ground :3

But yes, Maximum Sanity is 100 or 100.0f, so Crystal Clear would appear in the Inventory (>74.999999999...)
Yeah Rom... still when you use AddPlayerSanity(100); that is the MAX amounth to give Tongue
We know what we mean Wink hehhe
(06-15-2014, 02:10 PM)DnALANGE Wrote: [ -> ]Yeah Rom... still when you use AddPlayerSanity(100); that is the MAX amounth to give Tongue
We know what we mean Wink hehhe

Alright and what about touching an Item and then your game saves automatically?
DnALANGE already answered that. All you need is a simple AutoSave(); line.