Frictional Games Forum (read-only)

Full Version: Credits After Death
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So...

I would like to end my mod with the player dying, but before the player dies, music is activated. How would one go about scripting for credits to play with the audio continuing?

Also (not of importance, but curious to know), when the player dies while the audio is still running, it runs down and distorts, then pops back up again in the same fashion when the level reloads. Is there a way to keep that effect going into the credits?

Sorry if this seems like a awkward question, and I haven't done any scripting for it yet as I've no idea how to even go about this.

I thank you all in advance for any bit help. =)
This thread might help you out: http://www.frictionalgames.com/forum/thread-19840.html

Remember to search before posting a thread Tongue
(01-18-2013, 06:57 AM)NaxEla Wrote: [ -> ]This thread might help you out: http://www.frictionalgames.com/forum/thread-19840.html

Remember to search before posting a thread Tongue

I looked it through. It doesn't really tell me anything that I'm looking for, except putting together the credits.... Sort of.

The idea is for the player to jump into a hole, they hit bottom, and end. Do I need to add a checkpoint to the script area of where the music is activated (since the audio starts upon jumping into the hole)?
What you do is, create a checkpoint.
The checkpoint is where the player will spawn after death.
The checkpoint has a function to call when the player dies.
In this function you put the credits.
To make it look good, you might also want to spawn the player somewhere, where it's all black.
(01-18-2013, 08:03 AM)BeeKayK Wrote: [ -> ]What you do is, create a checkpoint.
The checkpoint is where the player will spawn after death.
The checkpoint has a function to call when the player dies.
In this function you put the credits.
To make it look good, you might also want to spawn the player somewhere, where it's all black.

This may sound silly (noob here), how do you create a check point?
Code:
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file

Check the Engine Scripts.
(01-18-2013, 08:50 AM)junkfood2121 Wrote: [ -> ]
Code:
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file

Check the Engine Scripts.

Thanks! I shall test this out! =D

So these are the scripts I've got in the .hps file.

In the on start section:
Code:
AddEntityCollideCallback("Player", "PlayerStartArea_2", "EndCheckpoint", true, 1);

And on their own:

Code:
void EndCheckpoint(string &in asParent, string &in asChild, int alState)
{
    CheckPoint ("", "PlayerStartArea_2", "EndGame", "Ending", "Credits");
}

void EndGame(string &in asName, int alCount)
{
StartCredits("", false, "Ending", "Credits", 5);
}

When I reach the point where the player should die, it respawns at the PlayStartArea_1. Are there any errors in here that I'm not seeing?
Yea well, you have the names wrong.
AddEntityCollideCallback("Player", "PlayerStartArea_2", "EndCheckpoint", true, 1);
This is the area you collide with for the function to work. Not the area you start at.


CheckPoint ("", "PlayerStartArea_2", "EndGame", "Ending", "Credits");
These two are the category and entry for the deathhints. Not the credits Wink
I'm not quite sure what to fix. The callback got moved to the On Enter section.

If this helps out more, here's the .hps file:

Code:
void OnStart ()
{     GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(50.0f);

        for(int i = 0;i < 3;i++)
        {
            GiveItemFromFile("potion_health", "potion_health.ent");
        }
        
        for(int i = 0;i < 3;i++)
        {
            GiveItemFromFile("potion_sanity", "potion_sanity.ent");
        }
        
        for(int i = 0;i < 2;i++)
        {
            GiveItemFromFile("potion_oil", "potion_oil.ent");
        }
        
        for(int i = 0;i < 1;i++)
        {
            GiveItemFromFile("potion_oil_large", "potion_oil_large.ent");
        }
        
    {
    AddEntityCollideCallback("Player", "thelongfallarea", "Epicness", true, 1);
    }
}

void OnEnter()
{        
    {
    AddEntityCollideCallback("Player", "PlayerStartArea_2", "Checkpoint", true, 1);
    }    
}

void OnLeave()
{

}

void Epicness(string &in parent, string &in child, int state)
{
    PlaySoundAtEntity("Epicness", "overture.snt", "thelongfallarea", 0.5, false);
}

void Checkpoint(string &in asParent, string &in asChild, int alState)
{
    CheckPoint ("", "PlayerStartArea_2", "EndGame", "Ending", "Credits");
}

void EndGame(string &in asName, int alCount)
{
StartCredits("EndGame", false, "Ending", "Credits", 5);
}
Pages: 1 2