NPC - Better to code in common events or in the event itself?

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
156
Reaction score
61
First Language
French
Primarily Uses
RMMV
Hello!

I'm at the stage where I need to code my NPC, and decided to start with my merchants (apothecary, blacksmith, innkeeper, etc).

I'd like some input, so that I code things right from the get-go: is it better to put all the merchant code in a common event, or in the event itself with multiple event pages?

Details:
  • There are 4 levels of standing with each merchant, depending how much they like you (which can be increased by doing side-quests for them).
  • Each merchant offer 3 branches for text:
    • Trade (buy and sell stuff),
    • Chat (tell me about yourself),
    • Quest (got anything for me to do?)
  • Each text branch expands with higher standing with the merchant. For instance:
    • Trade: at standing level 1, you can buy a health potion. at level 4, you have access to invisibility potion, various poisons, herbs to remove KO, etc.
    • Chat: at standing level 1, chat will only give chit-chat text such as "I'm NPC 123 and been living in this village all my life". At standing level 4, you get multiple sub-options, taking you down the rabbit hole of their lives, siblings, who they love, they view of the world, etc.

My gut feeling tells me everything should be broken down in a common event, but then I'm starting to worry how I would be able to do cut scenes and move the NPCs around. For instance: when renting a room, the Innkeeper will walk you to the room and unlock the door for you.

Thoughts?
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,850
Reaction score
1,003
First Language
Dutch
Primarily Uses
RMMV
if each NPC sells different stuff at different levels in a conditional branch, you
can do it on the NPC it self (while it has a level of trust.

if the items are the same, (without the level of trust) you can built a common event.
if this is a traveling merchant you can use a common event for this one.

but 4 different ones and in 1 place = better in the event itself, if they travel as
well, make a common event.

but this is my personal reference, but how you built it is entirely up to you.

Some make it in the common event (if you dont use all), to quickly find
the error and fix it, so you dont have to search all maps (if you dont name them)
for a quick fix. but this is also u to you how you deal with it.

make it the way you feel most confortable with and follow your heart :)
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
542
Reaction score
220
First Language
english
Primarily Uses
RMMV
the examples you gave would say use separate events.

dialog options wouldnt want every item shop owner to have the exact same life story and give you quests on the other side of the world.
trying to common event it while having branch dialog for different NPCs would require far more branches and variable checks, while requiring more error testing.

individually eventing this could just make each fame level its own page or just 1 page with conditional branch for fame level.
no need for extra conditions checking what town your in before giving local info.
each NPC can have different life story.
can separate fame level and items available for each different region.

and the last example of the inn keeper. common eventing this movement and door unlocking would require either all inn to have the exact same layout or conditional branches with at least 4 variables to make it work right. individual eventing is just a simple move > unlock > move.
the whole long rest aspect can be common event though.
fade out: play sound: recover: (if have any day/rest based switches can flip those): (other long rest mechanics you make): fade in
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,243
Reaction score
1,236
First Language
Spanish
Primarily Uses
RMVXA
you'd be surprised how this problem can be solved by using the most noobish of solutions to the oldest problem of programming ever.

when they teach you programming, one of the first things they tell you, based on what you'd be likely to be doing, is "DON'T USE JUMPS."
you're supposed to use blocks, loops and conditionals to direct program flow.... as in, you know, *proper* programming.

but when you know how to use jumps, and how to bypass conditionals, and how to break loops mid way,... you can control a common event.

it's like the Matrix: "Are you telling me I can use multiple blocks in a single common event?"
"No, I'm telling you, when you are ready, you won't have to."
when you're ready, you can keep the shop event as it is, and transfer all the validations over to the common event, in a sort of hybrid system: trigger from the event, send over to common event, process and decide, send back, and present result.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,501
Reaction score
1,636
First Language
English
Primarily Uses
RMMV
Any eventing that is used more than once goes in a Common Event, that's how I do it. If it's unique to a single event, keep it on the event itself.
 

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
156
Reaction score
61
First Language
French
Primarily Uses
RMMV
Thanks folks! Since the traders will be interacted with multiple times, I think I'll go with Common Events for the traders. With some experience, I'll see about the other NPCs. Most of them will be very simple (like hi, hello, bye) so probably do not justify a full blown common event.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Yet another gaming question, i'm currently playing Last of Us 2 and want to get another game to play next but can't decide between Ghost of Tsushima, Miles Morales & Jedi Fallen Order. After the latest mandalorian i AM on a star wars kick, but i also LOVED the last spiderman game that prequels Miles Morales. Ghost of Tsushima is the bottom of my list but i heard it was AWESOME. Just want a good story & fun gameplay.
I checked out Genshin Impact gameplay out of curiosity. I can't believe it's available as a mobile game too. Smooth animation, great music, and stellar sound effects (the ambient sounds are pretty detailed).

I'm flabbergasted to see games have becoming more and more advanced. Maybe also because I'm oblivious to current trend for a long time, it almost feel like I'm being sent into distant future. xD
xDRAGOONx wrote on WaywardMartian's profile.
Your artwork is amazing!!!
:ewat:
Stream will be live shortly with a session of the Interactive Text Adventure! Feel free to drop by!
I should finish the cat video I'm editing and finish the indesign stuff. So far only 1 is done and 4 to go

Forum statistics

Threads
105,666
Messages
1,015,392
Members
137,341
Latest member
jasapembuatanwebsite
Top