Frictional Games Forum (read-only)

Full Version: Bizarre Music Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This feels silly, because I'd gotten down how to add scripted music and all of a sudden this strange thing happens! The music is not playing at all and where the script area is for the music to start, a hand appears. 0.0

Maybe I'm just looking to hard to find what's wrong and need a second pair of eyes. I've been fighting this problem for a while now.

hps file:
Code:
void OnStart ()
{    
    {    
    AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, -1);
    }    
}

void OnEnter()
{

}

void OnLeave()
{
    
}

void HallKing(string &in parent, string &in child, int state)
{
    PlaySoundAtEntity("HallKing", "hallking.snt", "hallking_area", 0.5, false);

snt file: (named hallking.snt)
Code:
<SOUNDENTITY>
    <SOUNDS>
        <Main>
            <Sound File="hallking.ogg" />
        </Main>
    </SOUNDS>

    <PROPERTIES Volume="5" MinDistance="1" MaxDistance="50" Random="0"
    Interval="0" FadeEnd="False" FadeStart="False" Stream="False"
    Loop="False" Use3D="false" Blockable="False" BlockVolumeMul="0.7"
    Priority="5" />
</SOUNDENTITY>

In the level editor, the script area is named hallking_area and it's callback listed as HallKing under the area tab.
It should of been:

Code:
void OnStart ()

{     

    {    

    AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, -1);

    }    

}


void HallKing(string &in parent, string &in child, int state)

{

    PlaySoundAtEntity("HallKing", "hallking.snt", "hallking_area", 0.5, false);
}

void OnEnter()

{



}



void OnLeave()

{

    

}
void OnLeave and void OnEnter should be on the end. (IDK as i'm new, teehee!)
(02-03-2013, 02:31 AM)JustAnotherPlayer Wrote: [ -> ]It should of been:

Code:
void OnStart ()

{     

    {    

    AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, -1);

    }    

}


void HallKing(string &in parent, string &in child, int state)

{

    PlaySoundAtEntity("HallKing", "hallking.snt", "hallking_area", 0.5, false);
}

void OnEnter()

{



}



void OnLeave()

{

    

}
void OnLeave and void OnEnter should be on the end. (IDK as i'm new, teehee!)

Changing the order doesn't really do much. On another map I made, the void func is listed after the OnEnter and OnLeave and those work fine.
(Just Realized it...) You wanted to play music, right? It's supposed to be
PHP Code:
PlayMusic() 
NOT
PHP Code:
PlaySoundAtEntity 
(02-03-2013, 02:38 AM)JustAnotherPlayer Wrote: [ -> ](Just Realized it...) You wanted to play music, right? It's supposed to be
PHP Code:
PlayMusic() 
NOT
PHP Code:
PlaySoundAtEntity 

That's for just playing it in the background, right? I've used PlaySoundAtEntity for when the player reaches a certain area so it activates the sound at a specific moment, which is the goal.
in the Script Area properties, you put HallKing in its callback? That's odd. If i were you, i never put anything in the callback part on Script Area properties.
You can make it so that when the player walks into a certain area, the music plays in the background.

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""hallking_area""HallKing"true1);
}

void HallKing(string &in parentstring &in childint state)
{
    
PlayMusic("hallking.ogg"true1.0f01true);


EDIT: The reason the hand shows up is because you probably have some text where it says PlayerInteractCallback in the area properties.
(02-03-2013, 02:54 AM)NaxEla Wrote: [ -> ]You can make it so that when the player walks into a certain area, the music plays in the background.

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""hallking_area""HallKing"true1);
}

void HallKing(string &in parentstring &in childint state)
{
    
PlayMusic("hallking.ogg"true1.0f01true);


EDIT: The reason the hand shows up is because you probably have some text where it says PlayerInteractCallback in the area properties.
Your answer is mine 1 post ago!
(02-03-2013, 02:54 AM)NaxEla Wrote: [ -> ]You can make it so that when the player walks into a certain area, the music plays in the background.

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""hallking_area""HallKing"true1);
}

void HallKing(string &in parentstring &in childint state)
{
    
PlayMusic("hallking.ogg"true1.0f01true);


EDIT: The reason the hand shows up is because you probably have some text where it says PlayerInteractCallback in the area properties.

Tried it and still nothing plays. The hand is gone after deleting the callback function from the properties tab. This is really stumping!

I've used the PlaySoundAtEntity before in other scripts and they work, but for some reason this one is just not having it.
I think i found the problem.
It should have been:
PHP Code:
PlaySoundAtEntity("Player""hallking.snt""hallking_area"0.5false); 
]
NOT
PHP Code:
PlaySoundAtEntity("HallKing""hallking.snt""hallking_area"0.5false); 
Or if that didn't work, delete the void OnLeave and OnEnter. And wasn't it supposed to be 0.0, not 0.5?
Pages: 1 2