Nomad923
Junior Member
Posts: 46
Threads: 15
Joined: Dec 2011
Reputation:
2
|
Scripting issues
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 post was last modified: 12-23-2011, 03:33 AM by Nomad923.)
|
|
12-22-2011, 10:10 AM |
|
ferryadams10
Senior Member
Posts: 288
Threads: 40
Joined: Apr 2011
Reputation:
19
|
RE: Scripting issues
This'll do it.
Add me on skype or steam for more questions.
Skype: ferryadams10
Steam: ferryadams1
void OnStart() { AddEntityCollideCallback("Player", "Teleport", "Nightmare", true, 1); AddEntityCollideCallback("Player", "Grr", "Rawr", true, 1); } void Nightmare(string &in asParent, string &in asChild, int 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 asParent, string &in asChild, int alState) { PlaySoundAtEntity("insanity_monster_roar01", "insanity_monster_roar01.ogg", "player", 0, false); } void OnEnter() { }
void OnLeave() { }
Got a nice sofa
Please come and have a seat for a while
(This post was last modified: 12-22-2011, 10:40 AM by ferryadams10.)
|
|
12-22-2011, 10:39 AM |
|
Nomad923
Junior Member
Posts: 46
Threads: 15
Joined: Dec 2011
Reputation:
2
|
RE: Scripting issues
(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
void OnStart() { AddEntityCollideCallback("Player", "Teleport", "Nightmare", true, 1); AddEntityCollideCallback("Player", "Grr", "Rawr", true, 1); } void Nightmare(string &in asParent, string &in asChild, int 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 asParent, string &in asChild, int alState) { PlaySoundAtEntity("insanity_monster_roar01", "insanity_monster_roar01.ogg", "player", 0, false); } void OnEnter() { }
void OnLeave() { }
No it still just teleports, no sounds is made and the fading is not working.
|
|
12-22-2011, 10:45 AM |
|
Linus Ågren
Senior Member
Posts: 309
Threads: 58
Joined: Jan 2011
Reputation:
5
|
RE: Scripting issues
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.
Creator of The Dark Treasure.
|
|
12-22-2011, 01:57 PM |
|
DRedshot
Senior Member
Posts: 374
Threads: 23
Joined: Jun 2011
Reputation:
11
|
RE: Scripting issues
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
|
|
12-22-2011, 06:18 PM |
|
Nomad923
Junior Member
Posts: 46
Threads: 15
Joined: Dec 2011
Reputation:
2
|
RE: Scripting issues
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.
|
|
12-23-2011, 12:47 AM |
|
Nomad923
Junior Member
Posts: 46
Threads: 15
Joined: Dec 2011
Reputation:
2
|
RE: Scripting issues
Nevermind got it to work
|
|
12-23-2011, 03:33 AM |
|
|