nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
Nkmols' question
my script doesnt work :S instead of an area could it be an object to, like a corpse?
script :
void Onstart()
{
StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");
AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
}
void TimerDoneLookAt(string &in asTimer)
{
StopPlayerLookAt();
}
but when i start the game, the player doesnt look. and i was wondering if i didnt need area to active this script? like if i'm at x position StartPlayerLookAt is true.
(This post was last modified: 02-22-2011, 09:29 PM by nkmol.)
|
|
02-21-2011, 05:23 PM |
|
Mofo
Member
Posts: 71
Threads: 4
Joined: Sep 2010
Reputation:
2
|
RE: Forge to look at object script
Quote:StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");
AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
Put this inside the onEnter instead of the onStart.
|
|
02-21-2011, 07:31 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: Forge to look at object script
(02-21-2011, 07:31 PM)Mofo Wrote: Quote:StartPlayerLookAt("ritual_prisoner_1", 2, 2, "");
AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
Put this inside the onEnter instead of the onStart. thanks it works now
but could i improve it, when i'm in an area the script will be activated?
|
|
02-21-2011, 09:22 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Forge to look at object script
You have to add a collide back.
Like, you need to make a script area, then add a code, like this:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_6", "TeleportToNormal1", true, 1);
}
void TeleportToNormal1(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("ScriptArea_14", 100, 100, "");
AddTimer("LookStopper", 0.1f, "StopLookAt");
TeleportPlayer("PlayerStartArea_3");
}
|
|
02-21-2011, 09:32 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: Forge to look at object script
it worked
maybe to improve it a lil bit more, is it possible to zoom in, like a shock effect?
ill look to play the shock sound of daniel by myself and reduce sanity
edited : got it worked now i added the slow walking/looking and running to it feels good that i found out some thing by my self, lol. really thanks for helping code so far :
void Onstart() {
}
void OnEnter() { AddEntityCollideCallback("Player", "InsanityArea_1", "AreaLookAt", true, 1); }
void AreaLookAt(string &in asParent, string &in asChild, int alState) { StartPlayerLookAt("ritual_prisoner_1", 2, 2, ""); AddTimer("Donelook", 2.5f, "TimerDoneLookAt"); PlaySoundAtEntity("player_shock", "react_scare", "Player", 0, false); GiveSanityDamage(50, true); SetPlayerMoveSpeedMul(0.4f); SetPlayerRunSpeedMul(0.4f); SetPlayerLookSpeedMul(0.4f); }
void TimerDoneLookAt(string &in asTimer) { StopPlayerLookAt(); SetPlayerMoveSpeedMul(1.0f); SetPlayerRunSpeedMul(1.0f); SetPlayerLookSpeedMul(1.0f); }
(This post was last modified: 02-21-2011, 09:59 PM by nkmol.)
|
|
02-21-2011, 09:47 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: Forge to look at object script
I know this is off-topic, but i keep getting question :p i where wondering how to play the scary noises? Like footsteps, flashback sound and closing doors etc. Because im not sure if it is a .snt or .ogg file :p and how to play 2 sounds after each other in 1 callback?
|
|
02-21-2011, 10:48 PM |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
RE: Forge to look at object script
Stuff doesn't work when you put it into void Onstart() because it is case-sensitive. It has to be OnStart() if you want anything to work in there.
|
|
02-21-2011, 11:03 PM |
|
Ongka
Member
Posts: 225
Threads: 3
Joined: Nov 2010
Reputation:
20
|
RE: Forge to look at object script
I'll take your script:
void OnEnter()
{
AddEntityCollideCallback("Player", "InsanityArea_1", "AreaLookAt", true, 1);
}
void AreaLookAt(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "insanity_baby_cry", "AreaSound", 0, false); //AreaSound is where you want the sound to be played
AddTimer("Donelook", 2.5f, "TimerDoneLookAt");
}
void TimerDoneLookAt(string &in asTimer)
{
PlaySoundAtEntity("sound", "scare_slam_door", "castle_1", 0, false); //castle_1 is the name of the door
}
Just an example.
|
|
02-21-2011, 11:06 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: Forge to look at object script
@Pando thanks for seeing such a little mistake
@Ongka but where did you got the name (insanity_baby_cry) of the audio file from? And why no insanity_baby_cry.snt? :p
|
|
02-21-2011, 11:17 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: Forge to look at object script
found them already
1. but i can't find the insanity effects in the Debug Toolbar (when i touch F1 in-game). i know it's, like Steps_SlimeyRun01, made of different chronologic sounds and different volume of sound. But i doubt i can make by my self such thing xD so i where wondering where that insanity sound pack is?
2. how could i play multiple sounds after each other? like first playing sound 1, after 1,7sec play sound 2. probably has to do whith timers, but don't exacly know how they work :S
sorry i ask so much if you don't understand my question please reply
here picture of the insanity effect in the Debug Toolbar
|
|
02-22-2011, 03:55 PM |
|
|