waqas12346
Senior Member
Posts: 352
Threads: 38
Joined: Nov 2010
Reputation:
1
|
HOW TO PLAY MUSIC??? ANOTHER ISSUE >:(
How can I play music in my custom story????
Is there any script for it???
(This post was last modified: 05-01-2011, 05:07 PM by waqas12346.)
|
|
05-01-2011, 12:15 PM |
|
Ongka
Member
Posts: 225
Threads: 3
Joined: Nov 2010
Reputation:
20
|
RE: How to play music???
void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true); //17_amb.ogg is the name of the music file
}
|
|
05-01-2011, 12:30 PM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to play music???
(05-01-2011, 12:30 PM)Ongka Wrote: void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true); //17_amb.ogg is the name of the music file
}
How to stop looping music with this script?
void KillLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_orange_1", true, true);
SetLampLit("candlestick_wall_orange_2", true, true);
SetLampLit("candlestick_floor_2", true, true);
SetLampLit("candlestick02_2", true, true);
SetLampLit("candlestick02_3", true, true);
SetLampLit("candle_floor_4", true, true);
GiveSanityDamage(20, true);
THIS -> PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
}
“Life is a game, play it”
|
|
05-01-2011, 01:12 PM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: How to play music???
(05-01-2011, 01:12 PM)HumiliatioN Wrote: (05-01-2011, 12:30 PM)Ongka Wrote: void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true); //17_amb.ogg is the name of the music file
}
How to stop looping music with this script?
void KillLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_orange_1", true, true);
SetLampLit("candlestick_wall_orange_2", true, true);
SetLampLit("candlestick_floor_2", true, true);
SetLampLit("candlestick02_2", true, true);
SetLampLit("candlestick02_3", true, true);
SetLampLit("candle_floor_4", true, true);
GiveSanityDamage(20, true);
THIS -> PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
}
PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
Change the bold part to false if you don't want it to loop.
(This post was last modified: 05-01-2011, 01:42 PM by Roenlond.)
|
|
05-01-2011, 01:41 PM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to play music???
(05-01-2011, 01:41 PM)Roenlond Wrote: (05-01-2011, 01:12 PM)HumiliatioN Wrote: (05-01-2011, 12:30 PM)Ongka Wrote: void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true); //17_amb.ogg is the name of the music file
}
How to stop looping music with this script?
void KillLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_orange_1", true, true);
SetLampLit("candlestick_wall_orange_2", true, true);
SetLampLit("candlestick_floor_2", true, true);
SetLampLit("candlestick02_2", true, true);
SetLampLit("candlestick02_3", true, true);
SetLampLit("candle_floor_4", true, true);
GiveSanityDamage(20, true);
THIS -> PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
}
PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
Change the bold part to false if you don't want it to loop.
Fantastic it works, thanks!
“Life is a game, play it”
|
|
05-01-2011, 03:46 PM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: How to play music???
(05-01-2011, 03:46 PM)HumiliatioN Wrote: (05-01-2011, 01:41 PM)Roenlond Wrote: (05-01-2011, 01:12 PM)HumiliatioN Wrote: (05-01-2011, 12:30 PM)Ongka Wrote: void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true); //17_amb.ogg is the name of the music file
}
How to stop looping music with this script?
void KillLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_orange_1", true, true);
SetLampLit("candlestick_wall_orange_2", true, true);
SetLampLit("candlestick_floor_2", true, true);
SetLampLit("candlestick02_2", true, true);
SetLampLit("candlestick02_3", true, true);
SetLampLit("candle_floor_4", true, true);
GiveSanityDamage(20, true);
THIS -> PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
}
PlayMusic("20_puzzle.ogg", true, 1.0f, 0, 0, true);
Change the bold part to false if you don't want it to loop.
Fantastic it works, thanks!
You're welcome Be sure to visit http://wiki.frictionalgames.com/hpl2/amn..._functions for more help if you need it! Function descriptions there are priceless.
|
|
05-01-2011, 04:16 PM |
|
waqas12346
Senior Member
Posts: 352
Threads: 38
Joined: Nov 2010
Reputation:
1
|
RE: How to play music???
Did I made aNY mistake(S)???
Quote:void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true);
}
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_8", 0, "");
PlayMusic("10_event_coming", false, 1.0f, 0, 0, true);
AddUseItemCallback("", "key_study_1", "level_orb_room_door_1", "KeyOnDoor", true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}
(This post was last modified: 05-01-2011, 05:10 PM by waqas12346.)
|
|
05-01-2011, 05:02 PM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: How to play music???
(05-01-2011, 05:02 PM)waqas12346 Wrote: Did I made aNY mistake(S)???
Quote:void OnEnter()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true);
}
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_8", 0, "");
PlayMusic("10_event_coming", false, 1.0f, 0, 0, true);
AddUseItemCallback("", "key_study_1", "level_orb_room_door_1", "KeyOnDoor", true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}
Yes, the {
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
} has no function, i.e void, it's best to start those in the "void OnStart()."
Here, try this:
void OnStart()
{
PlayMusic("17_amb.ogg", true, 1.0f, 0, 0, true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_8", 0, "");
PlayMusic("10_event_coming", false, 1.0f, 0, 0, true);
AddUseItemCallback("", "key_study_1", "level_orb_room_door_1", "KeyOnDoor", true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}
/////////////
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Tell me if you're getting any error
|
|
05-01-2011, 05:19 PM |
|
|