BIgcheker12
Junior Member
Posts: 34
Threads: 8
Joined: Aug 2011
Reputation:
0
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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!
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:
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
(This post was last modified: 06-15-2014, 01:57 PM by Romulator.)
|
|
06-15-2014, 01:53 PM |
|
BIgcheker12
Junior Member
Posts: 34
Threads: 8
Joined: Aug 2011
Reputation:
0
|
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!
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:
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
Work in Progress:
Big-Dark-House
Lost but not alone...
|
|
06-15-2014, 02:05 PM |
|
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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
(This post was last modified: 06-15-2014, 02:10 PM by Romulator.)
|
|
06-15-2014, 02:09 PM |
|
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
|
RE: How do i increase sanity to a player?
Yeah Rom... still when you use AddPlayerSanity(100); that is the MAX amounth to give
We know what we mean hehhe
(This post was last modified: 06-15-2014, 02:10 PM by DnALANGE.)
|
|
06-15-2014, 02:10 PM |
|
BIgcheker12
Junior Member
Posts: 34
Threads: 8
Joined: Aug 2011
Reputation:
0
|
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
We know what we mean 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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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 |
|
|