Frictional Games Forum (read-only)

Full Version: I need a help please
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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 ?
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
(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
Because that's how you scripted it. Are you blaming me now?

Plus, you call the timer right away on the void OnStart.
My script works in area o.O
not when enter the map
Call the timer when the player collides with the areas. Right now youre calling them straight away.
PLUS i was asking for help blam me more yes i don't know to script so i ask here
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);
}
Perfect just now make when PICK UP key they unlock :-)
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);
}
Pages: 1 2 3