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
Secret Idea (dun dun DUN) + Help Needed
Simpanra Offline
Senior Member

Posts: 314
Threads: 28
Joined: Mar 2011
Reputation: 0
#1
Secret Idea (dun dun DUN) + Help Needed

Ok, so i have this little idea going which i am going to keep up my sleeve for a little longer, however i need some help, i have something i need to do which will greatly improve the effect i am aiming to achieve. So, cutting to the chase (or in Amnesia terms, the chase is cutting you into salami), I need to create an area (approximately 5 or 6 metres long) in which your character looses a certain amount of his sanity, but i need it so that once you leave that area your sanity returns ASAP. I need his sanity to lower to the point where objects appear to go all "wobbly" and swirl around =) I really hope you guys can help me with this because i think my idea is quite unique (i haven't seen anything like it on the forums).

Thank you so much guys =)
Edd,
04-06-2011, 09:19 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#2
RE: Secret Idea (dun dun DUN) + Help Needed

Make a second area that calls a function that uses SetPlayerSanity at the end of the first. You can do the same for the first area if you wish to deal sanity damage in a non-traditional way.

04-06-2011, 09:20 PM
Find
Simpanra Offline
Senior Member

Posts: 314
Threads: 28
Joined: Mar 2011
Reputation: 0
#3
RE: Secret Idea (dun dun DUN) + Help Needed

Do you mean set the sanity damage at the beginning of my area and then make a script area at the end to reduce it again? =)
04-06-2011, 09:37 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#4
RE: Secret Idea (dun dun DUN) + Help Needed

Something like that. The area you want the player's vision to blur would be the one to cause sanity damage, and the place where you want the player's sanity to return to normal would be where you put the second area, and use the SetPlayerSanity function.

04-06-2011, 09:47 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#5
RE: Secret Idea (dun dun DUN) + Help Needed

You'll only need the one function. But when you make the collide, set the state as 0. Then you would put:
if(AlStates=="1") //Drain sanity here
if(alStates=="-1") //Max out sanity here

This SHOULD work, but I'm not 100% on it.
04-06-2011, 09:49 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#6
RE: Secret Idea (dun dun DUN) + Help Needed

I considered suggesting that, but honestly it just seems easier to do it with 2 areas. But maybe I'm just weird like that...

I tend to do things in strange ways by force of habit rather than saving myself time Tongue

04-06-2011, 09:55 PM
Find
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#7
RE: Secret Idea (dun dun DUN) + Help Needed

Check out the scripts for the trancept level, the torture rooms constantly damage your sanity at a rate of .3 per second or something, and it plays a scary sound, too! Just use that code and then add another area outside that with SetPlayerSanity as its collision callback, and make sure it's set to not destroy the callback on running. Also, make the area outside the one you want to destroy your sanity be inactive by default, then once the sanity destroying area is entered, enable it. Then make the second function disable itself again.

Basically:

Area 1: the one that destroys sanity.
Area 2: the one that restores it back.

Area 1 is active by default, area 2 is inactive by default. Player enters area 1, and it constantly damages sanity and plays a sound as long as the player is in it. It also enables area 2. Player then enters area 2, runs SetPlayerSanity, and disables itself so it can't be triggered again until it's enabled again by area 1.

[Image: signature-2.png]
04-06-2011, 09:55 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: Secret Idea (dun dun DUN) + Help Needed

Create the collide where the alState is 0, so it triggers its function on both exiting and entering the area.

In your callback, put

if(alState == 1) {
SetLocalVarInt("areacheck", 1);
SetLocalVarFloat("defaultsanity", GetPlayerSanity());
}
if(alState == -1) Set LocalVarInt("areacheck", -1);
SetLocalVarInt("damage", 0);
if(GetLocalVarInt("areacheck") == 1) {
for(int s=1;s<100;s++) AddTimer("drain"+s, 1.0, "SanityDrain");
}
if(GetLocalVarInt("areacheck") == -1) RestoreDrainedSanity();

void SanityDrain(string &in asTimer)
{
GiveSanityDamage(5, false);
AddLocalVarInt("damage", 5); //I suggest not using effects. This may turn out to be very annoying
}

void RestoreDrainedSanity()
{
SetPlayerSanity(GetPlayerSanity() + GetLocalVarFloat("defaultsanity"))
for(int s=1;s<100;s++) RemoveTimer("drain"+s);
}


I'll give this a test later; tied up at the moment. If you want the sanity to instantly be reduced to a set amount, use SetPlayerSanity() as suggested in above posts, as opposed to draining it. Drain would probably be smoother gameplay-wise. Smile Good luck!

(This post was last modified: 04-07-2011, 07:54 PM by palistov.)
04-07-2011, 07:52 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#9
RE: Secret Idea (dun dun DUN) + Help Needed

Palistov, the only problem with that method is you would have to set the AutoDestroy to false, which would mean if the player goes back through it, it would continue to happen unless a second area is placed after the first which deactivates the first. So, if the creator doesn't want it to happen more than once, 2 areas is the only way to go. However, if it is like the morgue, then one area would do just fine.

04-07-2011, 09:48 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#10
RE: Secret Idea (dun dun DUN) + Help Needed

Yeah I see what you mean. I was unclear on exactly what Simprana was trying to achieve, but if a constant sanity drain is what they want then that single area should work, just add a RemoveEntityCollideCallback() function in the exit function.

04-08-2011, 12:18 AM
Find




Users browsing this thread: 1 Guest(s)