Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nublette Requires Assistance with Scripting and Puzzles
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#1
Smile  Nublette Requires Assistance with Scripting and Puzzles

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:
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

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 01-14-2013, 06:34 AM by CarnivorousJelly.)
01-04-2013, 07:42 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: Unable to interact with entity in script area

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: (Select All)
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);    
    }


In Ruins [WIP]
(This post was last modified: 01-04-2013, 08:49 AM by NaxEla.)
01-04-2013, 08:43 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Unable to interact with entity in script area

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:

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?

Trying is the first step to success.
(This post was last modified: 01-04-2013, 09:36 AM by FlawlessHappiness.)
01-04-2013, 09:35 AM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#4
RE: Unable to interact with entity in script area

(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!

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 01-04-2013, 10:42 PM by CarnivorousJelly.)
01-04-2013, 07:50 PM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#5
RE: The Nublette Needs Help With Everything

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:
<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,
void FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);
what does "bool" mean and what does it do?

[Image: quote_by_rueppells_fox-d9ciupp.png]
01-05-2013, 05:06 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#6
RE: The Nublette Needs Help With Everything

(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:
<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,
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/amn...stom_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.

In Ruins [WIP]
(This post was last modified: 01-05-2013, 07:07 AM by NaxEla.)
01-05-2013, 07:05 AM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#7
RE: The Nublette Needs Help With Everything

(01-05-2013, 07:05 AM)NaxEla Wrote: Here's a tutorial from the wiki about .lang files: http://wiki.frictionalgames.com/hpl2/amn...stom_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?

[Image: quote_by_rueppells_fox-d9ciupp.png]
01-06-2013, 12:30 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: The Nublette Needs Help With Everything

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

Tutorials: From Noob to Pro
01-06-2013, 01:10 AM
Website Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#9
RE: The Nublette Needs Help With Everything

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

[Image: quote_by_rueppells_fox-d9ciupp.png]
01-06-2013, 03:00 AM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#10
RE: The Nublette Needs Help With Everything

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...

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 01-08-2013, 03:51 AM by CarnivorousJelly.)
01-08-2013, 02:56 AM
Find




Users browsing this thread: 1 Guest(s)