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
Two Unrelated Questions
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#2
RE: Two Unrelated Questions

I assume you know what OnStart() means...
Put this inside it:
AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

all those string & blablah weird names may look like gibberish but ima try to explain those here nao!

what AddEntityCollideCallback really does is = when specified 2 "things" go in, out or both, some function is called (those can be specified in it). So when you want the player step into area, you put "Player" in the string& asParentName and "*the name of your area*" in the string& asChildName, so this checks when you = player collide with the area.

string& asFunction is the name of the function you want to call. Every thing that has string before something the script functions page (http://wiki.frictionalgames.com/hpl2/amn...en_effects) must be put inside brackets "". That's one common and easy thing to follow and it makes reading the script functions page easier.
So in your case we could name the string& asFunction something like this: "blehblah"

bool abDeleteOnCollide - determines whether the callback after it was called
Swedes can't english so it means you have 2 options to put in that place: true or false.
Which one you wanna use depends on if you want the function to trigger AGAIN after the first collide with player and the area. true means it only happens once, false means you can step on it repeatedly to trigger lots of "blehblah" 's! I assume you want your thing to happen only once!

int alStates means when you want "blehblah" to trigger, when the player first hits the area is 1, when the player comes out from the area is -1 and 0 is both! I assume you want it to happen when the player hits the area.

So with these names I used your final callback would be this with the OnStart()

OnStart()
{
AddEntityCollideCallback("Player", "nameofyourearea", "blehblah", false, 1);
}
Then if you want to play a sound after the player hits the area, you have to use one of these:

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);

PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);

PlayGuiSound(string& asSoundFile, float afVolume);

The one you need to use depends on how you want the sound to happen.
with PlaySoundAtEntity, you can only use .snt sounds (those are several sounds in a single file that picks one to play randomly every time, meaning it doesn't sound weird and can be used many times). Also PlaySoundAtEntity lets you pick the place where you want the sound to come from, area, entity or player himself are all usable. Also you can fade sounds out with this (pretty unnecessary).

FadeInSound is only for those sounds that you have already placed inside your level in level editor. Like this selected in this picture: http://imageshack.us/photo/my-images/714...utori.jpg/
Use FadeInSound with StopSound, they are practically the opposites of each other.

PlayMusic is only for the .ogg files that are mainly included in your music folder. The music can be set to loop with this and you can adjust the volume (use with StopMusic).

PlayGuiSound can be used with .ogg files, meaning you don't need .snt file for sounds. With this function you can't adjust the location of the sound. It always comes from both speakers.

I hope this isn't too much of a mess and actually helps...
(This post was last modified: 06-02-2011, 01:19 AM by Khyrpa.)
06-02-2011, 01:04 AM
Find


Messages In This Thread
Two Unrelated Questions - by Beargasm - 06-02-2011, 12:34 AM
RE: Two Unrelated Questions - by Khyrpa - 06-02-2011, 01:04 AM



Users browsing this thread: 1 Guest(s)