AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
|
Bizarre Music Error
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:
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)
<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.
|
|
02-03-2013, 02:04 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Bizarre Music Error
It should of been:
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!)
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-03-2013, 02:31 AM |
|
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
|
RE: Bizarre Music Error
(02-03-2013, 02:31 AM)JustAnotherPlayer Wrote: It should of been:
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.
|
|
02-03-2013, 02:35 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Bizarre Music Error
(Just Realized it...) You wanted to play music, right? It's supposed to be
NOT
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-03-2013, 02:38 AM |
|
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
|
RE: Bizarre Music Error
(02-03-2013, 02:38 AM)JustAnotherPlayer Wrote: (Just Realized it...) You wanted to play music, right? It's supposed to be
NOT
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.
|
|
02-03-2013, 02:40 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Bizarre Music Error
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.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-03-2013, 02:52 AM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: Bizarre Music Error
You can make it so that when the player walks into a certain area, the music plays in the background.
void OnStart() { AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, 1); }
void HallKing(string &in parent, string &in child, int state) { PlayMusic("hallking.ogg", true, 1.0f, 0, 1, true); }
EDIT: The reason the hand shows up is because you probably have some text where it says PlayerInteractCallback in the area properties.
(This post was last modified: 02-03-2013, 02:55 AM by NaxEla.)
|
|
02-03-2013, 02:54 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Bizarre Music Error
(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.
void OnStart() { AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, 1); }
void HallKing(string &in parent, string &in child, int state) { PlayMusic("hallking.ogg", true, 1.0f, 0, 1, true); }
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!
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-03-2013, 03:00 AM |
|
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
|
RE: Bizarre Music Error
(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.
void OnStart() { AddEntityCollideCallback("Player", "hallking_area", "HallKing", true, 1); }
void HallKing(string &in parent, string &in child, int state) { PlayMusic("hallking.ogg", true, 1.0f, 0, 1, true); }
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.
|
|
02-03-2013, 03:21 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Bizarre Music Error
I think i found the problem.
It should have been:
PlaySoundAtEntity("Player", "hallking.snt", "hallking_area", 0.5, false);
]
NOT
PlaySoundAtEntity("HallKing", "hallking.snt", "hallking_area", 0.5, false);
Or if that didn't work, delete the void OnLeave and OnEnter. And wasn't it supposed to be 0.0, not 0.5?
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-03-2013, 03:27 AM |
|
|