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
Add a journal entry/note after I interact with a locked door?
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#1
Add a journal entry/note after I interact with a locked door?

So I need to know just how I can get my game to add a note to my journal after interacting with a door that is locked which would say something like, "The door is locked, I gotta look around for some sort of 'key'". But here's where it gets tricky for me, this door was a door I've already interacted with, but has locked behind me once I entered through it, so I have a trigger inside the room that closes and locks the door... But how do I make it so the note only is added after the door has been closed/locked and I've tried to interact with it to open it up so I can leave the room?

Thanks to anyone who is willing to help!

Check out my custom stories(1)(2)!
10-07-2010, 11:34 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Add a journal entry/note after I interact with a locked door?

Call a
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
when you lock the door.
Create another function as target of this callback and put a
SetMessage(string &asTextCategory, string &asTextEntry, float afTime);
inside.

I think your scripting knowledge is good enough to deal with these two hints. Wink

10-07-2010, 11:52 PM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#3
RE: Add a journal entry/note after I interact with a locked door?

Ok, I think I got it right - haven't tested it yet though. One more question, since I have it so the message will appear when I interact with the locked door, will it stop showing the message once I get it unlocked?

EDIT: Nope, I couldn't get it to work, though it looked like it should have... My script looks like this:
void CollideCellarGruntTrigger2(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("cellargrunt2", true);
    AddEnemyPatrolNode("cellargrunt2", "PathNodeArea_96", 0, "");
    SetSwingDoorClosed("cellar_wood01_2", true, true);
    SetSwingDoorLocked("cellar_wood01_2", true, true);
    SetEntityPlayerInteractCallback("cellar_wood01_2", "AddMessage1", false);
    AddEntityCollideCallback("Player", "PlayerGruntNotice1", "CollidePlayerGruntNotice1", true, 0);
}

void AddMessage1(string &in asParent, string &in asChild, int alState)
{
    SetMessage("Messages", "DoorLocked", 0);
}
And my extra_english.lang where I have the message info looks like this:
<CATEGORY Name="Messages">
  <Entry Name="DoorLocked">It won't open, it's locked.</Entry>
  </CATEGORY>

EDIT2: I also tried changing the "false" in the PlayerInteractCallback to "true", but still no luck.

Check out my custom stories(1)(2)!
10-08-2010, 12:19 AM
Find
Soon Offline
Member

Posts: 50
Threads: 11
Joined: Sep 2010
Reputation: 0
#4
RE: Add a journal entry/note after I interact with a locked door?

You would have to use an if statement to check if the door is still locked while you interact with it. At least that's what I had to do. There might be an easier way.
10-08-2010, 02:21 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#5
RE: Add a journal entry/note after I interact with a locked door?

Callback syntax for AddMessage1 would be
/**
* Callback syntax: MyFunc(string &in entity)
*/

Also, try adding a debug message to see if it works.

10-08-2010, 10:18 AM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#6
RE: Add a journal entry/note after I interact with a locked door?

Thanks for trying to help, but I don't exactly understand in what form I am to put together my code... So I think it'd be easier if someone would simply provide me with the code string I need to enter in for this specific situation. My mind is getting flayed trying to figure this out. Anyone help?

Check out my custom stories(1)(2)!
10-09-2010, 06:55 AM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#7
RE: Add a journal entry/note after I interact with a locked door?

(10-09-2010, 06:55 AM)theDARKW0LF Wrote: Thanks for trying to help, but I don't exactly understand in what form I am to put together my code... So I think it'd be easier if someone would simply provide me with the code string I need to enter in for this specific situation. My mind is getting flayed trying to figure this out. Anyone help?

If we simply give you the code, youll likely never understand it yourself

Heres my advice: Look at the scripts for the Amnesia story, and use it as reference data - Thats how i learnt to use NPC Waypoints, Sanity Damage, Door Locks and other such things.

Best of luck Smile

EDIT: Though if you insist, just post your current code and tell me what you want it to be doing, and what it currently is not doing, and ill try and tweak it.
10-09-2010, 07:06 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#8
RE: Add a journal entry/note after I interact with a locked door?

void CollideCellarGruntTrigger2(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("cellargrunt2", true);
    AddEnemyPatrolNode("cellargrunt2", "PathNodeArea_96", 0, "");
    SetSwingDoorClosed("cellar_wood01_2", true, true);
    SetSwingDoorLocked("cellar_wood01_2", true, true);
    SetEntityPlayerInteractCallback("cellar_wood01_2", "AddMessage1", false);
    AddEntityCollideCallback("Player", "PlayerGruntNotice1", "CollidePlayerGruntNotice1", true, 0);
}

void AddMessage1(string &in entity)
{
    AddDebugMessage("It worked!", false);
    SetMessage("Messages", "DoorLocked", 0);
}

10-09-2010, 11:21 AM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#9
RE: Add a journal entry/note after I interact with a locked door?

Thanks for the help you guys, that worked nicely.

If someone is willing and able, I have one more issue I've run into regarding the format of a string of code...
Basically, I want to enable collide triggers after the game checks that the player has a crowbar in his inventory, but it doesn't seem to work, when I try to launch the game it always gives me the "unexpected end of file" error, but once I remove that string of code, the game launches fine.
What is the correct formula?

My formula is as follows:
void AreaTriggerEvents1(string &in asParent, string &in asChild, int alState)
{
     if(HasItem("crowbar_1") == true)
    {
        AddEntityCollideCallback("Player", "CellarGruntTrigger2", "CollideCellarGruntTrigger2", true, 0);
        AddEntityCollideCallback("Player", "OpenTrigger2", "CollideOpenTrigger2, true, 0);
    }
}

I also tried the "if(HasItem" string with a "GetHasItem", but it didn't result in any stability.

EDIT: Oh, and I also tried changing the "(string &in asParent, string &in asChild, int alState)" to "(string &in asEntity)", but nothing changed.

Check out my custom stories(1)(2)!
10-10-2010, 07:40 AM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#10
RE: Add a journal entry/note after I interact with a locked door?

Good question...
I know HasItem(string& asName); is correct, but the "== True" seems a bit odd, unless im missing something.

Im interested to see how this works out

Also, start with Get Has Item, then If Has Item. So, it sees if you have the item, then says that If you have the item...

So, like,

GetEntityExists(string& asName); //See if it exists
HasItem(string& asName); // If it does exist

Then the "If" Function

That was a pseudo code, and is not representative of how it will actually look by the way

It just makes slightly more sense if it checks for the item as a whole before trying to make a function out of the result
10-10-2010, 07:48 AM
Find




Users browsing this thread: 3 Guest(s)