Frictional Games Forum (read-only)
Nublette Requires Assistance with Scripting and Puzzles - 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: Nublette Requires Assistance with Scripting and Puzzles (/thread-19800.html)

Pages: 1 2 3


Nublette Requires Assistance with Scripting and Puzzles - CarnivorousJelly - 01-04-2013

Hopefully I'll get a little bit better at this so I won't have to continue bothering the forum with my questions.

I've set up a box (SafeBox_0) to trigger music when it collides with the area in front of a door (Area_Safe). That's working with this code:
Code:
void OnStart()
{
AddEntityCollideCallback("SafeBox_0", "Area_Safe", "Script_Safe", true, 1);
}

void Intro ()
{

}

void OnEnter ()
{

}

void Script_Safe (string &in asParent, string&in asChild, int alState)
{
    PlayMusic("09_amb_safe", true, 1, 6, 0, true);
}
Only problem is that I need the player to remove the box later and go back into the first room to retrieve a key from a different map (forcing them to leave the safe area, muahaha). The box won't move; I can't touch it or push it in game. That's a little bit problematic...

I'm not quite sure what I need to change. Any suggestions would be much appreciated for this

Oh, and also how do I stop the music once the box is out of the area? It's not stopping when I reload the map.

Edit: I'm putting all my questions here now to avoid spamming the forum Smile


RE: Unable to interact with entity in script area - NaxEla - 01-04-2013

Are you able to interact with the box before it moves into the area for the first time? Which entity is SafeBox_0?

Also, this code should work for stopping the music when SafeBox_0 leaves Area_Safe:

PHP Code:
void OnStart()
{    
    
AddEntityCollideCallback("SafeBox_0""Area_Safe""Script_Safe"false1);
    
AddEntityCollideCallback("SafeBox_0""Area_Safe""Script_Safe"false, -1);
}

void Intro ()
{

}

void OnEnter ()
{

}

void Script_Safe (string &in asParentstring&in asChildint alState)
{    
    if(
alState == 1) {
        
PlayMusic("09_amb_safe"true167false);
    }
    else if(
alState == -1) {
        
StopMusic(37);    
    }




RE: Unable to interact with entity in script area - FlawlessHappiness - 01-04-2013

Instead of having 2 "AddEntityCollide", then just put 0 instead of 1 and -1.
0 = Triggers both when the object collides and leaves the area:

Code:
AddEntityCollideCallback("SafeBox_0", "Area_Safe", "Script_Safe", false, 0);

The "Box-Wont-Move" sounds like it's stuck in another entity, or a static object. What box is it? The big movable one which you cannot lift, but only push?


RE: Unable to interact with entity in script area - CarnivorousJelly - 01-04-2013

(01-04-2013, 09:35 AM)beecake Wrote: The "Box-Wont-Move" sounds like it's stuck in another entity, or a static object. What box is it? The big movable one which you cannot lift, but only push?

SafeBox_0 is the large movable one.
I can push it if I reduce the size of the area (having the ends stick out), but can't interact with the section in the area or anything that's completely in the area (another box, tinderboxes, potions, etc) because the hand/interaction icon doesn't show up.

Edit: Can't interact with the door behind the box either. If there isn't something I can change about the area, I might just make it super tiny and on the floor.

Code works to stop the music though, thanks!


RE: The Nublette Needs Help With Everything - CarnivorousJelly - 01-05-2013

I'm getting better at scripting... I think. But there is one thing that's still really troubling me:
This extra_english.lang file that keeps being referenced in all the tutorials, is there a tutorial on how to create one and where to place it? I have one started:
Code:
<LANGUAGE>
  <RESOURCES>
    <Directory Path="fonts/eng" />
    <Directory Path="lang/eng" />
  <CATEGORY Name="Inventory">
    <Entry Name="LibraryKey">Spare Library Key</Entry>
    <Entry Name="ItemDesc_LibraryKey">Lillian's secret key for the library.</Entry>
  </CATEGORY>
//// It continues for a while with several more categories ////
</RESOURCES>
</LANGUAGE>
Problem is, I'm not sure where to put it (in with the english.lang file?) or how to ensure my cs references this file instead of the one from the original game.

Oh, and while I'm asking questions,
Code:
void FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);
what does "bool" mean and what does it do?


RE: The Nublette Needs Help With Everything - NaxEla - 01-05-2013

(01-05-2013, 05:06 AM)Kiandra Wrote: I'm getting better at scripting... I think. But there is one thing that's still really troubling me:
This extra_english.lang file that keeps being referenced in all the tutorials, is there a tutorial on how to create one and where to place it? I have one started:
Code:
<LANGUAGE>
  <RESOURCES>
    <Directory Path="fonts/eng" />
    <Directory Path="lang/eng" />
  <CATEGORY Name="Inventory">
    <Entry Name="LibraryKey">Spare Library Key</Entry>
    <Entry Name="ItemDesc_LibraryKey">Lillian's secret key for the library.</Entry>
  </CATEGORY>
//// It continues for a while with several more categories ////
</RESOURCES>
</LANGUAGE>
Problem is, I'm not sure where to put it (in with the english.lang file?) or how to ensure my cs references this file instead of the one from the original game.

Oh, and while I'm asking questions,
Code:
void FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);
what does "bool" mean and what does it do?

Here's a tutorial from the wiki about .lang files: http://wiki.frictionalgames.com/hpl2/amnesia/custom_story

Concerning you're second question, 'bool' (or it's full name 'boolean') is a data type in C++ that can take one of two values: true or false.


RE: The Nublette Needs Help With Everything - CarnivorousJelly - 01-06-2013

(01-05-2013, 07:05 AM)NaxEla Wrote: Here's a tutorial from the wiki about .lang files: http://wiki.frictionalgames.com/hpl2/amnesia/custom_story

Concerning you're second question, 'bool' (or it's full name 'boolean') is a data type in C++ that can take one of two values: true or false.
So I should replace 'bool' with true/false depending on what I want to happen; makes sense. Unless I'm wrong, in which case I'm absolutely screwed over.

I searched the wiki and forum for .LANG tutorials, couldn't find the answer to my question: Where does my extra_english.lang file go? Should I save it in redist\config\lang_main?


RE: The Nublette Needs Help With Everything - Your Computer - 01-06-2013

It goes in your custom story's folder, where custom_story_settings.cfg is.


RE: The Nublette Needs Help With Everything - CarnivorousJelly - 01-06-2013

Ohhh, I feel rather derp-ish now. Thanks for the help! Smile


RE: The Nublette Needs Help With Everything - CarnivorousJelly - 01-08-2013

I seem to only post here when I have questions...
Uhm I'm creating a library (I think it has potential) and it requires multiple floors (seven of them) to put in everything I want to for the puzzle. I'm running into some problems with making the floors look like, well, floors and aligning everything in a way that doesn't make it look like I created the floors with my eyes closed.

This is what I currently have:
Spoiler below!

[Image: library_woes_by_rueppells_fox-d5qsoz9.jpg]

The walls look really odd like this, and I'm not quite sure what to do about it. Is there an example of 3 or more floors in a CS or in Amnesia which I could take a look at to figure this out?

The reason I'm not just dealing with it and continuing up is because each new segment is causing the ceiling height to become increasingly lower...