Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Letting players "assign" npc employees

I need help figuring out how to allow a player to assign npcs to certain jobs. During the game, players can pick up npcs with certain skills to work for them. The player also buys properties for these jobs to take place at.

What I'm trying to figure out is how to allow the player to go to these places and assign an npc that they've hired to "work" at a place they've bought. Once assigned, the player can return after set lengths of time to periodically collect money or items from them, depending on the job.

Not sure if I'm explaining this very well, if anybody can help me out that would be great. Also, ask questions if there's something I'm not explaining well. I really could use help on this.
 
Okay, it is all about switches, variables and conditional branches...

First, make a variable where every variable contains values for each job, if there are 10 jobs, then put ten values for that variable.

Next, set a conditional branch in each event(NPC), that the conditions have the value of the variables contain. So this example makes it:

http://img211.imageshack.us/img211/8537/59830970fr5.jpg[/img]

(note that in this event, everytime you talk to him, the variable is always set to 0. I just did this to show how i do it.)

Note that the branches are just examples of what the NPCs will do when a certain variable's value is met. If not, you know. :)
 
Not 100% if I understand what you're telling me.

Currently the way I have it setup is that each npc in game you can hire has a switch assigned to them, and each property you can buy has a switch assigned as well.

So, I'm using the switches to change things outside of the assigning process, but you're saying I should go back and assign variables to each npc and property as well.. then use that to handle the assigning process?

Oh, and the npcs aren't generic npcs. They're named characters in the game, which is why I thought I had to use switches for this.

Anyways, I'll play with this using variables and see if I can grasp what you're saying.
 
Using too much switches may not be suitable for your game. Using 1 switch in every NPC event means A LOT.

Nope, im saying use only "1" variable. Because its a variable, values can change. Using variables can save your switches for other events.

But its up to you if you want to use switches in each event as well. The thing is; handling conditional branches may be more effective(though needs a bit more thinking) using a variable than using a switch.
 
I think I get how to use that for hiring guys, and I can use another one for buying up properties. I'm still not sure how I would use that to assign people to jobs though.

Figure that I've already hired like 3 guys, and I have two properties. I want to be able to go to one of the properties, have a box or menu pop up that asks who I would like to assign to that place to work. Then IDEALLY I was thinking there'd be a list of currently hired npcs to pick from, but it would also work if it simply autoassigned the first guy that fit that job description (i.e. first farmer npc out of the two farmer npcs I currently have hired).

See what I'm sayin?
 
I've had time to think about this and I've had the idea to use inventory items to signify certain npcs being hired by the player. For example, if the player hires bob the bartender then they would get bob's resume to put into their inventory.

What I still can't figure is how to assign people to jobs. For example, if I had 3 mailmen, (fred, steve and tony) and I wanted to assign a specific one, say fred, a mail route on 3rd street... and steve to a mail route on 5th street, how could i go about putting this into the game?

My first thought is that I have to learn how to create a customized menu screen, but I'm not sure.

I could just really use some help with this. Thanx.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top