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
Gandalf's scripting questions thread
gandalf91 Offline
Senior Member

Posts: 439
Threads: 13
Joined: Feb 2011
Reputation: 0
#1
Gandalf's scripting questions thread

Hello. I'm pretty new here and just underway with a custom story of my own. So far my map isn't very large, just one decent sized room and a few corridors, but I'm having trouble with some of the sounds. I placed two instances of the sound 00_creak.snt near a large castle door on one side of the map. I changed the parameters so that the volume was lower and the range the sound could be heard much shorter...however, I'm still hearing the sound way on the other end of the map, far beyond how I set it. The volume seemed to work to some extent, just not the range of the sound. Any ideas?
(This post was last modified: 03-05-2011, 03:27 AM by gandalf91.)
03-04-2011, 08:26 PM
Find
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#2
RE: Modifying sound volumes and distances

(03-04-2011, 08:26 PM)gandalf91 Wrote: Hello. I'm pretty new here and just underway with a custom story of my own. So far my map isn't very large, just one decent sized room and a few corridors, but I'm having trouble with some of the sounds. I placed two instances of the sound 00_creak.snt near a large castle door on one side of the map. I changed the parameters so that the volume was lower and the range the sound could be heard much shorter...however, I'm still hearing the sound way on the other end of the map, far beyond how I set it. The volume seemed to work to some extent, just not the range of the sound. Any ideas?

Is it a sound that repeats?

Also, if the maximum range is too large, and the player is always inside it, you will not be able to detect where the sound is coming from.

Make sure the 'Use Defaults' box is UNTICKED and ensure that the maximum range is greater than the minimum range and ensure that the maximum range has a radius that is small enough for the player to walk into to experience the rise in volume as they move closer to the source.

If it is a sound that you only want to play once, you shouldn't be using the level editor to play the sound, although that is an entirely different story Tongue

03-04-2011, 09:14 PM
Find
gandalf91 Offline
Senior Member

Posts: 439
Threads: 13
Joined: Feb 2011
Reputation: 0
#3
RE: Modifying sound volumes and distances

Yup, use default is unchecked, I meant to mention that but forgot. It's meant to be a looping sound as well. I even tried min 0.5 and max 1.0 but could still hear it from far away. I've looked through dev scripts before and seen scripts about "pre-loading" sounds. Wouldn't need to do something like that, would I?
03-04-2011, 10:08 PM
Find
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#4
RE: Modifying sound volumes and distances

(03-04-2011, 10:08 PM)gandalf91 Wrote: Yup, use default is unchecked, I meant to mention that but forgot. It's meant to be a looping sound as well. I even tried min 0.5 and max 1.0 but could still hear it from far away. I've looked through dev scripts before and seen scripts about "pre-loading" sounds. Wouldn't need to do something like that, would I?

I assume that it only plays the sound as soon as you enter the map and doesn't play it again.

The creak sound is not designed for use in the level editor. You will need to use scripting to play the sound Undecided

03-04-2011, 10:20 PM
Find
gandalf91 Offline
Senior Member

Posts: 439
Threads: 13
Joined: Feb 2011
Reputation: 0
#5
RE: Modifying sound volumes and distances

Oh really? So I guess it's more like an ambient track then, like in the first level of the game. :/

For now I suppose I could just leave it out though, and sort it out later. Thank you for your help though! Big Grin I know I made the topic of this thread about sounds, but I'll probably have quite a few questions here and there about the scripting. Would it be better just to keep all my questions (regarding this particular map of course) to this one thread?
03-04-2011, 11:53 PM
Find
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#6
RE: Modifying sound volumes and distances

(03-04-2011, 11:53 PM)gandalf91 Wrote: Oh really? So I guess it's more like an ambient track then, like in the first level of the game. :/

For now I suppose I could just leave it out though, and sort it out later. Thank you for your help though! Big Grin I know I made the topic of this thread about sounds, but I'll probably have quite a few questions here and there about the scripting. Would it be better just to keep all my questions (regarding this particular map of course) to this one thread?

Sure, just use 'Full Edit' on your original post and rename the thread title and bump your thread each time you have a question. Maybe rename it "Gandalf's Scripting Question Thread" or something Smile

03-04-2011, 11:59 PM
Find
gandalf91 Offline
Senior Member

Posts: 439
Threads: 13
Joined: Feb 2011
Reputation: 0
#7
RE: Gandalf's scripting questions thread

Lol, I just might take you up on that. Anyway, just looks like I have one more quick question for tonight. It seems I've learned to use basic "EntityCollide" callbacks pretty well, but I seem to be unable to figure out how to create an interact callback. Tried trial and error a couple times but got error messages about unmatching signatures.

Aside from that, I figured out one my own how to spawn a servant with disabled triggers (so he can't detect you) and then add a 6 second timer upon which the enemy triggers a re-enabled. So I felt accomplished about that. Big Grin
03-05-2011, 03:31 AM
Find
Samuelblitz Offline
Junior Member

Posts: 16
Threads: 4
Joined: Feb 2011
Reputation: 0
#8
RE: Gandalf's scripting questions thread

(03-05-2011, 03:31 AM)gandalf91 Wrote: Lol, I just might take you up on that. Anyway, just looks like I have one more quick question for tonight. It seems I've learned to use basic "EntityCollide" callbacks pretty well, but I seem to be unable to figure out how to create an interact callback. Tried trial and error a couple times but got error messages about unmatching signatures.

Aside from that, I figured out one my own how to spawn a servant with disabled triggers (so he can't detect you) and then add a 6 second timer upon which the enemy triggers a re-enabled. So I felt accomplished about that. Big Grin

Here is the interact callback script:

SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

under Name put the name of the entity in quotes.
under Callback choose a callback name in quotes.
the last one true or false depending on weather you want the callback to be removed after or not.

and then obviously later in the script you put

void WhatEverYourCallBackNameWas(string &in asParent, string &in asChild, int alState)
{
}

with whatever you want the callback to trigger in the {}'s.

oh and by the way, this: http://wiki.frictionalgames.com/hpl2/amn..._functions
has all the script functions you'll ever need Smile
03-05-2011, 04:05 AM
Find
gandalf91 Offline
Senior Member

Posts: 439
Threads: 13
Joined: Feb 2011
Reputation: 0
#9
RE: Gandalf's scripting questions thread

Thanks. Smile I had just kept using "add" instead of "set", but I've corrected it now. Impulse script on a door now is frustrating me though!

In the void Onstart() section I have these callback functions listed:

AddEntityCollideCallback("Player", "ScriptArea_3", "Candlelight1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "Candlelight2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_5", "Candlelight3", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "Candlelight4", true, 1);

Then further down in my script I have:

void Candlelight1(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_1", true, true);
SetLampLit("candle_floor_2", true, true);
AddPropImpulse("prison_section_1", 0.0f, 0.0f, 0.2f, false);
}

void Candlelight2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_3", true, true);
SetLampLit("candle_floor_4", true, true);
AddPropImpulse("prison_section_1", 0.0f, 0.0f, 0.2f, false);
}

void Candlelight3(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_5", true, true);
SetLampLit("candle_floor_6", true, true);
AddPropImpulse("prison_section_1", 0.0f, 0.0f, 0.25f, false);
}


void Candlelight4(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_7", true, true);
SetLampLit("candle_floor_8", true, true);
AddPropImpulse("prison_section_1", 0.0f, 0.0f, 0.3f, false);
}

The effect is to light candles on either side of you as you walk down a corridor and slowly push a door ("prison_section_1") open in front of you. My AddPropImpulse section keeps returning non-matching signatures.
03-05-2011, 06:13 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#10
RE: Gandalf's scripting questions thread

Yeah, because the last parameter is not correct.

Check the script functions: http://wiki.frictionalgames.com/hpl2/amn..._functions

void  AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);

That means you need a string, float, float, float, string.
But you got a boolean at the end instead of a string.

03-05-2011, 05:34 PM
Find




Users browsing this thread: 1 Guest(s)