Straxedix
Senior Member
Posts: 426
Threads: 52
Joined: Mar 2014
Reputation:
5
I need a help please
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:
It is IFC (isolated full conversion) so maybe i need put some sounds in my files ?
(This post was last modified: 05-14-2014, 06:04 PM by Straxedix .)
05-14-2014, 06:01 PM
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
RE: I need a help please
You cannot call a collide function with a timer.
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
Derp.
05-14-2014, 06:11 PM
Straxedix
Senior Member
Posts: 426
Threads: 52
Joined: Mar 2014
Reputation:
5
RE: I need a help please
(05-14-2014, 06:11 PM) Neelke Wrote: You cannot call a collide function with a timer.
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
(This post was last modified: 05-14-2014, 06:19 PM by Straxedix .)
05-14-2014, 06:18 PM
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
RE: I need a help please
Because that's how you scripted it. Are you blaming me now?
Plus, you call the timer right away on the void OnStart.
Derp.
(This post was last modified: 05-14-2014, 06:20 PM by Neelke .)
05-14-2014, 06:19 PM
Straxedix
Senior Member
Posts: 426
Threads: 52
Joined: Mar 2014
Reputation:
5
RE: I need a help please
My script works in area o.O
not when enter the map
05-14-2014, 06:20 PM
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
RE: I need a help please
Call the timer when the player collides with the areas. Right now youre calling them straight away.
Derp.
05-14-2014, 06:21 PM
Straxedix
Senior Member
Posts: 426
Threads: 52
Joined: Mar 2014
Reputation:
5
RE: I need a help please
PLUS i was asking for help blam me more yes i don't know to script so i ask here
05-14-2014, 06:22 PM
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
RE: I need a help please
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.
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);
}
Derp.
05-14-2014, 06:25 PM
Straxedix
Senior Member
Posts: 426
Threads: 52
Joined: Mar 2014
Reputation:
5
RE: I need a help please
Perfect just now make when PICK UP key they unlock :-)
(This post was last modified: 05-14-2014, 06:31 PM by Straxedix .)
05-14-2014, 06:31 PM
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
RE: I need a help please
Kind of consuming, but ok.
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);
}
Derp.
05-14-2014, 06:35 PM