Frictional Games Forum (read-only)
[SCRIPT] Hi, its me again ;d - 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] Hi, its me again ;d (/thread-30136.html)

Pages: 1 2 3


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

(06-21-2015, 01:30 PM)FlawlessHappiness Wrote: Please, every time you've done something and it doesn't work, update your script in your next post so that we can see if you made any errors.

Oh, sorry, didnt knew I had to do this ;d
Here is the script:
Spoiler below!
PHP Code:
//Everything with "//" at the start of the text and at the end is just a comment.//
//Everything starting with "//" only, may not be needed in the script.//

//When game starts for first time (e.g. mostly used in full conversion modes)//
//void OnGameStart()
//{
//    
//;}

//On start of a map for first time.//
void OnStart()
{
    
TeleportPlayer("PlayerStartArea_1");
    
AddEntityCollideCallback("Player""Quest1""Tired"true1);
    
AddEntityCollideCallback("Player""Scare""PlayerScare"true1);
    
AddEntityCollideCallback("Player""StartLookAt""StartLookAt"true1);
    
AddEntityCollideCallback("Player""ForcedLookAt""ForcedLookAtStop"true1);
    
AddEntityCollideCallback("Player""Quest1Done""TiredDone"true1);
    
SetEntityPlayerLookAtCallback("Tim""Tim", (false));
    
AddUseItemCallback("""MysteriousKey""AwaysLockedDoor""AwaysLockedUnlock"true);
;}

//ExtraScripts for OnStart//

//AddEntityCollideCallback Scripts//
void PlayerScare(string &in asParentstring &in asChildstring &in alState)
{
    
SetSwingDoorClosed("AwaysLockedDoor"truetrue);
    
AddTimer("Lock"2.0f"LockDoor");
;}

void LockDoor(string &in asTimer)
{
    
SetSwingDoorLocked("AwaysLockedDoor"truetrue);
    
PlaySoundAtEntity("""lock_door.snt""Player"0.0ffalse);
    
SetEntityActive("JumpScare"true);
    
ShowEnemyPlayerPosition("JumpScare");
;}

void Tired(string &in asParentstring &in asChildint alState)
{
    
AddQuest("Tired""Tired");
;}

void StartLookAt(string &in asParentstring &in asChildint alState)
{
    
StartPlayerLookAt("ForcedLookAt"2.0f4.0f"");
;}

void ForcedLookAtStop(string &in asParentstring &in asChildint alState)
{
    
StopPlayerLookAt();
;}

void TiredDone(string &in asParentstring &in asChildint alState)
{
    
StopPlayerLookAt();
    
CompleteQuest("Tired""Tired");
    
AddTimer("FadeOutTimer"0.5f"FadeOutFunc");
    
;}

void FadeOutFunc(string &in asTimer)
{
    
FadeOut(2.0f);
    
AddTimer("FadeInTimer"2.5f"FadeInFunc");
;}

void FadeInFunc(string &in asTimer)
{
    
PlaySoundAtEntity("PlayerScare""BruteEnabled.snt""Player", (5.0), (false));
    
FadeIn(4.0f);
    
SetEntityActive("MysteriousKey", (true));
    
AddTimer("SoundQuest"5.0f"SoundQuest");
;}

void SoundQuest(string &in asTimer)
{
    
AddQuest("SoundQuest""SoundQuest");
;}
//AddUseItemCallback Scripts//
void AwaysLockedUnlock(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AwaysLockedDoor", (false), (true));
    
PlaySoundAtEntity("""unlock_door""Player"0false);
    
RemoveItem("MysteriousKey");
;}

void AwaysLockedMessage(string &in asEntitystring &in type)
{
    
SetMessage("Messages""MysteriousKey"0.0f);
;}

//SetEntityPlayerLookAtCallback Scripts//
void Tim(string &in asEntityint alState)
{
    
SetMessage("Messages""Tim"0.3f);
;}

//On enter of the map (e.g using a map multiple times).//
void OnEnter()
{
    
;}

//On leaving the map.//
void OnLeave()
{
    
;}

//EXTRA SCRIPTS (Functions, codes and etc.)// 




RE: Hi, its me again ;d - DnALANGE - 06-21-2015

Remove all the smiley ;}

Replace all of them just with the }
And then try again.


RE: Hi, its me again ;d - Mudbill - 06-21-2015

The smileys shouldn't do anything. It's preferred to not have it just for the fact that it's odd practise and redundant, but it shouldn't cause any issues.

You can have several semi-colons after a function, like MyFunc();;;. That's basically what's going on here, it's just on a new line.

MyFunc();;;
;;;


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

Actually I get an error that its expecting a semi colon before the "}"..


RE: Hi, its me again ;d - FlawlessHappiness - 06-21-2015

(06-21-2015, 06:55 PM)NotASkrub Wrote: Actually I get an error that its expecting a semi colon before the "}"..

That is not true.

It may say that it expected it there. But that's because it's the LAST place it would expect it. Not necessarily the right place.

You could write:

PHP Code:
void function(string &in asEntity)
{
SetEntityActive("Thing"true)




It would now say it expected a ; behind the }. But that's not the right place. It may expect it there, but the actual way is to place ; after ).

PHP Code:
void function(string &in asEntity)
{
SetEntityActive("Thing"true);


I also found 2 mistakes:

PHP Code:
SetEntityPlayerLookAtCallback("Tim""Tim", (false)); 
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);

PHP Code:
PlaySoundAtEntity("PlayerScare""BruteEnabled.snt""Player", (5.0), (false)); 
Here you did the same thing, but with a number instead.


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

(06-21-2015, 07:21 PM)FlawlessHappiness Wrote:
PHP Code:
SetEntityPlayerLookAtCallback("Tim""Tim", (false)); 
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);

PHP Code:
PlaySoundAtEntity("PlayerScare""BruteEnabled.snt""Player", (5.0), (false)); 
Here you did the same thing, but with a number instead.
What if I told you, it tells me to do so.. and believe it or not, it expects a semi colon before the "}"..

EDIT: Never mind that.. I removed the semi colons for now, it seems to work.. but lets move to the problem I have..


RE: Hi, its me again ;d - Catalyst - 06-21-2015

what's the problem, maybe you'll show a script content again? I don't know what is the problem actualy.


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

(06-21-2015, 08:53 PM)Catalyst Wrote: what's the problem, maybe you'll show a script content again? I don't know what is the problem actualy.

Its not "actualy" it is "actually" Big Grin
The problem was listed above.. My mistake was that you know this code
PHP Code:
void AddEntityCollideCallback(stringasParentNamestringasChildNamestringasFunctionbool abDeleteOnCollideint alStates); 
And then below it theres the callback (e.g. when the certain entity enters the certain area it calls a certain function) A.K.A. This >
PHP Code:
void MyFunc(string &in asParentstring &in asChildint alState
< code..
So my dumb mistake was, that I used at the end "string &in alState" (instead of "int alState") and we know that numbers are not considered as text in the scripting...
Anyway, I fixed my mistake, fixed my error and for now it seems that everything works..
If I get further errors/mistakes or problems I will post here, in this topic!
Thank you again for the help ;d