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
still having script problem and a simple question
zecuro Offline
Member

Posts: 162
Threads: 33
Joined: Jul 2011
Reputation: 3
#1
still having script problem and a simple question

this is a 2 question
hey everyone heres my hole hps file....when i try to run amnesia they tell me that there still something wrong my my hps file well one of my script
can someone check it out
void OnStart()
{
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
AddUseItemCallback("", "key_1", "mansion_3", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
}
void OnEnter()
{
AddEntityCollideCallback("Player", "bang", "func_slam", true, 1);
}
void OnLeave()
{
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void OnStart()
{
FadeOut(0);
FadeIn(5);
SetPlayerActive(false);
SetPlayerCrouching(true);
SetInventoryDisabled(true);
MovePlayerHeadPos(0, -2, 0, 2, -2);
StartPlayerLookAt("ScriptArea_1", 10, 10, "");
AddTimer("T1", 5.5, "TimerFunc");
AddTimer("T2", 10, "TimerFunc");
AddTimer("T3", 13.5, "TimerFunc");
AddTimer("T4", 16, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
FadeOut(4);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}
else if (x == "T2")
{
FadeIn(3);
}
else if (x == "T3")
{
FadeOut(2);
StopPlayerLookAt();
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
MovePlayerHeadPos(0, 2, 0, 2, 2);
}
else if (x == "T4")
{
FadeIn(2);
SetPlayerActive(true);
SetPlayerCrouching(false);
SetInventoryDisabled(false);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}
}
and the second question is is there a tutorial on how to add a sound effect when picking up a note ot an item
PLZ HElP
07-24-2012, 02:44 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: still having script problem and a simple question

You have 2 "void OnStart()". There only needs to be one. Also, all callbacks should be under void OnStart() as well.

As for your issue with the item/note + sounds, use this callback:

SetEntityPlayerInteractCallback("NAMEOFITEM", "NAMEOFFUNCTION", true);


The callback syntax for this function is "(string &in asEntity)'

Hope that helped.

I rate it 3 memes.
07-24-2012, 03:06 AM
Find
zecuro Offline
Member

Posts: 162
Threads: 33
Joined: Jul 2011
Reputation: 3
#3
RE: still having script problem and a simple question

like this !!!
void OnStart()
{
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
AddUseItemCallback("", "key_1", "mansion_3", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
}
{
FadeOut(0);
FadeIn(5);
SetPlayerActive(false);
SetPlayerCrouching(true);
SetInventoryDisabled(true);
MovePlayerHeadPos(0, -2, 0, 2, -2);
StartPlayerLookAt("ScriptArea_1", 10, 10, "");
AddTimer("T1", 5.5, "TimerFunc");
AddTimer("T2", 10, "TimerFunc");
AddTimer("T3", 13.5, "TimerFunc");
AddTimer("T4", 16, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
FadeOut(4);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}
else if (x == "T2")
{
FadeIn(3);
}
else if (x == "T3")
{
FadeOut(2);
StopPlayerLookAt();
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
MovePlayerHeadPos(0, 2, 0, 2, 2);
}
else if (x == "T4")
{
FadeIn(2);
SetPlayerActive(true);
SetPlayerCrouching(false);
SetInventoryDisabled(false);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}
void OnEnter()
{
AddEntityCollideCallback("Player", "bang", "func_slam", true, 1);
}
void OnLeave()
{
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
}
07-24-2012, 02:28 PM
Find
zecuro Offline
Member

Posts: 162
Threads: 33
Joined: Jul 2011
Reputation: 3
#4
RE: still having script problem and a simple question

i totaly think its something at the begining of the script
07-24-2012, 11:38 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: still having script problem and a simple question

Removing function headers doesn't solve the problem but adds to it. If you remove the function header simply because you have a duplicate function declaration, you're left with the body dangling, attached to nothing.

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""explode_scare""Explode"true1);
    
AddUseItemCallback("""key_1""mansion_3""FUNCTION"true);

    
FadeOut(0);
    
FadeIn(5);
    
SetPlayerActive(false);
    
SetPlayerCrouching(true);
    
SetInventoryDisabled(true);
    
MovePlayerHeadPos(0, -202, -2);
    
StartPlayerLookAt("ScriptArea_1"1010"");
    
AddTimer("T1"5.5"TimerFunc");
    
AddTimer("T2"10"TimerFunc");
    
AddTimer("T3"13.5"TimerFunc");
    
AddTimer("T4"16"TimerFunc");
}

void FUNCTION(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_door"asEntity0false);
    
RemoveItem(asItem);
}

void Explode(string &in asParentstring &in asChildint alState)
{
    
SetPropHealth("pot_explode"0);
}

void TimerFunc(string &in asTimer)
{
    
string x asTimer;
    
    if (
== "T1")
    {
        
FadeOut(4);
        
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false);
    }
    
    else if (
== "T2")
    {
        
FadeIn(3);
    }
    
    else if (
== "T3")
    {
        
FadeOut(2);
        
StopPlayerLookAt();
        
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false);
        
MovePlayerHeadPos(02022);
    }
    
    else if (
== "T4")
    {
        
FadeIn(2);
        
SetPlayerActive(true);
        
SetPlayerCrouching(false);
        
SetInventoryDisabled(false);
        
PlaySoundAtEntity("""react_breath.snt""Player"0false);
    }
}

void OnEnter()
{
    
AddEntityCollideCallback("Player""bang""func_slam"true1);
}

void OnLeave()
{
}

void func_slam(string &in asParentstring &in asChildint alState)
{
    
SetSwingDoorClosed("mansion_2"truetrue);
    
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false);
    
PlaySoundAtEntity("""react_scare""Player"0false);
    
PlaySoundAtEntity("""close_door.snt""Player"0false);
    
GiveSanityDamage(5.0ftrue);


Tutorials: From Noob to Pro
07-24-2012, 11:57 PM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: still having script problem and a simple question

Show us what the error is

Trying is the first step to success.
07-24-2012, 11:57 PM
Find
zecuro Offline
Member

Posts: 162
Threads: 33
Joined: Jul 2011
Reputation: 3
#7
RE: still having script problem and a simple question

(07-24-2012, 11:57 PM)beecake Wrote: Show us what the error is


well now i can enter the game but the player start un der the floor and he look like hes flying after help me out
and explain more what you did in the script i want to understand more
07-25-2012, 01:08 AM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#8
RE: still having script problem and a simple question

for the explaining: All you did was removing the function header(void OnStart()) and left all the commands of it inside nothing. They weren't in any function.
For the problem: Try moving your PlayerStartArea a bit higher.

Think, before you speak Google, before you post
(This post was last modified: 07-25-2012, 01:19 AM by Cruzore.)
07-25-2012, 01:19 AM
Find
zecuro Offline
Member

Posts: 162
Threads: 33
Joined: Jul 2011
Reputation: 3
#9
RE: still having script problem and a simple question

man it dosent work it look like i'm flying or something
07-25-2012, 01:58 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: still having script problem and a simple question

(07-25-2012, 01:58 AM)zecuro Wrote: man it dosent work it look like i'm flying or something

Well, you did tell the script to move the player's head about 2 meters upward and never made it reset to its normal position.

Tutorials: From Noob to Pro
07-25-2012, 04:48 AM
Website Find




Users browsing this thread: 1 Guest(s)