Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i make the Sanity script?
Author Message
Clear Offline
Junior Member

Posts: 19
Joined: May 2012
Reputation: 0
Post: #1
How do i make the Sanity script?
Hey guys!
I'm really new at scripting amnesia custom stories and with HPL editor Big Grin

My question is how exacly can you make a Sanity Script?
Let's say i've set an area (script) and exacly when the players goes in that area that awesome screen zooming with the sound effects happens Smile

Thanks! Big Grin

And only if it's possible, a script that activates the sanity, AND makes his lantern go off (he can still light it up, just to let the lantern off his hand)
(This post was last modified: 05-25-2012 01:55 PM by Clear.)
05-25-2012 01:50 PM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 275
Joined: Apr 2012
Reputation: 15
Post: #2
RE: How do i make the Sanity script?
I don't understand what "Sanity Script" means?

Do you want to raise/lower the sanity?

Raising, just put one of these lines of code in your script:

GiveSanityBoost();
GiveSanityBoostSmall();

To lower it:

GiveSanityDamage(int number, bool showeffects);

for example:
GiveSanityDamage(10, true);

Alternatively, you can manually set it, but this is less dynamic and more brute force:
SetPlayerSanity(50);

100 - Full Sanity
75 - Slight headache
50 - Head is pounding and hands are shaking
25 - ...

Check me out at my youtube channel: http://www.youtube.com/user/Putmalk?feature=mhee

I post videos of my Amnesia creations.
05-25-2012 01:54 PM
Find all posts by this user Quote this message in a reply
Clear Offline
Junior Member

Posts: 19
Joined: May 2012
Reputation: 0
Post: #3
RE: How do i make the Sanity script?
(05-25-2012 01:54 PM)Putmalk Wrote:  I don't understand what "Sanity Script" means?

Do you want to raise/lower the sanity?

Raising, just put one of these lines of code in your script:

GiveSanityBoost();
GiveSanityBoostSmall();

To lower it:

GiveSanityDamage(int number, bool showeffects);

for example:
GiveSanityDamage(10, true);

Alternatively, you can manually set it, but this is less dynamic and more brute force:
SetPlayerSanity(50);

100 - Full Sanity
75 - Slight headache
50 - Head is pounding and hands are shaking
25 - ...
By sanity script i mean that, well, kinda hard to explain.... i'll try i guess, it's like one of those creepy custom stories where you enter a room and the author have placed some Area that when you go by pass it your sanity like goes down, when the screen gets blurry for like half a second and the screen zoomes in and that "Boom" sound effect comes.

And once again soory if i sound noobish Tongue
05-25-2012 02:00 PM
Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #4
RE: How do i make the Sanity script?
You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like so

void OnStart()
{
AddEntityCollideCallback("Player", "RoomArea", "SanityDamage", true, 1);
}
void SanityDamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
}

05-25-2012 02:25 PM
Find all posts by this user Quote this message in a reply
Clear Offline
Junior Member

Posts: 19
Joined: May 2012
Reputation: 0
Post: #5
RE: How do i make the Sanity script?
(05-25-2012 02:25 PM)Obliviator27 Wrote:  You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like so

void OnStart()
{
AddEntityCollideCallback("Player", "RoomArea", "SanityDamage", true, 1);
}
void SanityDamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
}
Thanks!
But i have a problem while putting the script down the HPS file, when i put it and load the game it gives me an error wich says function with the same parameters allready exicts... i have 2 void OnStart() in 1 HPS file, is that suppose to be like it?
One of it is for a key & door script, what do i need to do?
05-25-2012 02:34 PM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 275
Joined: Apr 2012
Reputation: 15
Post: #6
RE: How do i make the Sanity script?
(05-25-2012 02:34 PM)Clear Wrote:  
(05-25-2012 02:25 PM)Obliviator27 Wrote:  You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like so

void OnStart()
{
AddEntityCollideCallback("Player", "RoomArea", "SanityDamage", true, 1);
}
void SanityDamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
}
Thanks!
But i have a problem while putting the script down the HPS file, when i put it and load the game it gives me an error wich says function with the same parameters allready exicts... i have 2 void OnStart() in 1 HPS file, is that suppose to be like it?
One of it is for a key & door script, what do i need to do?
No. NEVER have two functions with the same name in it.

A basic script always looks like:

void OnStart()
{

}

void OnEnter()
{

}

void OnLeave()
{

}

Check me out at my youtube channel: http://www.youtube.com/user/Putmalk?feature=mhee

I post videos of my Amnesia creations.
05-25-2012 02:44 PM
Find all posts by this user Quote this message in a reply
Clear Offline
Junior Member

Posts: 19
Joined: May 2012
Reputation: 0
Post: #7
RE: How do i make the Sanity script?
(05-25-2012 02:44 PM)Putmalk Wrote:  
(05-25-2012 02:34 PM)Clear Wrote:  
(05-25-2012 02:25 PM)Obliviator27 Wrote:  You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like so

void OnStart()
{
AddEntityCollideCallback("Player", "RoomArea", "SanityDamage", true, 1);
}
void SanityDamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
}
Thanks!
But i have a problem while putting the script down the HPS file, when i put it and load the game it gives me an error wich says function with the same parameters allready exicts... i have 2 void OnStart() in 1 HPS file, is that suppose to be like it?
One of it is for a key & door script, what do i need to do?
No. NEVER have two functions with the same name in it.

A basic script always looks like:

void OnStart()
{

}

void OnEnter()
{

}

void OnLeave()
{

}
This is my .HPS so far,



////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key1", "DoorName01", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("DoorName01", false, true);
PlaySoundAtEntity("", "unlock_door", "DoorName01", 0, false);
RemoveItem("key1");
}

{
AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1);
}
void SanityDamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
}

I removed the second "void OnStart()" and it looks like this, it gives me an error of Unexpected token in 14,1, what the Hell do i do Q_Q
05-25-2012 02:51 PM
Find all posts by this user Quote this message in a reply
wolfmaster1231 Offline
Member

Posts: 114
Joined: May 2012
Reputation: 2
Post: #8
RE: How do i make the Sanity script?
AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1) this should be under
AddUseItemCallback
05-25-2012 02:57 PM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 275
Joined: Apr 2012
Reputation: 15
Post: #9
RE: How do i make the Sanity script?
(14, 1) refers to line 14, character 1.

In this case, you are misusing the "{" "}". They cannot be floating around there. May I suggest reviewing a basic scripting tutorial, as syntax errors like these will stop you from doing anything.

When utilizing those brackets, they have to be after a function.

Like:
void OnStart()
{

}

Alternatively, after an if-else statement:

if(whatever)
{

}
else
{

}

or a loop

for(int i=0;i<5;i++)
{

}

So, specifically, your error is right here:
{

AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1);

}

Just shift that into the original void OnStart(), so it looks like
void OnStart()
{
AddUseItemCallback("", "key1", "DoorName01", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1);
}

And remove that line plus the brackets where you had it.

Check me out at my youtube channel: http://www.youtube.com/user/Putmalk?feature=mhee

I post videos of my Amnesia creations.
(This post was last modified: 05-25-2012 03:01 PM by Putmalk.)
05-25-2012 03:01 PM
Find all posts by this user Quote this message in a reply
Clear Offline
Junior Member

Posts: 19
Joined: May 2012
Reputation: 0
Post: #10
RE: How do i make the Sanity script?
(05-25-2012 02:57 PM)wolfmaster1231 Wrote:  AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1) this should be under
AddUseItemCallback

Can you write that for me please?
05-25-2012 03:03 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: