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
HPL2 sound and add entitles, on area. //script need help
johnbanana Offline
Junior Member

Posts: 9
Threads: 4
Joined: Oct 2011
Reputation: 0
#1
Exclamation  HPL2 sound and add entitles, on area. //script need help

Im hoppeing im puting this on the right place.


i have dyslexria and ADD. so dont rip your head off if my stupidity is overwhelming.
i have try to find tutorials and read on other forums and never found a simple way just to add

(on player,collide,area,script ==> ad enitis/sound(ad just a scary sound "once")


i do know some scripting, like adding a grunt and give him pathnods.
i do also know how to ad a lever that open a secret shalf.

my questions is.

1.

how do you script to an "area" the player runs into and plays a sound (only once)

2.

player runs into an "area" and a entity pop up. lika an statue or a naked guy falling from the celling.


yes i have tryd find sulutions on http://wiki.frictionalgames.com/hpl2/start
never found any.(or just simply missunderstod.)

sooo.. i wuld be wery happy if you shared your way how to ad a simple-script "player" walk into "area" that trigger a sound or an entity
i really shuld stop wasting 5 hours on just testing one script that never works. i better ask you people.

my english sucks ^^
need better explnation just tell me.

.png   amnesia2.PNG (Size: 478.68 KB / Downloads: 179)
(This post was last modified: 10-20-2011, 07:35 PM by johnbanana.)
10-20-2011, 04:58 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
RE: HPL2 sound and add entitles, on area. //script need help

Use the area tool in the level editor, and make an area in your map. Make sure it's a script area (not slime, liquid, insanity, etc)
Then, in your OnStart function add AddEntityCollideCallback (parameters and such can be found on the wiki)
then create another function that has PlaySoundAtEntity in it (again, parameters in the wiki)

For the second one, create another AddEntityCollideCallback in your OnStart function
Then, in another function, have SetEntityActive (parameters in the wiki) For this to work right, you have to place the entity in the map, and uncheck the "active" box.

Script Examples
void OnStart()
{
       AddEntityCollideCallback("Player", "NoiseArea", "PlayNoise, true, 1);
}
void PlayNoise(string &in asParent, string &in asChild, int alState)
{
       PlaySoundAtEntity("", "00_laugh.snt", "Player", false, 0);
}
void OnStart()
{
       AddEntityCollideCallback("Player", "ScareArea", "PopUp", true, 1);
}
void PopUp(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("corpse_1", true);
}

10-20-2011, 06:47 PM
Find
johnbanana Offline
Junior Member

Posts: 9
Threads: 4
Joined: Oct 2011
Reputation: 0
#3
RE: HPL2 sound and add entitles, on area. //script need help

(10-20-2011, 06:47 PM)Obliviator27 Wrote: Use the area tool in the level editor, and make an area in your map. Make sure it's a script area (not slime, liquid, insanity, etc)
Then, in your OnStart function add AddEntityCollideCallback (parameters and such can be found on the wiki)
then create another function that has PlaySoundAtEntity in it (again, parameters in the wiki)

For the second one, create another AddEntityCollideCallback in your OnStart function
Then, in another function, have SetEntityActive (parameters in the wiki) For this to work right, you have to place the entity in the map, and uncheck the "active" box.

Script Examples
void OnStart()
{
       AddEntityCollideCallback("Player", "NoiseArea", "PlayNoise, true, 1);
}
void PlayNoise(string &in asParent, string &in asChild, int alState)
{
       PlaySoundAtEntity("", "00_laugh.snt", "Player", false, 0);
}
void OnStart()
{
       AddEntityCollideCallback("Player", "ScareArea", "PopUp", true, 1);
}
void PopUp(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("corpse_1", true);
}
have alredy try the second one.
and it work! thanks alot. still its silly that i didnt mange to get none of these simple scripts to work...
(when im work on it alone)
i wonder where did i go wrong. :/

10-20-2011, 07:03 PM
Find




Users browsing this thread: 2 Guest(s)