Frictional Games Forum (read-only)
[SCRIPT] I need a help please - 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: [SCRIPT] I need a help please (/thread-25288.html)

Pages: 1 2 3


I need a help please - Straxedix - 05-14-2014

Ok what i wanna and what i try to do is to make a script when player enter some kinda room and step there are 2 areas (i make it so same when he enter 1 he will enter and 2 area in the same time) so the area 1 should make him look back what it does,so while he is looking back or turning around then timer from area 2 should react so then doors HARD close and lock so there is 1 key in room and when i make it pick up just to pick up key doors unlock (without using key)

My .hps

Spoiler below!
void OnStart()

{
AddEntityCollideCallback("Player", "CloseDoor", "CollideLockDoor", true, 1);
AddEntityCollideCallback("Player", "Area01", "LookBack01", true, 1);
AddTimer("DoorDown", 3, "CollideLockDoor");
}

void LookBack01(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Door01", 2, 25, "CallbackName");
AddTimer("", 3, "StopLookingAtDoor");
}

void StopLookingAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void CollideLockDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Door01", true, true);

PlaySoundAtEntity("bang", "scare_slam_door", "castle_1", 0.0f, false);
StartScreenShake(0.02f, 1.0f, 0.5f, 1.0f);
}

Problems:

Spoiler below!
1:He turns behind but the doors are closed till he turns behind!
2:Sound is not appearing

It is IFC (isolated full conversion) so maybe i need put some sounds in my files ?


RE: I need a help please - Neelke - 05-14-2014

You cannot call a collide function with a timer.

Code:
void OnStart()

{
AddEntityCollideCallback("Player", "CloseDoor", "CollideLockDoor", true, 1);
AddEntityCollideCallback("Player", "Area01", "LookBack01", true, 1);
AddTimer("DoorDown", 3, "LockDoor");
}

void LookBack01(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Door01", 2, 25, "CallbackName");
AddTimer("", 3, "StopLookingAtDoor");
}

void StopLookingAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void LockDoor(string &in asTimer)
{
SetSwingDoorLocked("Door01", true, true);

PlaySoundAtEntity("bang", "scare_slam_door", "castle_1", 0.0f, false);
StartScreenShake(0.02f, 1.0f, 0.5f, 1.0f);
}

1. Can you correct yourself? I don't really understand what you mean.
2. Wrong name of the object where you want the sound to be played


RE: I need a help please - Straxedix - 05-14-2014

(05-14-2014, 06:11 PM)Neelke Wrote: You cannot call a collide function with a timer.

Code:
void OnStart()

{
AddEntityCollideCallback("Player", "CloseDoor", "CollideLockDoor", true, 1);
AddEntityCollideCallback("Player", "Area01", "LookBack01", true, 1);
AddTimer("DoorDown", 3, "LockDoor");
}

void LookBack01(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Door01", 2, 25, "CallbackName");
AddTimer("", 3, "StopLookingAtDoor");
}

void StopLookingAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void LockDoor(string &in asTimer)
{
SetSwingDoorLocked("Door01", true, true);

PlaySoundAtEntity("bang", "scare_slam_door", "castle_1", 0.0f, false);
StartScreenShake(0.02f, 1.0f, 0.5f, 1.0f);
}

1. Can you correct yourself? I don't really understand what you mean.
2. Wrong name of the object where you want the sound to be played


In the love of God what did you done now when enter map it does lock door and screen shake,it should be when enter areas o.O


RE: I need a help please - Neelke - 05-14-2014

Because that's how you scripted it. Are you blaming me now?

Plus, you call the timer right away on the void OnStart.


RE: I need a help please - Straxedix - 05-14-2014

My script works in area o.O
not when enter the map


RE: I need a help please - Neelke - 05-14-2014

Call the timer when the player collides with the areas. Right now youre calling them straight away.


RE: I need a help please - Straxedix - 05-14-2014

PLUS i was asking for help blam me more yes i don't know to script so i ask here


RE: I need a help please - Neelke - 05-14-2014

Dude, calm down. I'm trying to help you here and I'm not blaming you. I just changed the timer so it was correct (didnt see it was in OnStart). But try giving this a go.
Code:
void OnStart()

{
AddEntityCollideCallback("Player", "CloseDoor", "CollideLockDoor", true, 1);
AddEntityCollideCallback("Player", "Area01", "LookBack01", true, 1);
}

void LookBack01(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Door01", 2, 25, "CallbackName");
AddTimer("", 3, "StopLookingAtDoor");
AddTimer("DoorDown", 3, "LockDoor");
}

void StopLookingAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void LockDoor(string &in asTimer)
{
SetSwingDoorLocked("Door01", true, true);

PlaySoundAtEntity("bang", "scare_slam_door", "castle_1", 0.0f, false);
StartScreenShake(0.02f, 1.0f, 0.5f, 1.0f);
}



RE: I need a help please - Straxedix - 05-14-2014

Perfect just now make when PICK UP key they unlock :-)


RE: I need a help please - Neelke - 05-14-2014

Kind of consuming, but ok.

Code:
void PickKey(string &in asEntity, string &in asType)
{
GiveSanityBoostSmall(); //Just a nice little sanity boost
SetSwingDoorLocked("Door01", false, true);
}

void OnStart()
{
SetEntityPlayerInteractCallback("NAMEOFKEY", "PickKey", true);
}