Frictional Games Forum (read-only)
Scripting issues - 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: Scripting issues (/thread-12008.html)



Scripting issues - Nomad923 - 12-22-2011

Ok so i got this script for this scene in a room, whats its supposed to do is when you walk to a script area the screen goes black and sound plays but while its doing that it teleports you to another room and then the screen goes to normal. But here is the problem the only thing that works atm is teleporting the player, the sound wont play and the fadein and fadeout is not working. Below is what i have right now, ive been working with it for a bit and i tried putting them all together instead of in different sections like it is now but that causes a error with the fades. Not to sure what to do.



void OnStart()
{
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Teleport", "Nightmare", true, 1);
AddEntityCollideCallback("Player", "Grr", "Rawr", true, 1);
}

void OnLeave()
{
}

void Nightmare(string &inasParent, string &in asChild, int alState)
{
AddTimer("", 0, "Rawr");
AddTimer("", 0, "Fadeout");
TeleportPlayer("PlayerStartArea_2");
AddTimer("", 4.0, "Fadein");
}

void Fadein(float afTime)
{
Fadein(2);
}

void Fadeout(float afTime)
{
Fadeout(0);
}

void Rawr(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound)
{
PlaySoundAtEntity("insanity_monster_roar01", "insanity_monster_roar01.ogg", "player", 0, false);
}


RE: Scripting issues - ferryadams10 - 12-22-2011



This'll do it.

Add me on skype or steam for more questions.

Skype: ferryadams10

Steam: ferryadams1

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""Teleport""Nightmare"true1);
AddEntityCollideCallback("Player""Grr""Rawr"true1);

void Nightmare(string &in asParentstring &in asChildint alState)
{
AddTimer(""0"Fadeout");
TeleportPlayer("PlayerStartArea_2");
AddTimer(""4.0"Fadein");
}

void Fadein(float afTime)
{
Fadein(2);
}

void Fadeout(float afTime)
{
Fadeout(0);
}

void Rawr(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("insanity_monster_roar01""insanity_monster_roar01.ogg""player"0false);

void OnEnter()
{
}

void OnLeave()
{






RE: Scripting issues - Nomad923 - 12-22-2011

(12-22-2011, 10:39 AM)ferryadams10 Wrote: This'll do it.

Add me on skype or steam for more questions.

Skype: ferryadams10

Steam: ferryadams1

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""Teleport""Nightmare"true1);
AddEntityCollideCallback("Player""Grr""Rawr"true1);

void Nightmare(string &in asParentstring &in asChildint alState)
{
AddTimer(""0"Fadeout");
TeleportPlayer("PlayerStartArea_2");
AddTimer(""4.0"Fadein");
}

void Fadein(float afTime)
{
Fadein(2);
}

void Fadeout(float afTime)
{
Fadeout(0);
}

void Rawr(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("insanity_monster_roar01""insanity_monster_roar01.ogg""player"0false);

void OnEnter()
{
}

void OnLeave()
{

No it still just teleports, no sounds is made and the fading is not working.




RE: Scripting issues - Linus Ă…gren - 12-22-2011

Change the (float afTime) to (string &in asTimer)
I also think that the timer needs some kind of value. Change 0 to 0.01f or something.


RE: Scripting issues - DRedshot - 12-22-2011

Also, "player" should be "Player" that will be why no sound plays, because it is trying to play a sound at an entity that doesn't exist! junkfood's post will fix your fadein problem Smile



RE: Scripting issues - Nomad923 - 12-23-2011

Ok ill give it a try.....I get an error saying No matching signatures to 'Fadein...... wait a minute *Changes Fadein to FadeIn, and Fadeout to FadeOut* let me try again...... Everything works now except the sound, let me try one thing and see how it goes......Nope the sound still does not play.


RE: Scripting issues - Nomad923 - 12-23-2011

Nevermind got it to work