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 to make a "Scary door?"
sacroid Offline
Member

Posts: 88
Threads: 11
Joined: Apr 2010
Reputation: 0
#1
How to make a "Scary door?"

Hey there guys, I'm making now a serious story and I need to know how to make a "scary door". What I mean with Scary door, I mean:
You interact with a locked door, and by touching it, the cammera will make a cammera effect and then a scary sound and a grunt behind makes noises, just like in wine Cellar (ofc, I would change it a bit).
So, what's the script I need to write? with the time I'm starting a bit to understand scripting, but I still need help >_<
I've been looking at the win cellar.hps file, and I read the part of the door, but it's so big, and strange (for me Tongue) that for only making 1 interaction causes 3 things, I think is too much -_-

Help is very appreciated!
Thanks Wink

09-16-2010, 12:22 PM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#2
RE: How to make a "Scary door?"

In your OnStart() function you add

SetEntityPlayerInteractCallback("name_of_door_here", "FunctionToCall", true);


Then make the callback function:
void FunctionToCall(string &in entity)
{
    PlaySoundAtEntity("instance_name", "soundfile.ogg/snt", "name_of_entity_to_play_sound_from", 0, false);
    SetEntityActive("name_of_grunt_or_brute", true); //Spawn monster
}



Edit: For the camera effect, you could simply use
void GiveSanityDamage(float afAmount, bool abUseEffect);

Which will "bend" the camera little".

Example:
void FunctionToCall(string &in entity)
{
    PlaySoundAtEntity("instance_name", "soundfile.ogg/snt", "name_of_entity_to_play_sound_from", 0, false);
    SetEntityActive("name_of_grunt_or_brute", true); //Spawn monster
    GiveSanityDamage(15.0f, true);
}




I've written a small function for you, that should give a more twisted camera effect:
void DoScaryCamera(float afSanityDamage)
{
    //Enable image trail
    FadeImageTrailTo(1.0f, 10.0f);
    
    //Enable radial blur
    FadeRadialBlurTo(0.15f, 10.0f);
    
    //If the function was called with a sanity damage larger than 0, apply it (with effects)
    if(afSanityDamage > 0.0f)
        GiveSanityDamage(afSanityDamage, true);
    
    //End the effects, half a second later
    AddTimer("", 0.5f, "TimerEndEffects");
}

void TimerEndEffects(string &in asTimer)
{
    //Disable image trail
    FadeRadialBlurTo(0.0f, 0.5f);
    //Disable radial blur
    FadeImageTrailTo(0.0f, 1.0f);
}


Simply add that to your script file, and simply do DoScaryCamera(15.0f) from anywhere in your code, to perform a little twisting camera effect. 15.0f being the sanity damage to apply.

Haven't tested it as I just wrote it here, but it should work just fine.

[Image: 16455.png]
09-16-2010, 03:27 PM
Find
sacroid Offline
Member

Posts: 88
Threads: 11
Joined: Apr 2010
Reputation: 0
#3
RE: How to make a "Scary door?"

Thanks! I just needed it Tongue

09-16-2010, 03:35 PM
Find




Users browsing this thread: 1 Guest(s)