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

Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working AMFP Phone Box for Amnesia (download)
Author Message
Mudbill Offline
Posting Freak

Posts: 3,648
Joined: Apr 2013
Reputation: 169
Post: #1
Working AMFP Phone Box for Amnesia (download)

I can understand that people had issues porting this particular entity over to TDD, though it was quite fun to do I must admit. So here it is folks.

There are some things you need to know if you want to use this entity though.

  1. There are 2 entities you must place in your level, one being the phone box itself, and the other being the green light entity. The light must have the same internal name as the phone appended with _light. Remember to set the default state to "unlit".
  2. You must include the script below in each level you use the phone.

You could always script your own version of the phone, like if you need to tweak anything in the "internal" (so to speak) coding I did, feel free to do so, but for most applications, what I have should be perfectly fine.

You can download the entity here

Here's a vid btw.

Ok, on to the instructions:

First off, paste this script anywhere into your level's .hps file (for example at the very bottom). You're not required to read the script or know how it works, but it MUST be included if you wish to use the function below.

Spoiler below!
PHP Code: (Select All)
// PHONE SCRIPT       //
// Written by Mudbill //
void StartPhoneRinging (string &in asEntity
string[] &in asAudioFiles
string &in asSubCat
string[] &in asSubEntries
string &in asCallback) {
int i 0asAudioFiles.length(); i++)
int i 0asSubEntries.length(); i++)
void _PhoneRingLoop(string &in asTimer) {
PlayPropAnimation(GetLocalVarString("_PhoneEnt"), "hammer"0.0ffalse"");
PlaySoundAtEntity("ring""phone_ring"GetLocalVarString("_PhoneEnt"), 0.0ffalse);
void _PhoneStartCall(string &in asEntity) {
void _PhoneCall(string &in asProp) {    
int i 0GetLocalVarInt("_PhoneFilesTotal"); i++)
void _PhoneEndCall() {
PlayPropAnimation(GetLocalVarString("_PhoneEnt"), "switchoff"0.0ffalse"");
PlaySoundAtEntity("""phone_down"GetLocalVarString("_PhoneEnt"), 0.0ffalse);
AddTimer(GetLocalVarString("_PhoneEnt"), 0.0fGetLocalVarString("_PhoneCallback"));

Once you have that script, you can use this function to configure your phone box:

PHP Code: (Select All)
void StartPhoneRinging(string &in asEntitystring[] &in asAudioFilesstring &in asSubCatstring[] &in asSubEntries
string &in asCallback); 

Callback syntax: void MyFunc(string &in asEntity)

asEntity - The phone box entity.
asAudioFiles - An array containing a list of all the audio files you wish to play when the phone is picked up.
asSubCat - The .lang category for your subtitles.
asSubEntries - An array containing a list of all the subtitle entries to display. I recommend it has the same length as the audio files.
asCallback - A callback that is called when the entire phone sequence has finished.

If you're unsure how to use the arrays, create them like so:

PHP Code: (Select All)
string[] example_array = {"item1""item2""item3"}; 

Then you just give the function this example_array as an argument. Do this for both the audio files and subtitle entries.

Here's an example of how you can implement it.

Spoiler below!
PHP Code: (Select All)
void OnStart()
string[] files = {"brokenrec_basile_02.ogg""brokenrec_basile_04.ogg"};
string[] entries = {"Entry_1""Entry_2"};

void Finished(string &in asEntity) {

Oh, and as for installation, you place the "phone_box" folder within the downloaded archive inside your Amnesia/entities/custom/ folder (create a custom folder if you wish).
Remember to also keep a copy of the phone box within your mod's or custom story's directories when you export it.

If you use this, then credits would be nice.

(This post was last modified: 10-16-2016 12:51 PM by Mudbill.)
10-15-2016 03:13 PM
Find all posts by this user Quote this message in a reply
Post Reply 

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