Frictional Games Forum (read-only)
[CHAOS] Help me please - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [CHAOS] Help me please (/thread-24945.html)



Help me please - iAmAw3some - 03-29-2014

Okay i will +rep on anyone who helped me because i have a problem at my editor:
I just want to ask something.

How can i put a text in the middle of the screen when i stepped on to the script area?


RE: Help me please - 7heDubz - 03-29-2014

Through scripting. These are the things that you will use.
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions - Look here for all of them.
https://www.youtube.com/playlist?list=PLD326789BC99530C8 - This covers alot of the basics to scripting (and some mapping stuff.

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both
--------------------------------------------------------------------
void SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
Displays a message on the screen.

asTextCategory - the category in the .lang file
asTextEntry - the entry in the .lang file
afTime - determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length.


Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Area", callsthis, false, 1);
}

void callsthis(string &in asParent, string &in asChild, int alState)
{
SetMessage("TextCategory", "TextEntry", 2.0f);
}



RE: Help me please - PutraenusAlivius - 03-29-2014

THERE YOU GO.

Spoiler below!

Put this in your HPS file and adjust them with your names on the Level Editor.

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaName""TextAppear"true1);
}

void TextAppear(string &in asParentstring &in asChildint alState)
{
SetMessage("MessagesEx""ScriptMsg"0);



Spoiler below!

Put this in your LANG file.

PHP Code:
<LANGUAGE>
  <
RESOURCES>
  </
RESOURCES>
  <
CATEGORY Name="CustomStoryMain">
    <
Entry Name="Description">INPUT STORY DESC HERE</Entry>
  </
CATEGORY>
  <
CATEGORY Name="MessagesEx">
    <
Entry Name="ScriptMsg">YOUR MESSAGE HERE.</Entry>
 </
CATEGORY


EDIT: Ninja'd Sad


RE: Help me please - 7heDubz - 03-29-2014

But you had the Lang part =P


RE: Help me please - iAmAw3some - 03-29-2014

(03-29-2014, 08:21 AM)WIWWM Wrote: Through scripting. These are the things that you will use.
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions - Look here for all of them.
https://www.youtube.com/playlist?list=PLD326789BC99530C8 - This covers alot of the basics to scripting (and some mapping stuff.

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both

void SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
Displays a message on the screen.

asTextCategory - the category in the .lang file
asTextEntry - the entry in the .lang file
afTime - determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length.

no it didn't worked, i want something like when i stepped on to that area, a message will appear on the middle of the screen like " This is my lantern "


RE: Help me please - 7heDubz - 03-29-2014

You wouldnt do it through the editor.

(03-29-2014, 08:23 AM)SomethingRidiculous Wrote: THERE YOU GO.

Spoiler below!

Put this in your HPS file and adjust them with your names on the Level Editor.

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaName""TextAppear"true1);
}

void TextAppear(string &in asParentstring &in asChildint alState)
{
SetMessage("MessagesEx""ScriptMsg"0);



Spoiler below!

Put this in your LANG file.

PHP Code:
<LANGUAGE>
  <
RESOURCES>
  </
RESOURCES>
  <
CATEGORY Name="CustomStoryMain">
    <
Entry Name="Description">INPUT STORY DESC HERE</Entry>
  </
CATEGORY>
  <
CATEGORY Name="MessagesEx">
    <
Entry Name="ScriptMsg">YOUR MESSAGE HERE.</Entry>
 </
CATEGORY


EDIT: Ninja'd Sad

Follow this.

Follow mine if your actually gonna learn scripting for yourself.


RE: Help me please - iAmAw3some - 03-29-2014

(03-29-2014, 08:23 AM)SomethingRidiculous Wrote: THERE YOU GO.

Spoiler below!

Put this in your HPS file and adjust them with your names on the Level Editor.

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaName""TextAppear"true1);
}

void TextAppear(string &in asParentstring &in asChildint alState)
{
SetMessage("MessagesEx""ScriptMsg"0);



Spoiler below!


Put this in your LANG file.

PHP Code:
<LANGUAGE>
  <
RESOURCES>
  </
RESOURCES>
  <
CATEGORY Name="CustomStoryMain">
    <
Entry Name="Description">INPUT STORY DESC HERE</Entry>
  </
CATEGORY>
  <
CATEGORY Name="MessagesEx">
    <
Entry Name="ScriptMsg">YOUR MESSAGE HERE.</Entry>
 </
CATEGORY


EDIT: Ninja'd Sad

Didn't worked either, am i doing something wrong?


RE: Help me please - 7heDubz - 03-29-2014

Got a skype mate?

I'll help you out


RE: Help me please - iAmAw3some - 03-29-2014

(03-29-2014, 08:39 AM)WIWWM Wrote: Got a skype mate?

I'll help you out

No, sorry.. But it works now, i just did something wrong..
Thanks for all your help..


RE: Help me please - 7heDubz - 03-29-2014

Anytime man best of luck to you. Post back in this thread if you need more help.