Frictional Games Forum (read-only)

Full Version: It's 2:20 Am, and I am frustrated...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello people of the forums, I've been on the Wiki and tried my best in order to make something that sounds super easy, to turn out to be something to struggle 2 hours for... So what I am trying to do, is make a script that when I collide with a script area, a message appears on my screen.

Most of you will go like "That's easy, just do..." And so on. But please let me bring forth my un-holy script, that refuses to work even when I tried to sacrifice a baby to it.

THE ACTUAL SCRIPT!
_____________________________________________________________

void OnStart()
{
AddEntityCollideCallback("Player", "Awakening_1", "Wokeup", true, 1);
FadeOut(0.0f);
FadeIn(10.0f);
}

void Wokeup(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "WokenUp", 5.0f);
}
_____________________________________________________________

And now my English_Lang file... thingy.
_____________________________________________________________

<LANGUAGE>
<CATEGORY Name="Messages">
<Entry Name="WokenUp">Seems like it's a new day. Wonder what'll happen today.</Entry>
</CATEGORY>
</LANGUAGE>
_____________________________________________________________


Anyone see a problem here?
(07-03-2013, 01:21 AM)Sanshi Wrote: [ -> ]Hello people of the forums, I've been on the Wiki and tried my best in order to make something that sounds super easy, to turn out to be something to struggle 2 hours for... So what I am trying to do, is make a script that when I collide with a script area, a message appears on my screen.

Most of you will go like "That's easy, just do..." And so on. But please let me bring forth my un-holy script, that refuses to work even when I tried to sacrifice a baby to it.

THE ACTUAL SCRIPT!
_____________________________________________________________

void OnStart()
{
AddEntityCollideCallback("Player", "Awakening_1", "Wokeup", true, 1);
FadeOut(0.0f);
FadeIn(10.0f);
}

void Wokeup(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "WokenUp", 5.0f);
}
_____________________________________________________________

And now my English_Lang file... thingy.
_____________________________________________________________

<LANGUAGE>
<CATEGORY Name="Messages">
<Entry Name="WokenUp">Seems like it's a new day. Wonder what'll happen today.</Entry>
</CATEGORY>
</LANGUAGE>
_____________________________________________________________


Anyone see a problem here?

First of all I see you have FadeIn and FadeOut in same section so.. and you need Addtimer as well.

So try this:


void OnStart()
{
AddEntityCollideCallback("Player", "Awakening_1", "Wokeup", true, 1);
FadeOut(0);
}

void Wokeup(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "WokenUp", 5.0f);
AddTimer ("", 1, "StartIntro");
}

void StartIntro (string &in asTimer)
{
FadeIn (10);
}

Try that. If doesn't work PM me so I can solve this out Smile
Well sent you a PM, but the message still won't work, the fade in and fade out is no problem, I'd like that to stay the way it is.

It's Three'O Five, and I'm loosin my mind... help anyone?

I HAVE SOLVED THE PROBLEM, DON'T WORRY ANYMORE!
The message time is not a float. I tend to use 0. Then it just calculates thr length of time it appears on screen from the length of the string.

Also make sure youre not in development mode. The extra english lang file isnt read when in dev mode.
(07-03-2013, 01:33 AM)HumiliatioN Wrote: [ -> ]First of all I see you have FadeIn and FadeOut in same section so.. and you need Addtimer as well.

Don't do that Tongue

Having them in the same place is good, it means FadeOut(0) is called instantly making the screen black, then the next line FadeIn(10) means it will take 10 seconds to fade back in, the parameter being provided is already a measurement of time, so there's no need to add a Timer for it. That's the ideal way to have a fade in at the start of the map, though it looks like OP already knew that!

(07-03-2013, 05:32 AM)Pshyched Wrote: [ -> ]The message time is not a float.

Yes it is.

SetMessage(string& asTextCategory, string& asTextEntry, float afTime);

afTime - determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length.