Frictional Games Forum (read-only)
Teleporting after dying and slime appearing? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Teleporting after dying and slime appearing? (/thread-20389.html)



Teleporting after dying and slime appearing? - taylor122002 - 02-18-2013

Hello everybody!
I have a question for the forum as I don't know how to do this.

I am making a map that's Nearly complete! I think I'll end the custom story shortly after this part.

My first question is, you know when you play a custom story or the main story, and when you get to a certain part, the whole screen quickly blacks out and you pant, then you hear the guardian's/shadow's scream, then the screen fades back in and there is the red slime everywhere? How would I do this? I want this to happen as you're going down a hallway. I'm not sure how to set this up though.

I know I can use the SetEntityActive function to make the slime appear and also use the PlayGuiSound for the yell in the background. But I'm horrible at timers. Would I do this for example? Would this also start the timer when the player collides with the script?

AddTimer("Timer1", 5.0f, "T1");

void T1(string &in asTimer);
{
FadeOut(5.0f);
PlayGuiSound(whatever sound file I'll pick.snt", 8);
SetEntityActive("whatever the slime's name is", true)
AddTimer("", 5.0f, "T2");
}

void T2(string &in asTimer);
{
FadeIn(5.0f);
}
so on and so fourth? I'm sorry if that's wrong. I'm pretty bad at Timers.
---------------------------------------

And now my second question, this one should be easier. But I believe it also involves timers as well...

Okay, so when you pick up a certain item, a monster will spawn behind you and kill you. I know that function and how to do it, but how can I teleport the player somewhere else after you die, like as if you got dragged away else where?

What would/could I do to make it so after you die and the death hint shows up, the screen will fade back in and you'll see you're at a completely different location?

I thank everyone in advanced who answers this! Big Grin


RE: Teleporting after dying and slime appearing? - palistov - 02-18-2013

Your timer code should be fine. Once you get more comfortable with coding you should be golden. For dying, you need to use the CheckPoint function. The 'asCallback' field will run after the player respawns, and the 'StartPos' field will be where they spawn. So for your example, right when the player picks up the key, call CheckPoint and set your callback and the rest of the properties, to give the idea that they were knocked out and dragged away.


RE: Teleporting after dying and slime appearing? - T122002 - 02-19-2013

(02-18-2013, 10:44 PM)palistov Wrote: Your timer code should be fine. Once you get more comfortable with coding you should be golden. For dying, you need to use the CheckPoint function. The 'asCallback' field will run after the player respawns, and the 'StartPos' field will be where they spawn. So for your example, right when the player picks up the key, call CheckPoint and set your callback and the rest of the properties, to give the idea that they were knocked out and dragged away.

Awesome! Thank you for the reply! It was understandable enough, I think I know what you mean. Here is an example:

CheckPoint ("Checkpoint", "PlayerStartArea_1", "Respawn", "Messages", "Spawn");

That's just an example, the asCallback, that's just basically the code for whatever MyFunc is, right?

And would I also put this on the OnStart or OnEnter?

And as I was looking on the forum just now, would I also use the ChangeMap func too? or just stick with the CheckPoint func?


RE: Teleporting after dying and slime appearing? - NaxEla - 02-19-2013

Quote:That's just an example, the asCallback, that's just basically the code for whatever MyFunc is, right?

Yes, asCallback can be anything you'd like, as long as you name is function the same.

Quote:And would I also put this on the OnStart or OnEnter?

If it is in OnStart, the checkpoint will only work the first time the player is in the map. If it is in OnEnter, the checkpoint will be active every time the player enters the map. It depends whether you`re going to have the player be in the map more than once, or not.

Quote:And as I was looking on the forum just now, would I also use the ChangeMap func too? or just stick with the CheckPoint func?

asCallback will be the function that is called when the player dies/respawns, so in that function, you would use ChangeMap IF the new area that the player spawns in is a different map. If the new area is in the same map, you would just use the new StartPos when you call the CheckPoint function.


RE: Teleporting after dying and slime appearing? - T122002 - 02-19-2013

(02-19-2013, 02:21 AM)NaxEla Wrote:
Quote:That's just an example, the asCallback, that's just basically the code for whatever MyFunc is, right?

Yes, asCallback can be anything you'd like, as long as you name is function the same.

Quote:And would I also put this on the OnStart or OnEnter?

If it is in OnStart, the checkpoint will only work the first time the player is in the map. If it is in OnEnter, the checkpoint will be active every time the player enters the map. It depends whether you`re going to have the player be in the map more than once, or not.

Quote:And as I was looking on the forum just now, would I also use the ChangeMap func too? or just stick with the CheckPoint func?

asCallback will be the function that is called when the player dies/respawns, so in that function, you would use ChangeMap IF the new area that the player spawns in is a different map. If the new area is in the same map, you would just use the new StartPos when you call the CheckPoint function.

Fantastic! Thanks for the reply! All of my questions have been answered now!