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
Overwriting/Replacing A Checkpoint's Function?
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#1
Overwriting/Replacing A Checkpoint's Function?

I was wondering if it is possible to overwrite a checkpoint's function or even the checkpoint itself, as this is the situation:

There are two endings: Bad and Good. You get the Bad ending if you die (Checkpoint 1), but if you enter this certain room (for me, it's a script area the player has to pass by in order to get the good ending) you'll get the good ending (Checkpoint 2), however you still die, but you get "dragged" into another room (which is the last level of my full conversion/A "ChangeMap" function is used as well).


This hasn't been working for me as the DeathHints are the only things replaced, but the function is still the same as the first checkpoint. (So even if I want a function to happen on the second checkpoint, it won't do it, it'll load the first checkpoint's function)

PLEASE help me out with this!! I don't know what else to do :/
(This post was last modified: 01-02-2012, 01:28 AM by SonOfLiberty796.)
12-31-2011, 08:14 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Overwriting/Replacing A Checkpoint's Function?

Post your CheckPoint functions.

Tutorials: From Noob to Pro
12-31-2011, 08:22 PM
Website Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#3
RE: Overwriting/Replacing A Checkpoint's Function?

Ok this is checkpoint 1:
CheckPoint("", "", "BadEndingCredits", "DeathHints", "BadEndingDeathHint");


Checkpoint 2:
CheckPoint("", "", "TestFunction", "DeathHints", "GoodEnding");

The ""s are the Name of the Checkpoint and the StartPos, which I don't need so I didn't fill it out.
(This post was last modified: 01-01-2012, 12:07 AM by SonOfLiberty796.)
01-01-2012, 12:06 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 12:06 AM)Xvideogamer720X Wrote: The ""s are the Name of the Checkpoint and the StartPos, which I don't need so I didn't fill it out.

You say you don't need it, but how is the game going to figure out what to overwrite and where to position the player? Give both of them the same name and provide the location for the player for the good ending.

Tutorials: From Noob to Pro
(This post was last modified: 01-01-2012, 12:21 AM by Your Computer.)
01-01-2012, 12:20 AM
Website Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#5
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 12:20 AM)Your Computer Wrote:
(01-01-2012, 12:06 AM)Xvideogamer720X Wrote: The ""s are the Name of the Checkpoint and the StartPos, which I don't need so I didn't fill it out.

You say you don't need it, but how is the game going to figure out what to overwrite and where to position the player? Give both of them the same name and provide the location for the player for the good ending.
Did that:
CheckPoint("CheckPoint", "PlayerStartArea_1", "BadEndingCredits", "DeathHints", "BadEndingDeathHint");


CheckPoint("CheckPoint", "PlayerStartArea_1", "TestFunction", "DeathHints", "GoodEnding");


And still, the first checkpoint's function is being loaded.
01-01-2012, 12:26 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 12:26 AM)Xvideogamer720X Wrote: And still, the first checkpoint's function is being loaded.

Then i'm going to have to see everything in the script that leads to these CheckPoint functions.

Tutorials: From Noob to Pro
01-01-2012, 12:31 AM
Website Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#7
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 12:31 AM)Your Computer Wrote: Then i'm going to have to see everything in the script that leads to these CheckPoint functions.
Well here's my whole HPS file, but I'll put the checkpoint functions in bold.


////////////////////////////
// Run first time starting map
void OnStart()
{
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}
AddEntityCollideCallback("Player", "monsterchase", "startmonsterchase", true, 1);
AddEntityCollideCallback("Player", "startrunevent", "startrunevent", true, 1);
AddEntityCollideCallback("Player", "spawnmonstertwo", "spawnothermonster", true, 1);
AddEntityCollideCallback("Player", "slamdoor", "slamdoor", true, 1);
AddEntityCollideCallback("Player", "whereisthistakingme", "darkpath", true, 1);
AddEntityCollideCallback("Player", "deadend", "deadendmessage", true, 1);
StopSound("monsterout", 0);
SetLanternDisabled(false);
CheckPoint("CheckPoint", "PlayerStartArea_1", "BadEndingCredits", "DeathHints", "BadEndingDeathHint");

}

void BadEndingCredits(string &in asName, int alCount)
{
StartCredits("", false, "Ending", "MainCreditsBad", 3);
}

void startmonsterchase(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("closetgrunt", true);
FadeInSound("monsterout", 0, false);
PlayMusic("run.ogg", true, 0.7, 1, 0, true);
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("closetgrunt", "PathNodeArea_12", 0, "");
}

void startrunevent(string &in asParent, string &in asChild, int alState)
{
ShowEnemyPlayerPosition("closetgrunt");
}

void spawnothermonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("closetgrunt", false);
SetEntityActive("grunt", true);
ShowEnemyPlayerPosition("grunt");
}

void slamdoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("lastdoor", true, true);
}

void darkpath(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageDisplay", "Message_darkpath_Name", 2.5f);
}

void deadendmessage(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageDisplay", "Message_deadend_Name", 2.1f);
AddTimer("lookatmonster", 1.9f, "lookatmonster");
}

void lookatmonster(string &in asTimer)
{
StartPlayerLookAt("grunt", 9.0f, 9.0f, "");
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, true);
StopMusic(2.0f, 0);
SetPlayerActive(false);
CheckPoint("CheckPoint", "PlayerStartArea_1", "TestFunction", "DeathHints", "GoodEnding");
}

void TestFunction(string &in asName, int alCount)
{
ChangeMap("A.C.A - Start.map", "PlayerStartArea_1", "", "");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
01-01-2012, 12:41 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Overwriting/Replacing A Checkpoint's Function?

After a bit of testing on my side, it would seem CheckPoint only applies a start position and callback to the checkpoint name if the checkpoint hasn't been set at a previous time. In other words, you have to give a unique checkpoint name to each checkpoint.

Tutorials: From Noob to Pro
01-01-2012, 02:34 AM
Website Find
SonOfLiberty796 Offline
Senior Member

Posts: 371
Threads: 39
Joined: Aug 2011
Reputation: 2
#9
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 02:34 AM)Your Computer Wrote: After a bit of testing on my side, it would seem CheckPoint only applies a start position and callback to the checkpoint name if the checkpoint hasn't been set at a previous time. In other words, you have to give a unique checkpoint name to each checkpoint.
So it has to be like "CheckPoint1" and "CheckPoint2"? Like different names for each checkpoint?
01-01-2012, 12:39 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Overwriting/Replacing A Checkpoint's Function?

(01-01-2012, 12:39 PM)Xvideogamer720X Wrote: So it has to be like "CheckPoint1" and "CheckPoint2"? Like different names for each checkpoint?

Correct.

Tutorials: From Noob to Pro
01-01-2012, 08:13 PM
Website Find




Users browsing this thread: 1 Guest(s)