OK, I'll expand a bit on what others have said.
First, for some basic understanding of how the game and the script interact with each other, read
this short article.
Now, here we go:
(01-30-2013, 01:54 AM)serbusfish Wrote: You enter a room,
To detect if a player has entered a room or not, you normally set up the script to detect a collision with a script area. So, first make sure that the map itself contains a script area that can be used for this. Depending on what exactly you want to happen, you can just put a thin script area right in front of the door, or you can place a big box in the center of the room to define an inner region where this should happen. In the script file, you would use an AddEntityCollideCallback() to "subscribe to" collision detection with that area, as described above by
The chaser and
BeeKayK (a more detailed explanation on how to use basic functions and parameters
here, and of callbacks
here)
(01-30-2013, 01:54 AM)serbusfish Wrote: the sound of a plate or vase smashing is heard from another room,
Similarly, you need something in your level to define the source of the sound. Either edit the script file to break an actual vase entity using SetPropHealth() as
The chaser did, or use the level editor to add a script area in the other room (or just near or behind the wall, in empty space - if there's no really another room) to define where the sound should come from. Once this is done, just find the appropriate sound, and edit the script file to make a call to PlaySoundAtEntity() in place of SetPropHealth(), like this (replace the names to match the names in your level - "internal.sound.id" can be whatever you like, the number 0.0f is sound fade in time in seconds (the f is just some data type suffix, don't worry about that)):
PlaySoundAtEntity("internal.sound.id", "SoundFileName.snt", "ScriptAreaName", 0.0f , false);
(01-30-2013, 01:54 AM)serbusfish Wrote: the centre dot 'looks' to where the sound came from,
Use StartPlayerLookAt() as described by
The chaser above, and then AddTimer() so that you can exit the forced look-at state after some time, by calling StopPlayerLookAt() inside the timer callback (which
The chaser forgot to do).
(01-30-2013, 01:54 AM)serbusfish Wrote: then the sound of a monster walking is heard
Either immediately use PlaySoundAtEntity() as before (but perhaps on a different script area) to play a monster walking sound (just find some footstep sounds that came with the game), or first add a timer if you want to offset the sound playback by some time amount.
(01-30-2013, 01:54 AM)serbusfish Wrote: followed by the sound of a door shutting.
Same as before.
P.S. Consult the
engine script functions reference page to find out more about the available functions, and how to use them (what their parameters mean).