Advertisement

A deeper way of representing opinions of NPCs

Started by March 25, 2016 08:50 AM
9 comments, last by Shyr 8 years, 8 months ago

I'm just going to give a working example of how you can use "flags" (a condition that is either true or false) like nfries88 said.

First, go to this site and choose any number of those emotions to use as "flags".

http://changingminds.org/explanations/emotions/basic%20emotions.htm


#include <iostream>
using namespace std;

enum FEELS {
    CONTENT=1,
    HUMILIATED=2,
    PANICKED=4,
    IRRITATED=8,
    AMAZED=16,
    TRIUMPH=32
};

int main(){
    unsigned char NPC = 0;

    // set any flag you like
    NPC |= FEELS::AMAZED | FEELS::IRRITATED;

    // somewhere else in your code for you to check
    if(NPC&FEELS::CONTENT)    cout << "NPC: I am content.\n";
    if(NPC&FEELS::HUMILIATED) cout << "NPC: This is...so humiliating...\n";
    if(NPC&FEELS::PANICKED)   cout << "NPC: Wh-wh-what do you want from me!?\n";
    if(NPC&FEELS::AMAZED &&
       NPC&FEELS::IRRITATED)  cout << "NPC: You seriously irritate me. But I must say, that was amazing!\n";

    return 0;
}



// This is the output

NPC: You seriously irritate me. But I must say, that was amazing!

This topic is closed to new replies.

Advertisement