playMaker

Author Topic: Making NPCs Remember Things [SOLVED]  (Read 1534 times)

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Making NPCs Remember Things [SOLVED]
« on: June 18, 2017, 03:32:01 PM »
Hi,

I'm trying to have my NPCs have opinions about each other. Something super simple like - from 0 to 10 how much do I like NPC2?

It would start at 5 (neutral) and go up or down depending on that NPCs actions.

The thing is, I've no idea how to do this with playmaker. I was looking into Array Lists so they know if they already met a certain NPC but I can't find a way to associate variables to that NPC.

Any ideas? :\
« Last Edit: June 19, 2017, 09:45:19 AM by MajorIdea »

marv

  • Junior Playmaker
  • **
  • Posts: 50
Re: Making NPCs Remember Things
« Reply #1 on: June 19, 2017, 02:41:00 AM »
A simple way to do this would be to work with Arraymaker (can be found on the ecosystem) and use hash tables.

Assign a hash table to every npc that contains that npc's opinion of every other npc. The other npc's IDs would be the key and the value the hash table's owner's opinion.

To then use an npc's (1) opinion of another npc (2) you access the opinion hash table of (1) and get the key [(2) ID].

The important thing here is to be consistent in how you build things from the base up. If you plan on having multiple hash tables for each npc (for example one for opinions, one for general stats etc.) decide early on on a way of organizing things and stick to it.
« Last Edit: June 19, 2017, 02:45:17 AM by marv »

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: Making NPCs Remember Things [SOLVED]
« Reply #2 on: June 19, 2017, 09:52:06 AM »
Thanks marv! That is super simple! I didn't really know what hash tables where so that's a whole new tool you just helped to open up for me :)

I'm hoping it's not too expensive to have a few array lists and hash tables per NPC but as it stands it's working!