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
Script Help Credits After Death
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#1
Credits After Death

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

01-18-2013, 06:28 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: Credits After Death

This thread might help you out: http://www.frictionalgames.com/forum/thread-19840.html

Remember to search before posting a thread Tongue

In Ruins [WIP]
(This post was last modified: 01-18-2013, 06:58 AM by NaxEla.)
01-18-2013, 06:57 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#3
RE: Credits After Death

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

01-18-2013, 07:16 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Credits After Death

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.

Trying is the first step to success.
01-18-2013, 08:03 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#5
RE: Credits After Death

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

01-18-2013, 08:40 AM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#6
RE: Credits After Death

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.

Creator of The Dark Treasure.
01-18-2013, 08:50 AM
Website Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#7
RE: Credits After Death

(01-18-2013, 08:50 AM)junkfood2121 Wrote:
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:
AddEntityCollideCallback("Player", "PlayerStartArea_2", "EndCheckpoint", true, 1);

And on their own:

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?

(This post was last modified: 01-18-2013, 09:16 AM by AGP.)
01-18-2013, 08:52 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#8
RE: Credits After Death

Yea well, you have the names wrong.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
01-18-2013, 10:11 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: Credits After Death

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

Trying is the first step to success.
(This post was last modified: 01-18-2013, 10:36 AM by FlawlessHappiness.)
01-18-2013, 10:36 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#10
RE: Credits After Death

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:

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);
}

01-18-2013, 10:35 PM
Find




Users browsing this thread: 1 Guest(s)