ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Handling greeting NPCs when player enters/exits... (solved)

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Handling greeting NPCs when player enters/exits... (solved)

Postby enerdoe » Sun Jul 05, 2020 7:53 pm

I have a lobby with a receptionist at a front desk. One direction serves as the front door and I want the receptionist to greet/say goodbye when the player enters/leaves through the front-door direction only.

I know I can create a system task with 'Player enters location', and I know how to override the 'player movement' task, but both options promt the NPC to greet/say goodbye regardless from which direction the player enters the lobby, or leaves the lobby. But it is kinda out of place for the receptionist to greet the player as if he/she just came through the front-door, when the player just came back from the toilets in the same building... or to say goodbye when the player is just leaving for the toilet.

I'm sure someone else already asked this, but I couldn't find anything. So my question: How can I have the receptionist react differently depending on from which direction the player enters (or leaves) the lobby?
Last edited by enerdoe on Sun Jul 05, 2020 8:59 pm, edited 1 time in total.
enerdoe
 
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits location

Postby David Whyld » Sun Jul 05, 2020 8:18 pm

Couldn't you have two different tasks? One requiring the player to be in, say, the street and displaying one message and the other requiring the player to be in the toilets and displaying a different message.

There's probably a more elegant way of doing it but I think that should work.
David Whyld
 
Posts: 7004
Joined: Sat Dec 18, 2004 5:15 pm
Location: United Kingdom
Points: 35

Re: Handling greeting NPCs when player enters/exits location

Postby enerdoe » Sun Jul 05, 2020 8:54 pm

David Whyld wrote:Couldn't you have two different tasks? One requiring the player to be in, say, the street and displaying one message and the other requiring the player to be in the toilets and displaying a different message.


I tried that, basically two 'player movement' overrides, but couldn't get it to work, don't know why. However, I inserted the messages directly into the 'player movement' task with the appropriate restrictions and it works like a charm.

Thanks for the help.
enerdoe
 
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits... (solv

Postby Denk » Sun Jul 05, 2020 9:46 pm

I know it is already solved, but I just got curious and made a quick demo since you mentioned that you couldn't get it to work using two "player movement" overrides. That is definitely possible, but it can be made a bit simpler using "run before" for saying goodbye and "run after" for saying hello instead of using two overrides. Not everyone is aware of those options.

I attach the demo.
Attachments
Receptionist.taf
(15.17 KiB) Downloaded 14 times
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Denk
 
Posts: 486
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 251

Re: Handling greeting NPCs when player enters/exits... (solv

Postby enerdoe » Mon Jul 06, 2020 1:14 am

@Denk - Mh, I looked into your demo and I think it didn't worked for me because I didn't thought of "run before/run after" like you did.

For now I use "Referenced Direction must be..." as if-condition on alternative descriptions in the "player movement" task itself. But I think I move back to using overrides, because that way I can attach actions to it if necessary, like moving the player back to previous location with the game printing: "Sorry," The receptionist shoves you right back outside. "we're already closed!" :D

So thank you. Your demo revealed what I did wrong with the overrides.
enerdoe
 
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits... (solv

Postby enerdoe » Mon Jul 06, 2020 1:33 am

Quick addendum, I modified the demo so that it works with just one override...
Attachments
Receptionist2.taf
(15.17 KiB) Downloaded 12 times
enerdoe
 
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits... (solv

Postby Denk » Mon Jul 06, 2020 10:26 am

enerdoe wrote:Quick addendum, I modified the demo so that it works with just one override...
Neat, that is even more compact. The reason why I used two tasks is if you want one of the messages to occur before the location description and the other to occur after the location description. But in your example, it looks good that both messages occur before the location description. If entering the reception had led to a longer conversation between the player and the receptionist it would not look so good to have the location description after the conversation.

Another thing: When I looked at the task restrictions in your demo I was quite surprised that you have six restrictions with a combination of ANDs and ORs without using parentheses. Personally, I find it very hard to predict the behaviour of such AND/OR restrictions without parentheses. You may be used to it and know how the restrictions will behave without parentheses, but I just wanted to mention it in case you are not aware that you can use both parentheses "(" and double parentheses "((" around the restrictions.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Denk
 
Posts: 486
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 251

Re: Handling greeting NPCs when player enters/exits... (solv

Postby enerdoe » Mon Jul 06, 2020 1:25 pm

Yeah, I know that we can use parantheses for restrictions and your right that AND/OR restrictions can get messy without them. But in my experience that usually happens when the AND/OR restrictions become to complex/long.
In the demo the game just needs to keep track of three things (player/receptionist location and referenced direction), but if we would try to have the receptionist respond differently based on what the player is wearing, the weather outside, time of day, a robbery in progress, and such, we wouldn't come far without parantheses.

Also, having it all in one task might be neat and works well when the receptionist greeting/saying goodbye is all that's supposed to happen. But one task also only allows one action and I do want to implement some different responses/happenings when the player is entering/leaving, like the player becoming victim of a pickpocket. For that it kinda feels easier to have two seperated tasks for entering/leaving.
enerdoe
 
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits... (solv

Postby rovarsson » Thu Jul 16, 2020 9:58 am

Denk wrote:I know it is already solved, but I just got curious and made a quick demo since you mentioned that you couldn't get it to work using two "player movement" overrides. That is definitely possible, but it can be made a bit simpler using "run before" for saying goodbye and "run after" for saying hello instead of using two overrides. Not everyone is aware of those options.

I attach the demo.


This is incredibly helpful! Every now and then I find myself wondering "What exactly does this option do?" ... and then I forget about it. Thanks for the demo.
rovarsson
 
Posts: 90
Joined: Mon Dec 23, 2019 10:37 pm
Location: Belgium
Points: 15


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 6 guests

cron