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
Triggering Sounds & Sanity Damage?
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#1
Triggering Sounds & Sanity Damage?

So I'm progressing on my map well, but I want the player to walk through an archway, (not a door) and have it trigger a brute sound as well as give Daniel some sanity damage with effects.(screen stretch and boom noise) By the way, I don't want a monster to come out, I just want the player to hear the noise and get scared. (A monster hasn't been placed anywhere on my map.) I have been trying for a while now, fixing errors and such. The best I get is, when starting the map, the brute noise plays although I've put it in the archway and NOT in the player start area. -.- I put a script box there too. I also can't get my key to work on the other door. wtf.. here's my entire script. Fix any errors, please?

void onstart()
{
AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}

void onenter()
{
AddEntityCollideCallback("Player", "monsterscare1", "CollideAreaTest01", true, 1);

}

void CollideAreaTest01(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "enabled.snt", "wall_door_way02_3", 6.0f, false);
GiveSanityDamage(30, true);
}

**(key_1 is the name I named my key. mansion_1 is the name of the door I want to use the key on. monsterscare1 is the name of the script area I put along with the sound. wall_door_way02_3 is the name of the archway I want to use as an entity to trigger the sound.)**
I can tell something isn't right.. anyone help me out here? Thanks.

P.S. Anyone know how to make a text thing appear when the player looks at something? Like, the player looks at a broken window and a message says on the screen: "I wonder what happened here.." kind of like thoughts?

P.S.S. Anyone know how to work the level doors too? Lol, I'm a newbie. I know you just make a new map and put the name of it under the door's entity tab where it says new map. Just don't know how to have the TextEntry appear..

Ba-da bing, ba-da boom.
(This post was last modified: 06-23-2011, 10:56 PM by JenniferOrange.)
06-23-2011, 10:46 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Triggering Sounds & Sanity Damage?

In my experience, scripting for Amnesia is very case sensitive. Turn onenter() into OnEnter() and onstart() to OnStart(). Also, your callback in the use-item function is UsedKeyOnDoor, while the function that does all the good stuff is called MyFunc. Make them match.

@ P.S. - Use SetMessage(textCat, textEntry, floatTime); You'll have to create your own category and entry in the lang file. Personally I use a category named General and label each entry according to which zone it occurs in, and what it pertains to.

@ P.S.S. - For the text entry, put something like MyLevelDoor. Then in your .lang file create a category named LevelDoors, if you haven't already. Name your entry simply: MyLevelDoor. Done!

(This post was last modified: 06-23-2011, 11:47 PM by palistov.)
06-23-2011, 11:44 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#3
RE: Triggering Sounds & Sanity Damage?

Very, very helpful. xD Thank you so much!
@P.S.: I'm not getting this too well. Example, please?
@P.S.S.: Another example? xD
Noob, apologies. :3

Ba-da bing, ba-da boom.
06-24-2011, 12:16 AM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#4
RE: Triggering Sounds & Sanity Damage?

Most, if not all, programming is extremely sensitive. One error might mess up your entire script, even if it's a simple case error. So always be sure to check for that when you debug. It's a good habit to always use the same formatting as with the game for your custom functions. ThisFunctionDoesStuff as opposed to thisfunctiondoesstuff for example. Alternatively, use underscores. Never spaces. Just some general scripting information for you Smile
06-24-2011, 12:17 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#5
RE: Triggering Sounds & Sanity Damage?

P.S. - In your lang file, put this new category in

<CATEGORY Name="General">
<Entry Name="ScreenMessage01">Screen Message 1</Entry>
</CATEGORY>

Change the entry name and text to whatever you want. In your SetMessage function, put "General" as the category and "ScreenMessage01" (or whatever you changed it to) as the entry. The float value is the time in seconds that the text will persist for.


P.S.S - Your lang file needs this:

<CATEGORY Name="LevelDoors">
<Entry Name="DoorName01">Door 1</Entry>
</CATEGORY>

Change the entry name and text to whatever you like. In the LevelEditor, select the door, go to the Entity tab and make sure you put DoorName01 (or whatever you changed it to) in the TextEntry field.

06-24-2011, 07:48 AM
Find




Users browsing this thread: 1 Guest(s)