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
Reset Triggers Upon Death?
W10607059 Offline
Junior Member

Posts: 11
Threads: 3
Joined: Feb 2012
Reputation: 0
#1
Reset Triggers Upon Death?

How do you make it so that when the player dies, the triggers will all be reset. Like say I had an area where a monster comes when the player enters. He enters and then dies. How do I make it so that when he respawns and enters the area again, the monster will appear again?
04-07-2012, 01:50 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#2
RE: Reset Triggers Upon Death?

Create a checkpoint somewhere, perhaps when you enter this area/level and in the checkpoint's callback, place the necessary functions, such as the "AddEntityCollideCallback"s.

When the player respawns, the checkpoint will call the functions and will replay them each time you die.
(This post was last modified: 04-07-2012, 02:01 AM by Statyk.)
04-07-2012, 02:01 AM
Find
W10607059 Offline
Junior Member

Posts: 11
Threads: 3
Joined: Feb 2012
Reputation: 0
#3
RE: Reset Triggers Upon Death?

(04-07-2012, 02:01 AM)Statyk Wrote: Create a checkpoint somewhere, perhaps when you enter this area/level and in the checkpoint's callback, place the necessary functions, such as the "AddEntityCollideCallback"s.

When the player respawns, the checkpoint will call the functions and will replay them each time you die.




What do you mean create a check point? How do i do that?
04-07-2012, 09:45 PM
Find
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#4
RE: Reset Triggers Upon Death?

(04-07-2012, 09:45 PM)W10607059 Wrote: What do you mean create a check point? How do i do that?
.
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 <-In this function, ya'll put in all the triggers that should be reset after your death
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file


04-07-2012, 10:24 PM
Website Find
W10607059 Offline
Junior Member

Posts: 11
Threads: 3
Joined: Feb 2012
Reputation: 0
#5
RE: Reset Triggers Upon Death?

(04-07-2012, 10:24 PM)Mackiiboy Wrote:
(04-07-2012, 09:45 PM)W10607059 Wrote: What do you mean create a check point? How do i do that?
.
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 <-In this function, ya'll put in all the triggers that should be reset after your death
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file


Alright, can you give me an example with the asCallback part? I have no idea what Im doing

04-07-2012, 11:05 PM
Find
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#6
RE: Reset Triggers Upon Death?

(04-07-2012, 11:05 PM)W10607059 Wrote: Alright, can you give me an example with the asCallback part? I have no idea what Im doing
.
This might solve your problems. Try to understand all parts so ya'll not just copy everthing, I think this should work good Shy

void OnStart()
{
AddEntityCollideCallback("Player", "YOUR_AREA", "YOUR_FUNC", false, 1);
}

void YOUR_FUNC(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("YOUR_AREA", false);
CheckPoint("name_of_your_checkpoint", "Spawn_Area", "DeathFunc1", "DeathHint", "DescriptionOne");
}

void DeathFunc1(string &in asName, int alCount) <---- (You must use this callback syntax)
{
SetEntityActive("YOUR_AREA", true);
//Write everything here you want to happen after death.
}

-------------------------------------------------
name_of_your_checkpoint- the internal name
Spawn_Area- the name of the StartPos in the editor
DeathFunc1 - the function to call when the player dies/respawns
DeathHint- the category of the death hint message to be used in the .lang file
DescriptionOne- the entry in the .lang file (what text do you want to appear when you die?)
(This post was last modified: 04-07-2012, 11:47 PM by Mackiiboy.)
04-07-2012, 11:34 PM
Website Find
W10607059 Offline
Junior Member

Posts: 11
Threads: 3
Joined: Feb 2012
Reputation: 0
#7
RE: Reset Triggers Upon Death?

(04-07-2012, 11:34 PM)Mackiiboy Wrote:
(04-07-2012, 11:05 PM)W10607059 Wrote: Alright, can you give me an example with the asCallback part? I have no idea what Im doing
.void OnStart()
{
AddEntityCollideCallback("Player", "YOUR_AREA", "YOUR_FUNC", false/true, 1);
}

void YOUR_FUNC(string &in asParent, string &in asChild, int alState)
{
CheckPoint("name_of_your_checkpoint", "Spawn_Area", "DeathFunc1", "DeathHint", "DescriptionOne");
}

void DeathFunc1(string &in asName, int alCount) <---- (You must use this callback syntax)
{
//Write everything here you want to happen after death.
}

-------------------------------------------------
name_of_your_checkpoint- the internal name
Spawn_Area- the name of the StartPos in the editor
DeathFunc1 - the function to call when the player dies/respawns
DeathHint- the category of the death hint message to be used in the .lang file
DescriptionOne- the entry in the .lang file (what text do you want to appear when you die?)
Alright lets see if I can knock this out with one more question. So I have all my triggers set up in the OnStart section. If I want everything to reset upon death, do I just copy it over into the checkpoint place? And if so, do I delete it out of the onstart or copy it so that there are 2 sets of the same triggers; one in the onstart and one in the checkpoint?

04-07-2012, 11:47 PM
Find
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#8
RE: Reset Triggers Upon Death?

(04-07-2012, 11:47 PM)W10607059 Wrote: Alright lets see if I can knock this out with one more question. So I have all my triggers set up in the OnStart section. If I want everything to reset upon death, do I just copy it over into the checkpoint place? And if so, do I delete it out of the onstart or copy it so that there are 2 sets of the same triggers; one in the onstart and one in the checkpoint?
.
My head is kinda messy, I do not really understand what you're meaning - but. I updated my last post, and the thing it does now is the following:
You enter YOUR_AREA => calls YOUR_FUNC and a CheckPoint appears and YOUR_AREA becomes inactive. If you die, DeathFunc1 will be called, and YOUR_AREA will be active again after death, which means you will be able to collide with that area again and again till' you manage to not die anymore. That's exactly what you wanted:

"How do you make it so that when the player dies, the triggers will all
be reset. Like say I had an area where a monster comes when the player
enters. He enters and then dies. How do I make it so that when he
respawns and enters the area again, the monster will appear again?"


So, just put in your monsterstuff into YOUR_FUNC - that func will be called when you collide with YOUR_AREA and can be called and infinite number of times depending on how many times you want to die.
This works if you have false active in your collidecallbackfunc:
AddEntityCollideCallback("Player", "YOUR_AREA", "YOUR_FUNC", false, 1);

Do not forget to add a new CheckPoint in the future if it's possible to get killed by other monsters in your custom story.

(This post was last modified: 04-08-2012, 12:06 AM by Mackiiboy.)
04-08-2012, 12:01 AM
Website Find
W10607059 Offline
Junior Member

Posts: 11
Threads: 3
Joined: Feb 2012
Reputation: 0
#9
RE: Reset Triggers Upon Death?

(04-08-2012, 12:01 AM)Mackiiboy Wrote:
(04-07-2012, 11:47 PM)W10607059 Wrote: Alright lets see if I can knock this out with one more question. So I have all my triggers set up in the OnStart section. If I want everything to reset upon death, do I just copy it over into the checkpoint place? And if so, do I delete it out of the onstart or copy it so that there are 2 sets of the same triggers; one in the onstart and one in the checkpoint?
.
My head is kinda messy, I do not really understand what you're meaning - but. I updated my last post, and the thing it does now is the following:
You enter YOUR_AREA => calls YOUR_FUNC and a CheckPoint appears and YOUR_AREA becomes inactive. If you die, DeathFunc1 will be called, and YOUR_AREA will be active again after death, which means you will be able to collide with that area again and again till' you manage to not die anymore. That's exactly what you wanted:

"How do you make it so that when the player dies, the triggers will all
be reset. Like say I had an area where a monster comes when the player
enters. He enters and then dies. How do I make it so that when he
respawns and enters the area again, the monster will appear again?"


So, just put in your monsterstuff into YOUR_FUNC - that func will be called when you collide with YOUR_AREA and can be called and infinite number of times depending on how many times you want to die.
This works if you have false active in your collidecallbackfunc:
AddEntityCollideCallback("Player", "YOUR_AREA", "YOUR_FUNC", false, 1);

Do not forget to add a new CheckPoint in the future if it's possible to get killed by other monsters in your custom story.

ok it worked, thank you so much! yeah the problem was the whole area monster thing was just an example and I was trying to apply what you said to what I was actually trying to do. One last question, do you know how to remove a timer upon the players death? Big Grin

04-08-2012, 03:39 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#10
RE: Reset Triggers Upon Death?

RemoveTimer("YOUR TIMER'S INTERNAL NAME");

Example:
AddTimer("looper", 0.1f, "restart_walk");

To remove:
RemoveTimer("looper");

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

04-08-2012, 08:50 PM
Website Find




Users browsing this thread: 1 Guest(s)