Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Thread Closed 
 
Thread Rating:
  • 16 Vote(s) - 4.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripts Recollection
Author Message
mastersmith98 Offline
Junior Member

Posts: 21
Joined: Oct 2010
Reputation: 0
Post: #11
RE: Scripts Recollection

Once we build up a big enough collection we should edit these entries a bit and move them over to the wiki.

Join the Amnesia Modders group on Moddb!
10-21-2010 03:27 AM
Find all posts by this user
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #12
RE: Scripts Recollection

A request; how to use "inventory.hps"-file for example to make two items combine ?

[Image: 2qnr5av.png]
10-21-2010 09:23 AM
Find all posts by this user
house Offline
Member

Posts: 195
Joined: Oct 2010
Reputation: 1
Post: #13
RE: Scripts Recollection

I know how to make a player teleport when he/she touches a area:

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:

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:

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?
10-22-2010 07:31 PM
Find all posts by this user
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #14
RE: Scripts Recollection

Also you can make player float by:
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)

[Image: 2qnr5av.png]
(This post was last modified: 10-23-2010 11:33 AM by anzki.)
10-23-2010 11:07 AM
Find all posts by this user
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #15
RE: Scripts Recollection

Also you can add sound by using:
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:
StopSound(string& asSoundName, float afFadeTime);
-Where string& asSoundName is name of a sound(see above.)
-float afFadeTime; fade time, see above.

[Image: 2qnr5av.png]
10-24-2010 10:13 AM
Find all posts by this user
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #16
RE: Scripts Recollection

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?

[Image: 555233.jpg]
10-25-2010 03:51 PM
Find all posts by this user
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #17
RE: Scripts Recollection

(10-25-2010 03:51 PM)Everlone Wrote:  How can i use more events?

Events are..?


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-25-2010 04:30 PM
Find all posts by this user
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #18
RE: Scripts Recollection

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.

[Image: 555233.jpg]
10-25-2010 04:35 PM
Find all posts by this user
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #19
RE: Scripts Recollection

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.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-25-2010 05:07 PM
Find all posts by this user
Everlone Offline
Member

Posts: 178
Joined: Oct 2010
Reputation: 2
Post: #20
RE: Scripts Recollection

sure, but how i do this??? i have ever a failure if i make another script.
can you show me a example?

[Image: 555233.jpg]
10-25-2010 05:11 PM
Find all posts by this user
Thread Closed 




User(s) browsing this thread: 2 Guest(s)