Frictional Games Forum (read-only)
[SCRIPT] Let a note starting music [Solved] - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Let a note starting music [Solved] (/thread-25146.html)

Pages: 1 2


Let a note starting music [Solved] - ShipinShen - 04-23-2014

Hey i already know, how to add the voice acting to a note, but i dont know how let a note start music.. I want that the music starts to play when i'm reading note, even after closing the note, the music should continue.
I think it should work with an addentitycollidecallback, shouldn't it ?

Thanks for help Smile


RE: Let a note starting music - DnALANGE - 04-23-2014

Just do not want to just show off the script.
why not just look a little in for example the main game its files \ scripts \ level editor.
I am not 100% sure but i think it is NOT possible to have music AND voiceacting together in a note.
Note is NOT possible to have voiceacting btw. should be in JOURNAL then.
-
I guess what you can do is this when picked up the note :
SetEntityPlayerLookAtCallback("", "", true);, when interacting add a .ogg file.
Try it out i should say.


RE: Let a note starting music - Mudbill - 04-23-2014

I suggest adding a PickUp callback and run PlayMusic or possibly PlayGuiSound as you pick it up. That could work. You just need to make sure the event is actually executed before the note text appears, or else it will wait until you close it.


RE: Let a note starting music - ShipinShen - 04-23-2014

(04-23-2014, 06:10 PM)Mudbill Wrote: I suggest adding a PickUp callback and run PlayMusic or possibly PlayGuiSound as you pick it up. That could work. You just need to make sure the event is actually executed before the note text appears, or else it will wait until you close it.

Thats a good idea, i tried it with PlayGuiSound and with PlayMusic, but it gives me an error "ERR expectet Data Type" on the red marked lines

Quote:void prestige("NoteHilfe", "OnPickup")
{
PlayGuiSound("Prestige.snt", 1);
}

void OnStart()
{
SetEntityCallbackFunc("prestige", "prestige1");
}

The Callback func of the note in the editor is names as "prestige1" and the note as "NoteHilfe"


RE: Let a note starting music - Mudbill - 04-24-2014

You do not modify the parameters in a constructor. Leave those as they are and only modify the calls to the different functions within your block.

I think the parameters you need here are (string &in asEntity, string &in Type).

Also change the callback in OnStart to include "prestige" in both, rather than "prestige1" in the second.


RE: Let a note starting music - DnALANGE - 04-24-2014

Try this;

PHP Code:
void prestige1(string &in asItem)
 {
 
PlayGuiSound("Prestige.ogg"1);//You Always use .ogg for PlayGuiSound(s).
 
}

 
void OnStart()
 {
SetEntityPlayerInteractCallback("prestige""prestige1"true);
 } 



RE: Let a note starting music - Mudbill - 04-24-2014

You CAN use .snt files in PlayGuiSound, but it's not required.

And as you can see, the parameters are indeed (string &in asEntity, string &in type). (string &in asEntity) belongs to interaction callbacks rather than regular callbacks.

Quote:
PHP Code:
void SetEntityCallbackFunc(stringasNamestringasCallback); 

Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity, string &in type)
Type depends on entity type and includes: “OnPickup”, “Break”, “OnIgnite”, etc



RE: Let a note starting music - DnALANGE - 04-24-2014

The one i gave should work if i aint wrong..
if i am wrong i am mistaken and i want to learn why i am wrong Tongue

a Note is recigniced as a item if i aitn wrong here.
so when pick up the note it should be item?


RE: Let a note starting music - Mudbill - 04-24-2014

Well, it might work, but seeing as the EntityCallback itself has a "type" of PickUp which is designed for picking up items, it's probably a better option than an EntityInteract callback, which is designed when the player interacts with an object (as in clicking on it).


RE: Let a note starting music - ShipinShen - 04-25-2014

(04-24-2014, 10:29 AM)DnALANGE Wrote: Try this;

PHP Code:
void prestige1(string &in asItem)
 {
 
PlayGuiSound("Prestige.ogg"1);//You Always use .ogg for PlayGuiSound(s).
 
}

 
void OnStart()
 {
SetEntityPlayerInteractCallback("prestige""prestige1"true);
 } 

where i have to write the item name, the script doesnt work :p, i thinkt thats the reason ? in void prestige1(string &in asItem) ?