Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i increase sanity to a player?
BIgcheker12 Offline
Junior Member

Posts: 34
Threads: 8
Joined: Aug 2011
Reputation: 0
#1
How do i increase sanity to a player?

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.

Work in Progress:
Big-Dark-House
Lost but not alone...
06-15-2014, 01:43 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: How do i increase sanity to a player?

(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: (Select All)
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: (Select All)
GiveSanityBoost();
//OR
GiveSanityBoostSmall(); 

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-15-2014, 01:57 PM by Romulator.)
06-15-2014, 01:53 PM
Find
BIgcheker12 Offline
Junior Member

Posts: 34
Threads: 8
Joined: Aug 2011
Reputation: 0
#3
RE: How do i increase sanity to a player?

(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: (Select All)
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: (Select All)
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

Work in Progress:
Big-Dark-House
Lost but not alone...
06-15-2014, 02:05 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#4
RE: How do i increase sanity to a player?

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();
}
(This post was last modified: 06-15-2014, 02:09 PM by DnALANGE.)
06-15-2014, 02:07 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: How do i increase sanity to a player?

(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...)

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-15-2014, 02:10 PM by Romulator.)
06-15-2014, 02:09 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#6
RE: How do i increase sanity to a player?

Yeah Rom... still when you use AddPlayerSanity(100); that is the MAX amounth to give Tongue
We know what we mean Wink hehhe
(This post was last modified: 06-15-2014, 02:10 PM by DnALANGE.)
06-15-2014, 02:10 PM
Find
BIgcheker12 Offline
Junior Member

Posts: 34
Threads: 8
Joined: Aug 2011
Reputation: 0
#7
RE: How do i increase sanity to a player?

(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?

Work in Progress:
Big-Dark-House
Lost but not alone...
06-15-2014, 02:11 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: How do i increase sanity to a player?

DnALANGE already answered that. All you need is a simple AutoSave(); line.

06-15-2014, 02:52 PM
Find




Users browsing this thread: 2 Guest(s)