Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stick a knife in Martin?
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#1
Stick a knife in Martin?

I read this:


void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);


Sets a checkpoint at which the player will respawn in case he dies.
Callback syntax: void MyFunc(string &in asName, int alCount)
Count is 0 on the first checkpoint load!
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


What is the internal name? What does that mean?
What do I put into the function to call when the player dies/respawns?
??????????

So I make a
AddEntityCollideCallback

Then when the player colides with the StartPos_2
Then?????? I dunno I need better explaining on this.

Thank You.

Special Custom Story for 2 special people!

[Image: LWFcAl]


(This post was last modified: 06-29-2012, 04:21 PM by Jagsrs28.)
06-29-2012, 03:56 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: Dafuq? How do I create a CheckPoint?

I will explain it to scratch for you, beginning with the things not connected to others:

asName: the name of the checkpoint itself. With this name, you can difference between multiple checkpoints. Think of it like this: There's a person named person1, and another person named person2. The name is the only way to difference them, since you can not see them, hear them, or touch them. Please note that it is needed to set names for the checkpoints once you got 2 or more, or else it won't work.

asStartPos: The Starting Position for where the player spawns after he dies. To make a Starting Position, go to the level editor>Areas>PlayerStart. Place it where you want the player to spawn, and use the rotate tool(select mouse icon on the left, click on the playerstart area, then on the right use the red circle) to rotate the blue arrow to where you want the player to look.

asCallback: Not always needed. If you just want the player to spawn, leave it blank(""). If you want the player, for example, to say something, or that something changes everytime he spawns at that position, use a Callback. Read more on Callback syntax below if you want more info about that.

asDeathHintCat + Entry: In your custom story folder, there should be a file named "extra_english.lang". If there isn't, you didn't add it yet. In there, define a category with any name you want, and a Entry with any name you want, which holds the text what should be displayed after he died. Then, add the names at the command itself(only the names, example: "DeathHints", "Checkpoint1")

Callback syntax + more on callback: As I said above, if you want more to happen than just getting the player to respawn, include a name as the callback(example below). After that, you make a new function using the callback syntax. Just copy/paste the whole thing and only edit MyFunc to the name you defined as the callback. Nothing else of it. Inside that self made function, you can do what ever you want.

Now for a example, the bold words are the callback parts:

CheckPoint ("Checkpoint1", "PlayerStartPos_1", "CheckPointFunction1", "DeathHints", "Checkpoint1");
void CheckPointFunction1(string &in asName, int alCount)
{
Whatever should happen here
}

Now for your question about AddEntityCollideCallback:

If you want to activate a checkpoint if the player enters a specific room for example, you use AddEntityCollideCallback. Place a script area(in level editor>areas>script) and size and place it like you need. Then, add the AddEntityCollideCallback command in OnStart(), which calls a function which then makes that checkpoint.

The big example of the whole stuff, together with the example above:

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptArea_1""CheckPointMaker"true1);
}
void CheckPointMaker(string &in asParentstring &in asChildint alState
{
CheckPoint ("Checkpoint1""PlayerStartPos_1""CheckPointFunction1""DeathHints""Checkpoint1");
}
void CheckPointFunction1(string &in asNameint alCount
{
//Whatever should happen here

(This post was last modified: 06-29-2012, 04:26 PM by Cruzore.)
06-29-2012, 04:25 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#3
RE: Stick a knife in Martin?

I'm going to try to explain this as easy as possible. I'm not a very good explainer though, bear with me.

About the stick-a-knife-in-Martin part (I assume Martin is a body); you need to have a dagger in your inventory (you don't have to, there are other ways but I prefer this), so place a dagger from the entities/item tab in the level editor. Now, place a script area where you want your knife to be used (y'know, when you're holding an item on a place, that the item glows), in this case a little bit above the body. AND MAKE SURE TO CHECK "ItemInteraction" IN THE ENTITIES TAB OF THAT SCRIPT AREA. Then place another dagger, this one is for decoration, this is the knife that cuts into the body. So place it in the body. Make sure to set the second dagger (the one that is cutting the body) to inactive by unchecking the active box under the name. Then, go to entities (right of name), and check Static Physics. Alright, now the scripting part.

void OnStart()
{
AddUseItemCallback("", "NAMEofDAGGERyoupickedup", "NAMEoftheSCRIPTAREAabovethebody", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
RemoveItem("NAMEofDAGGERyoupickedup"); //this removes the dagger from the inventory.
SetEntityActive("NAMEofSECONDDAGGER", true);
}

That should do it. You can also add things like sounds or screen effects. If you do that, make sure you put it between the { and }.

Edit: This forum likes to screw with my walls of text.
(This post was last modified: 06-29-2012, 10:10 PM by ApeCake.)
06-29-2012, 10:07 PM
Find




Users browsing this thread: 1 Guest(s)