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?"
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


Messages In This Thread
How to make a "Scary door?" - by sacroid - 09-16-2010, 12:22 PM
RE: How to make a "Scary door?" - by MulleDK19 - 09-16-2010, 03:27 PM
RE: How to make a "Scary door?" - by sacroid - 09-16-2010, 03:35 PM



Users browsing this thread: 1 Guest(s)