Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nkmols' question
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#1
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
Find Reply
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#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
Find Reply
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#3
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 Big Grin
but could i improve it, when i'm in an area the script will be activated?
02-21-2011, 09:22 PM
Find Reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
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
Website Find Reply
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#5
RE: Forge to look at object script

it worked Big Grin

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 Big Grin i added the slow walking/looking and running to Big Grin it feels good that i found out some thing by my self, lol. really thanks for helping Big Grin code so far :
PHP Code: (Select All)
void Onstart()
{

}

void OnEnter()
{
AddEntityCollideCallback("Player""InsanityArea_1""AreaLookAt"true1);    
}

void AreaLookAt(string &in asParentstring &in asChildint alState)
{
    
StartPlayerLookAt("ritual_prisoner_1"22"");
    
AddTimer("Donelook"2.5f"TimerDoneLookAt"); 
    
PlaySoundAtEntity("player_shock""react_scare""Player"0false);
    
GiveSanityDamage(50true);
    
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
Find Reply
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#6
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
Find Reply
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#7
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
Find Reply
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#8
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.

[Image: 18694.png]
02-21-2011, 11:06 PM
Find Reply
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#9
RE: Forge to look at object script

@Pando thanks for seeing such a little mistake Smile

@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
Find Reply
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#10
RE: Forge to look at object script

found them already Tongue
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 Blush if you don't understand my question please reply

here picture of the insanity effect in the Debug Toolbar
[Image: 88734349.png]
02-22-2011, 03:55 PM
Find Reply




Users browsing this thread: 1 Guest(s)