Frictional Games Forum (read-only)

Full Version: Scripting issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);
}


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()
{



(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.

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.
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
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.
Nevermind got it to work