Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOW TO PLAY MUSIC??? ANOTHER ISSUE >:(
waqas12346 Offline
Senior Member

Posts: 352
Threads: 38
Joined: Nov 2010
Reputation: 1
#1
Sad  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
Website Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#2
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
}

[Image: 18694.png]
05-01-2011, 12:30 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#3
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
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#4
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
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#5
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
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#6
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 Smile 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
Find
waqas12346 Offline
Senior Member

Posts: 352
Threads: 38
Joined: Nov 2010
Reputation: 1
#7
RE: How to play music???

Did I made aNY mistake(S)??? Sad

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
Website Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#8
RE: How to play music???

(05-01-2011, 05:02 PM)waqas12346 Wrote: Did I made aNY mistake(S)??? Sad

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 Smile
05-01-2011, 05:19 PM
Find




Users browsing this thread: 1 Guest(s)