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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Let a note starting music [Solved]
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#1
Let a note starting music [Solved]

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

ShipinShen - YouTube
(This post was last modified: 04-25-2014, 10:39 PM by ShipinShen.)
04-23-2014, 05:53 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Let a note starting music

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.
(This post was last modified: 04-23-2014, 06:01 PM by DnALANGE.)
04-23-2014, 05:59 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Let a note starting music

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.

04-23-2014, 06:10 PM
Find
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#4
RE: Let a note starting music

(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"

ShipinShen - YouTube
04-23-2014, 09:42 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Let a note starting music

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.

(This post was last modified: 04-24-2014, 12:23 AM by Mudbill.)
04-24-2014, 12:22 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#6
RE: Let a note starting music

Try this;

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

 
void OnStart()
 {
SetEntityPlayerInteractCallback("prestige""prestige1"true);
 } 
(This post was last modified: 04-24-2014, 10:33 AM by DnALANGE.)
04-24-2014, 10:29 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: Let a note starting music

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: (Select All)
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

(This post was last modified: 04-24-2014, 10:52 AM by Mudbill.)
04-24-2014, 10:52 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#8
RE: Let a note starting music

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?
(This post was last modified: 04-24-2014, 04:54 PM by DnALANGE.)
04-24-2014, 04:52 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: Let a note starting music

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).

(This post was last modified: 04-24-2014, 05:07 PM by Mudbill.)
04-24-2014, 05:07 PM
Find
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#10
RE: Let a note starting music

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

PHP Code: (Select All)
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) ?

ShipinShen - YouTube
(This post was last modified: 04-25-2014, 06:08 PM by ShipinShen.)
04-25-2014, 04:26 PM
Find




Users browsing this thread: 1 Guest(s)