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.
Post Reply
enerdoe
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

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

Post by enerdoe »

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 9:59 pm, edited 1 time in total.
David Whyld
Posts: 7026
Joined: Sat Dec 18, 2004 5:15 pm
Points: 35
Location: United Kingdom

Re: Handling greeting NPCs when player enters/exits location

Post by David Whyld »

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.
enerdoe
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

Re: Handling greeting NPCs when player enters/exits location

Post by enerdoe »

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.
User avatar
Denk
Posts: 782
Joined: Mon Feb 22, 2016 6:21 pm
Points: 291
Location: Hjørring, Denmark

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

Post by Denk »

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 30 times
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
enerdoe
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

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

Post by enerdoe »

@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

Post by enerdoe »

Quick addendum, I modified the demo so that it works with just one override...
Attachments
Receptionist2.taf
(15.17 KiB) Downloaded 30 times
User avatar
Denk
Posts: 782
Joined: Mon Feb 22, 2016 6:21 pm
Points: 291
Location: Hjørring, Denmark

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

Post by Denk »

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
----------------------------------------------------------------------
enerdoe
Posts: 12
Joined: Fri Feb 24, 2017 6:48 pm
Points: 10

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

Post by enerdoe »

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.
rovarsson
Posts: 102
Joined: Mon Dec 23, 2019 10:37 pm
Points: 15
Location: Belgium

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

Post by rovarsson »

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