NPC various reactions


#1

Hey. I need advice. In my game, I ran into a problem that I can not solve. I want NPCs depending on how much of it have a friendship, he reacted in different ways. But I’m always writing line 14: Can not fairAdd a non-percentile value: -3
I tried to look if anyone has or had similar problems, but I never found a solution. Can you help me?


#2

Did you do the following,

Example.

In startup:

*create bob 10
*create met_bob “false” (you might not need this, if you don’t plan on hiding the stat)

in stats:
*stat_chart
-percent Bob

then at the time when there’s a change in the relationship you use

*set bob +10

And if you want to use a different reaction based on friendship level,

*if bob > 19
-Bob likes you
*if bob < 20
-Bob doesn’t really like you

If this doesn’t help, could paste a piece of the code from where the problem is.


#3

Ok. Unfortunately, it’s not working.
I got it like that.

*stat_chart
percent Jarred
percent Harry
percent Thomas
percent Mary
percent Siria
percent Holy
percent Pot

In startup:

*create Jarred 0
*create Harry 0
*create Thomas 0
*create Mary 0
*create Siria 0
*create Holy 0
*create Pot 20

Situation:
*if Jarred > 8
"Oh. That would work." he said.
*goto_scene end
*if Jarred <7
Hunter went to see a place to sleep. Just snorted and said nothing. That ingrate!
*goto_scene end


#4

Are you sure that’s the exact line where the mistake is? I could very well be wrong but I don’t see much wrong with it.

On a side note, you might want to try using => and =< instead of just > and <, else there would be no result for when Jarred is at 7/8


#5

Out and about, so can’t check this properly, but the problem might be starting them at 0 – fairmath can’t handle 0 or 100, only the in betweens.


#6

Yes. Always me then Test writes: line 14: Can not fairAdd a non-percentile value: -7

But as I look at it, so I think the problem is that I can not go into minus friendship. At least as I understand it. But I do not know how to do to make it work. : /


#7

Okay so I probably thought correctly that it will be a problem. So. The program can not go in friendship to minus?


#8

When using fairmath, it’s got to be 1-99.

When you’re using normal math, you can get negative – but CS will have trouble reading it, as I discovered with my first forum thread:

If you’re using fairmath, I’d say treat 50 as “0” and anything below it is negative.


#9

I see. I understand. That’s why I’m working. Thanks a lot. :slight_smile:


#10

With the variables of 0 and 100, I have found out that you will need to use *set name 5. If you just *set name +5, then it will not work very well. I have found this out the hard way…