Sanshi
Junior Member
Posts: 14
Threads: 5
Joined: May 2012
Reputation:
0
|
It's 2:20 Am, and I am frustrated...
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 |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: It's 2:20 Am, and I am frustrated...
(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
“Life is a game, play it”
(This post was last modified: 07-03-2013, 01:34 AM by HumiliatioN.)
|
|
07-03-2013, 01:33 AM |
|
Sanshi
Junior Member
Posts: 14
Threads: 5
Joined: May 2012
Reputation:
0
|
RE: It's 2:20 Am, and I am frustrated...
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!
(This post was last modified: 07-03-2013, 02:19 AM by Sanshi.)
|
|
07-03-2013, 01:39 AM |
|
Pshyched
Member
Posts: 130
Threads: 21
Joined: Nov 2012
Reputation:
5
|
RE: It's 2:20 Am, and I am frustrated...
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, 05:32 AM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: It's 2:20 Am, and I am frustrated...
(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
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.
(This post was last modified: 07-03-2013, 10:57 AM by Adrianis.)
|
|
07-03-2013, 10:55 AM |
|
|