Frictional Games Forum (read-only)
Script help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script help (/thread-21639.html)

Pages: 1 2


RE: Script help - tezpull666 - 05-28-2013

(05-27-2013, 07:15 PM)Kullin Wrote: The error is in line 19, And 37 the first letter of the word with a error so yea your right bridge,

But it says that it can't find the door, so make sure the door name is right. AND PRESS ENTER WHEN YOU ENTER A NAME IN THE LEVEL EDITITOR'!! Haha just so you see that!

And post the whole script, because a script. with 11 lines cant give a error on line 19. So give the whole script..

Whait a second, I just realised that on line 19 it gives a error because it says "door" in the script, do you understand what I mean? ( I know your from Germany)
I am from the netherlands. I still didn't understand that. Can you send the code to me??


RE: Script help - Bridge - 05-28-2013

What are you talking about? You're supposed to have the code. Where is the rest of it?


RE: Script help - Adrianis - 05-28-2013

You won't ever receive an error if you provide the wrong name for an entity in your map - it just won't work

The problem is on this line...

Code:
PlayGuiSound("unlock_door.snt", door, 0, false);

You use the name 'door' as though it is a variable - that is why it is complaining that door has not been declared, it's expecting a variable called door, and there isn't one

Regardless, that function call is incorrect

Code:
void PlayGuiSound(string& asSoundFile, float afVolume);

Plays a sound, not using 3D.
asSoundFile - the sound to play (extension is .snt)
afVolume - the volume of the sound

It looks like you want to use the PlaySoundAtEntity function, not PlayGuiSound, and provide either the name of a valid variable, in this case asEntity being the door that the key is used on, or you can use the literal name of the door "level_wood_1"

Code:
void FUNCTION(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("level_wood_1", false);
    PlaySoundAtEntity("unlock_door.snt", asEntity, 0, false);
    RemoveItem("key_tomb_rusty_1");
}



RE: Script help - tezpull666 - 05-28-2013

(05-28-2013, 05:33 PM)Adrianis Wrote: You won't ever receive an error if you provide the wrong name for an entity in your map - it just won't work

The problem is on this line...

Code:
PlayGuiSound("unlock_door.snt", door, 0, false);

You use the name 'door' as though it is a variable - that is why it is complaining that door has not been declared, it's expecting a variable called door, and there isn't one

Regardless, that function call is incorrect

Code:
void PlayGuiSound(string& asSoundFile, float afVolume);

Plays a sound, not using 3D.
asSoundFile - the sound to play (extension is .snt)
afVolume - the volume of the sound

It looks like you want to use the PlaySoundAtEntity function, not PlayGuiSound, and provide either the name of a valid variable, in this case asEntity being the door that the key is used on, or you can use the literal name of the door "level_wood_1"

Code:
void FUNCTION(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("level_wood_1", false);
    PlaySoundAtEntity("unlock_door.snt", asEntity, 0, false);
    RemoveItem("key_tomb_rusty_1");
}
It now say this:

[Image: c1lhwS9]

Are you guys just playing a trick on me!?> Angry


RE: Script help - amnesiaplayer321 - 05-28-2013

Derp.


RE: Script help - Adrianis - 05-28-2013

Oh my bad, there's an extra parameter missing

Change the line so it reads

Code:
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);

It might be worth noting, for your benefit, that when people are trying to help you they are not trying to trick you, and getting angry at them is not going to make them want to help you more. We all make mistakes


RE: Script help - tezpull666 - 05-28-2013

(05-28-2013, 06:06 PM)Adrianis Wrote: Oh my bad, there's an extra parameter missing

Change the line so it reads

Code:
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);

It might be worth noting, for your benefit, that when people are trying to help you they are not trying to trick you, and getting angry at them is not going to make them want to help you more. We all make mistakes
THANKS IT WORKED!!!!!!!!!!!!


RE: Script help - OriginalUsername - 05-28-2013

(05-28-2013, 06:00 PM)amnesiaplayer321 Wrote: how about posting your map file and hps file so people can fix this easily?

You don't need that. Just the full script is enough.


RE: Script help - Bridge - 05-28-2013

Mike1265: I suggest that you, and this is a friendly suggestion, read a beginner's programming book or at least a guide on the internet. It's clear you do not understand any of the concepts at play here which is why you do not understand when people are trying to help you.

http://www.cprogramming.com/tutorial/lesson1.html

This one is good, very solid but a bit difficult to understand if you are completely clueless. There are plenty of beginner guides online, you can look for ones with easy language so that you completely understand everything.