Edit NOOOOOOOO I just typed all this!! Haha, glad you figured it out though.
(04-29-2011, 09:54 AM)NylePudding Wrote: Hello, I'm very new to modding and I want to do something rather basic. So could you possibly help me?
Basically I want to show a message 5 seconds after you start playing.
This is what I have so far:
void OnStart()
{
AddTimer("tut01", 5, "TimerTutorial01");
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i,
"tinderbox.ent");
}
}
void TimerTutorial01(string &in asTimer)
{
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
}
void OnEnter()
{
}
void OnLeave()
{
}
So what exactly do I have to put in the "SetMessage" function? For a simple example I want the message to say: "The Donkeys are going to get you!"
Like I said I am rather new to modding, so please have patience with me.
Hehe, I was JUST working on this too and I finally got it! Basically, inside the function for the message, you don't write a message. You write the name of the message you want to appear. And those messages are in your extra_english.lang file.
So, go to your custom story's .lang file. You probably have a category and entry name for your description. Like this:
Well, you need to add another category in here for your messages. I would just do it like this:
So you see in the category of messages, you can create lots of entries. Ok back to your function. Inside of SetMessage(string& asTextCategory, string& asTextEntry, float afTime) you have to change some stuff.
The first part is the category in your .lang file for messages, and the second part is the name of the entry in that category. The last part is just how long you want the message to display. So using the silly messages I made, my code would read
SetMessage("Messages", "Message1", 5.0f);
And so it would display "This is a cool message bro!" for 5 seconds.
Hope that makes sense! Woot woot! I actually helped someone!