Frictional Games Forum (read-only)

Full Version: Scripts Recollection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Once we build up a big enough collection we should edit these entries a bit and move them over to the wiki.
A request; how to use "inventory.hps"-file for example to make two items combine ?
I know how to make a player teleport when he/she touches a area:

Code:
void CollidePlayerTeleport(string &in asParent, string &in asChild, int alState)
{
   TeleportPlayer(teleport_name);
}

-teleport_name: Name of what to teleport to, I recommend making another PlayerStartArea and giving the name of the extra player spawn.

To give a good touch to it, add the functions: FadeOut and FadeIn. Add it like this:

Code:
void CollidePlayerTeleport(string &in asParent, string &in asChild, int alState)
{
   TeleportPlayer(teleport_name);
   FadeOut(0);
   FadeIn(20);
}

Adding FadeOut and FadeIn makes the screen fade right when you teleport so its not like you just somehow ended up there.
Can you add this?

Edit: I know how to add music in your level:

Code:
void OnStart()
{
    PlayMusic("name of song", false, 0.7f, 0, 10, false);
}

-name of song: This is the name of the song you want to play on start. All music is in a folder called: music. If you have the Steam version of Amnesia, it will be in: Steam\steamapps\common\amnesia the dark descent
If you have the retail version, I don't have the retail version, I'm making a guess right now, the music folder should be in: program files/amnesia the dark descent/redist/
I hope thats right. Anyways, when you get there, you will see all the music. I don't know how to view the music though. They are .ogg files. Just look at the name of the songs. You'll figure everything out. Smile

When you are ready to place the name of the song in the PlayMusic function, Replace Name of Song with the song name you chose. It automaticly goes to the music folder. So don't worry about adding something like:
PlayMusic("redist/music/song name.ogg", false, 0.7f, 0, 10, false);
Right way:
PlayMusic("name of song.ogg", false, 0.7f, 0, 10, false);

Can you add this?
Also you can make player float by:
Code:
AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
Where float afX,float afY and float afZ are forces to X,Y,Z directions, and bool abUseLocalCoords is true or false if it should use LocalCoords, which is based on where player looks; where X is nothing, Y is right/left and Z is forward/backward. Also force is required to be high for player to move; ie. 2000 makes him move about 1 m.

P.S: Thanks house for the teleport so I don't have to fight with this Big Grin
And to house about the teleport script; teleport_name must be "string &asStartPosName" which I think means it must be start position. (So I think for example a normal script area won't work. But I might also be wrong Big Grin)
Also you can add sound by using:
Code:
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
-Where string& asSoundName is name of a sound.(Can be left blank, unless you want it to loop, and later stop.
-string& asSoundFile is sound file; the file you want to be played.
-string& asEntity is entity you want it to be played.(For example "player" makes it play at player, but if you want the sound to be heard from elsewhere; let's say a piano called "piano1", you put that("piano1") there.
-float afFadeTime is time it should fade, for example 1.0f would put 1 second fade time.
-bool abSaveSound. I am not sure what this is Big Grin Just set it to false.

And you can stop it by using:
Code:
StopSound(string& asSoundName, float afFadeTime);
-Where string& asSoundName is name of a sound(see above.)
-float afFadeTime; fade time, see above.
nice tutorials. It was very useful. But i have a question.
With the script: "Make a locked door and a key to unlock it".
How can i use more events?
(10-25-2010, 03:51 PM)Everlone Wrote: [ -> ]How can i use more events?

Events are..?
oh sorry ^^ my bad english, i will use more scripts.
the script from here show me i use one key for one door, but how i can add more keys for another doors.
So you have more than 1 door and want them to be unlocked by their specific keys!

Just add more AddUseItemCallbacks and their functions. If you have two doors, do two AddUseItemCallbacks and two functions that unlock the doors.
sure, but how i do this??? i have ever a failure if i make another script.
can you show me a example?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12