Frictional Games Forum (read-only)
How to make player teleport when touching item? - 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: How to make player teleport when touching item? (/thread-7256.html)

Pages: 1 2


How to make player teleport when touching item? - HumiliatioN - 04-08-2011

So how because i have no idea..

I tried to Teleport function and combine item with that but not working..

Somebody give me example?

Thanks.


RE: How to make player teleport when touching item? - Anxt - 04-08-2011

Don't use combine item, use SetEntityPlayerInteractCallback. Then, when they interact with the item (pick it up, carry it, etc.) they will be teleported.


RE: How to make player teleport when touching item? - HumiliatioN - 04-08-2011

(04-08-2011, 04:08 PM)Anxt Wrote: Don't use combine item, use SetEntityPlayerInteractCallback. Then, when they interact with the item (pick it up, carry it, etc.) they will be teleported.

Uhm.. Can you show me example script for teleporting when touching or picking up item?


RE: How to make player teleport when touching item? - Anxt - 04-08-2011

void OnStart()
{
SetEntityPlayerInteractCallback("key", "Stuff", true);
}
void Stuff(string &in asEntity)
{
TeleportPlayer("PlayerStartArea");
}


RE: How to make player teleport when touching item? - HumiliatioN - 04-08-2011

Thanks but one thing how i can add there when player is teleporting he scares and fades like timer... Now its only changing area quick when i pick lantern..


RE: How to make player teleport when touching item? - Anxt - 04-08-2011

Use a timer instead of directly teleporting the player. When the player picks up the lantern, use the FadeOut function and set the timer to the same time as the fadeout. Then, have the timer call a function that teleports the player and fades back in.


RE: How to make player teleport when touching item? - HumiliatioN - 04-08-2011

(04-08-2011, 06:15 PM)Anxt Wrote: Use a timer instead of directly teleporting the player. When the player picks up the lantern, use the FadeOut function and set the timer to the same time as the fadeout. Then, have the timer call a function that teleports the player and fades back in.

Its not working...

void Stuff(string &in asEntity)
{
TeleportPlayer("PlayerStartArea_2");
FadeIn(float 5.0f);
FadeOut(float 5.0f);
}

Complains many errors...


RE: How to make player teleport when touching item? - Anxt - 04-08-2011

Don't have the word float in your fade functions.

Also, that's not what I meant. Here's what I meant:

void OnStart()
{
SetEntityPlayerInteractCallback("key", "Stuff", true);
}

void Stuff(string &in asEntity)
{
FadeOut(5);
AddTimer("tele", 5, "Teleport");
}

void Teleport(string &in asTimer)
{
FadeIn(5);
TeleportPlayer("PlayerStartArea_2");
}


RE: How to make player teleport when touching item? - HumiliatioN - 04-08-2011

Oh good.. its working now..

Im so stupid and noob at scripting its too hard Sad


RE: How to make player teleport when touching item? - Anxt - 04-08-2011

It gets easier with time. Just be patient with it and you'll learn how to do pretty much everything.