Frictional Games Forum (read-only)
[SCRIPT] Problem with timing script... - 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] Problem with timing script... (/thread-12500.html)

Pages: 1 2


Problem with timing script... - MissMarilynn - 01-10-2012

void OnStart()


{
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}




It says there is a unexpected "{" Somewhere but it all looks fine to me...suggestions?


RE: Problem with timing script... - flamez3 - 01-10-2012

You need to Opening and closing brackets in void Onstart()

So like this:

void OnStart()
{


}


RE: Problem with timing script... - MissMarilynn - 01-10-2012

(01-10-2012, 01:04 AM)flamez3 Wrote: You need to Opening and closing brackets in void Onstart()

So like this:

void OnStart()
{


}
Still having problems. :/


void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);
}

{
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}


RE: Problem with timing script... - flamez3 - 01-10-2012

Quote:void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);

//TIMER
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}

I fixed it for I think (I can't test it now) You can't have a dangling block hanging somewhere.
{
FadeOut(0);
AddTimer("", 4, "intro1");
}

Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.


RE: Problem with timing script... - Statyk - 01-10-2012

(01-10-2012, 02:25 AM)flamez3 Wrote:
Quote:void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);

//TIMER
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}

I fixed it for I think (I can't test it now) You can't have a dangling block hanging somewhere.
{
FadeOut(0);
AddTimer("", 4, "intro1");
}

Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.
Don't apply the bolded area. that was a mistake flamez3 made =\




RE: Problem with timing script... - flamez3 - 01-10-2012

(01-10-2012, 03:18 AM)Statyk Wrote:
(01-10-2012, 02:25 AM)flamez3 Wrote:
Quote:void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);

//TIMER
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}

I fixed it for I think (I can't test it now) You can't have a dangling block hanging somewhere.
{
FadeOut(0);
AddTimer("", 4, "intro1");
}

Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.
Don't apply the bolded area. that was a mistake flamez3 made =\
Ahhh sorry, didn't mean to apply that to the quote. I placed it in the correct place already and didn't look to see what I had quoted -.-. Sorry : D




RE: Problem with timing script... - MissMarilynn - 01-10-2012

(01-10-2012, 03:28 AM)flamez3 Wrote:
(01-10-2012, 03:18 AM)Statyk Wrote:
(01-10-2012, 02:25 AM)flamez3 Wrote:
Quote:void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);

//TIMER
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}

I fixed it for I think (I can't test it now) You can't have a dangling block hanging somewhere.
{
FadeOut(0);
AddTimer("", 4, "intro1");
}

Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.
Don't apply the bolded area. that was a mistake flamez3 made =\
Ahhh sorry, didn't mean to apply that to the quote. I placed it in the correct place already and didn't look to see what I had quoted -.-. Sorry : D
It works!

One more question: The sound for my map comes up right away. How can I make music during the fade out time that disappears when the map loads and the map music starts after?


RE: Problem with timing script... - flamez3 - 01-10-2012

(01-10-2012, 04:18 AM)MissMarilynn Wrote:
(01-10-2012, 03:28 AM)flamez3 Wrote:
(01-10-2012, 03:18 AM)Statyk Wrote:
(01-10-2012, 02:25 AM)flamez3 Wrote:
Quote:void OnStart()
{
///AREAS

AddEntityCollideCallback("Player", "monsterspawn", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "clockbong", "ClockScare", true, 1);
AddEntityCollideCallback("Player", "basementarea", "BasementLevel", true, 1);

///MESSAGES

SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor", "IsItLocked3", true);
SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor", "IsItLocked4", true);
SetEntityPlayerInteractCallback("ra_office", "IsItLocked5", true);
AddEntityCollideCallback("Player", "thirdfloorstairs", "ThirdStairs", true, 1);

///USE ITEMS

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "UnlockDoor", true);

///MONSTER SPAWN

SetEntityPlayerInteractCallback("girl_key", "SpawnMonster", true);

//TIMER
FadeOut(0);
AddTimer("", 4, "intro1");
}

void intro1(string &in asTimer)
{
SetMessage("Intro", "Beginning", 5);
AddTimer("", 6, "intro2");
}

void intro2(string &in asTimer)
{
SetMessage("Intro", "Beginning2", 5);
AddTimer("", 6, "intro4");
}

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

void intro3(string &in asTimer)
{
FadeIn(2);
}

I fixed it for I think (I can't test it now) You can't have a dangling block hanging somewhere.
{
FadeOut(0);
AddTimer("", 4, "intro1");
}

Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.
Don't apply the bolded area. that was a mistake flamez3 made =\
Ahhh sorry, didn't mean to apply that to the quote. I placed it in the correct place already and didn't look to see what I had quoted -.-. Sorry : D
It works!

One more question: The sound for my map comes up right away. How can I make music during the fade out time that disappears when the map loads and the map music starts after?
In
void intro3(string &in asTimer) , add

PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc

Taken from
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Also, you don't have playmusic in your script; did you place the music in the level editor? If so; delete that and add what I said before.



RE: Problem with timing script... - MissMarilynn - 01-10-2012

(01-10-2012, 04:22 AM)flamez3 Wrote:
(01-10-2012, 04:18 AM)MissMarilynn Wrote:
(01-10-2012, 03:28 AM)flamez3 Wrote:
(01-10-2012, 03:18 AM)Statyk Wrote:
(01-10-2012, 02:25 AM)flamez3 Wrote: Take that for example. You have no function name or syntax. That would go in void OnStart() since you want that to happen when the game starts.
Don't apply the bolded area. that was a mistake flamez3 made =\
Ahhh sorry, didn't mean to apply that to the quote. I placed it in the correct place already and didn't look to see what I had quoted -.-. Sorry : D
It works!

One more question: The sound for my map comes up right away. How can I make music during the fade out time that disappears when the map loads and the map music starts after?
In
void intro3(string &in asTimer) , add

PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc

Taken from
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Also, you don't have playmusic in your script; did you place the music in the level editor? If so; delete that and add what I said before.
Well I have:

void OnEnter()

{
PlayMusic("01_amb_darkness.ogg", true,1.0f, 2.0f, 0, true);
}

but I don't want that to play during the text. I want 02_amb_safe.ogg to play and fade after the text THEN have the map music show up. Is that a bit more complicated?


RE: Problem with timing script... - flamez3 - 01-10-2012

Replace 01_amb_darkness.ogg to 02_amb_safe.ogg.

Now go to

void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
}

And Add StopMusic(float afFadeTime, int alPrio);

It would look like this:

Quote:void intro4(string &in asTimer)
{
SetMessage("Intro", "Beginning3", 5);
AddTimer("", 6, "intro3");
StopMusic(6.0f, 1);
}
And at

void intro3(string &in asTimer)
{
FadeIn(2);
}

Add PlayMusic("01_amb_darkness.ogg", true,1.0f, 2.0f, 0, true);

It would look like this:

Quote:void intro3(string &in asTimer)
{
FadeIn(2);
PlayMusic("01_amb_darkness.ogg", true,1.0f, 2.0f, 0, true);
}