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 Make a sound play when you pick up a note
Iyiyt Offline
Junior Member

Posts: 13
Threads: 5
Joined: Jul 2012
Reputation: 0
#9
RE: Make a sound play when you pick up a note

(07-23-2012, 09:09 PM)Cruzore Wrote: For the second one, make sure you used "CallbackFunc".
and at

void playnotesound(string &in Entity, string& in type)

string& in type is wrong, use this: string &in type

Also, why use 2 callbacks for 2 different functions, when it's the same entity? Doesn't make sense, and is probably why it doesn't work. If you meant to do that, I suggest using CallbackFunc to call a single function which has both the grunt activation and the sound.

And if that still doesn't work, try adding this inside your called function:
if(type == "OnPickup")
{
//stuff to do
}
I appreciate all of your help, everyone. When I finish my custom story (read as: IF I finish my custom story in the next decade), than I will definitely put you all in my credits. Not that anybody will ever see it or care. But still, it's the thought that counts. Anyway, what you^ said makes a lot of sense and sounds like it would work. But being both new at this and apparently a painfully slow learner, every way I tried it it didn't work. If anyone could just quickly type out the script (from the start) for me, it would be greatly appreciated. Then I can finally move on to the next part of the story, and probably get stuck there, too.

If it helps any, here's the code I got that I think was probably the closest to working. BUT IT STILL PLAYS THE %#$&*@ NOISE AT THE START OF THE LEVEL! Everything else works perfectly. Which reminds me, it might be the way I'm doing it. I have the actual sound file in the level editor, placed at the same coordinates as where the Grunt appears. It's set as inactive. When you click on the note, I'm trying to make it become active and play. If that's what's wrong, could you tell me? Or shout at me for being an idiot. Whatever. And then tell me the way I'm supposed to do it? Thanks. Oh! The code! Here it is;
///////////////////////////
//Run when entering map
void OnStart()
{
SetEntityPlayerInteractCallback("Chris", "play", true);
}

void play(string &in asEntity, string &in asType)
{
SetEntityActive("GruntUno", true);
PlayGuiSound("Commie", 1.0f);
}
(This post was last modified: 07-25-2012, 04:54 AM by Iyiyt.)
07-25-2012, 04:40 AM
Find


Messages In This Thread
RE: Make a sound play when you pick up a note - by Iyiyt - 07-25-2012, 04:40 AM



Users browsing this thread: 1 Guest(s)