taylor122002
Junior Member
Posts: 13
Threads: 10
Joined: Aug 2012
Reputation:
0
|
How to script Music when walking into a ScriptArea?
amnesiahelp5.png (Size: 33.81 KB / Downloads: 164)
Firstly, I want to say thank you to everyone at the forums for all of your help on scripting! I've learned many new things which could help my custom story come along nicely! I finally finished my first map, which was 128 lines of scripting! And it all works! Now I'm working on the second map of the custom story, which is downstairs. I want to make it so when you walk into a script area, music will play, and that Daniel turns his head to the side and a monster charges at you but then disappears at last second It could be for a small scare. I already no how to set it up with sounds, but I want music, and know how to make it so when walked into the scripted area, the character will turn his head and see a monster.
Here is what I have for my script so far, but I get a ton of errors.:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music_1", "Start", true, 1);
}
void Start(string &in asParent, string &in asChild, int alState)
{
PlayMusic("", "10_event_coming.ogg", true, 0.8, 2, 1, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
And I don't know how to script so you turn your head.
That script I got from YouTube except changed the sound with music.
And I'll use an attachment for what the errors say.
I noticed though that the error had some things from the first map I used. Like the "Low Sanity" thing I used in my first map, Room01. But it's included in the error for Downstairs01. But I don't get these errors when I use an actual sound and not music.
(This post was last modified: 11-05-2012, 10:35 PM by taylor122002.)
|
|
11-05-2012, 10:33 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: How to script Music when walking into a ScriptArea?
(11-05-2012, 10:33 PM)taylor122002 Wrote: Firstly, I want to say thank you to everyone at the forums for all of your help on scripting! I've learned many new things which could help my custom story come along nicely! I finally finished my first map, which was 128 lines of scripting! And it all works! Now I'm working on the second map of the custom story, which is downstairs. I want to make it so when you walk into a script area, music will play, and that Daniel turns his head to the side and a monster charges at you but then disappears at last second It could be for a small scare. I already no how to set it up with sounds, but I want music, and know how to make it so when walked into the scripted area, the character will turn his head and see a monster.
Here is what I have for my script so far, but I get a ton of errors.:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music_1", "Start", true, 1);
}
void Start(string &in asParent, string &in asChild, int alState)
{
PlayMusic("", "10_event_coming.ogg", true, 0.8, 2, 1, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
And I don't know how to script so you turn your head.
That script I got from YouTube except changed the sound with music.
And I'll use an attachment for what the errors say.
I noticed though that the error had some things from the first map I used. Like the "Low Sanity" thing I used in my first map, Room01. But it's included in the error for Downstairs01. But I don't get these errors when I use an actual sound and not music. StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);
To look at entity and
StopPlayerLookAt();
to stop looking
|
|
11-05-2012, 10:40 PM |
|
taylor122002
Junior Member
Posts: 13
Threads: 10
Joined: Aug 2012
Reputation:
0
|
RE: How to script Music when walking into a ScriptArea?
(11-05-2012, 10:40 PM)ZodiaC Wrote: (11-05-2012, 10:33 PM)taylor122002 Wrote: Firstly, I want to say thank you to everyone at the forums for all of your help on scripting! I've learned many new things which could help my custom story come along nicely! I finally finished my first map, which was 128 lines of scripting! And it all works! Now I'm working on the second map of the custom story, which is downstairs. I want to make it so when you walk into a script area, music will play, and that Daniel turns his head to the side and a monster charges at you but then disappears at last second It could be for a small scare. I already no how to set it up with sounds, but I want music, and know how to make it so when walked into the scripted area, the character will turn his head and see a monster.
Here is what I have for my script so far, but I get a ton of errors.:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music_1", "Start", true, 1);
}
void Start(string &in asParent, string &in asChild, int alState)
{
PlayMusic("", "10_event_coming.ogg", true, 0.8, 2, 1, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
And I don't know how to script so you turn your head.
That script I got from YouTube except changed the sound with music.
And I'll use an attachment for what the errors say.
I noticed though that the error had some things from the first map I used. Like the "Low Sanity" thing I used in my first map, Room01. But it's included in the error for Downstairs01. But I don't get these errors when I use an actual sound and not music. StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);
To look at entity and
StopPlayerLookAt();
to stop looking Thanks! I got the head motion right! But I can't get it right so when you walk into a script area, it happens. Right when I enter the level door leading to downstairs, then it goes straight to the "Grunt_1", and when I try to look away, it keeps going back there. Even after waiting for a long period of time.
|
|
11-06-2012, 12:14 AM |
|
craven7
Member
Posts: 50
Threads: 8
Joined: Aug 2012
Reputation:
1
|
RE: How to script Music when walking into a ScriptArea?
Like taylor said, to stop the LookAt- effect use
StopPlayerLookAt();
However, I don't understand your other problems, could you reexplain them and post your code?
|
|
11-06-2012, 02:26 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: How to script Music when walking into a ScriptArea?
You need to make sure that StartPlayerLookAt is being used in the function called by 'AddEntityCollideCallback', which in this case seems to be 'void Start'. In the function called from StartPlayerLookAt, you should have StopPlayerLookAt, so that once the player is looking at the thing, it unlocks the camera
If this doesnt help, I recommend you re-post your updated script so we can see whats up with it
|
|
11-06-2012, 02:45 PM |
|
|