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
Teleporting after dying and slime appearing?
taylor122002 Offline
Junior Member

Posts: 13
Threads: 10
Joined: Aug 2012
Reputation: 0
#1
Teleporting after dying and slime appearing?

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
02-18-2013, 08:54 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Teleporting after dying and slime appearing?

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.

02-18-2013, 10:44 PM
Find
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#3
RE: Teleporting after dying and slime appearing?

(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?
02-19-2013, 01:19 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: Teleporting after dying and slime appearing?

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.

In Ruins [WIP]
02-19-2013, 02:21 AM
Find
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#5
RE: Teleporting after dying and slime appearing?

(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!
02-19-2013, 02:57 AM
Find




Users browsing this thread: 1 Guest(s)