Frictional Games Forum (read-only)
Secret Idea (dun dun DUN) + Help Needed - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Secret Idea (dun dun DUN) + Help Needed (/thread-7224.html)

Pages: 1 2


Secret Idea (dun dun DUN) + Help Needed - Simpanra - 04-06-2011

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,


RE: Secret Idea (dun dun DUN) + Help Needed - Anxt - 04-06-2011

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.


RE: Secret Idea (dun dun DUN) + Help Needed - Simpanra - 04-06-2011

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? =)


RE: Secret Idea (dun dun DUN) + Help Needed - Anxt - 04-06-2011

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.


RE: Secret Idea (dun dun DUN) + Help Needed - MrBigzy - 04-06-2011

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

This SHOULD work, but I'm not 100% on it.


RE: Secret Idea (dun dun DUN) + Help Needed - Anxt - 04-06-2011

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


RE: Secret Idea (dun dun DUN) + Help Needed - Streetboat - 04-06-2011

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.


RE: Secret Idea (dun dun DUN) + Help Needed - palistov - 04-07-2011

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

In your callback, put

Code:
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!


RE: Secret Idea (dun dun DUN) + Help Needed - Anxt - 04-07-2011

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.


RE: Secret Idea (dun dun DUN) + Help Needed - palistov - 04-08-2011

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.