Normally I wouldn’t ask for help, but tables have a way of frustrating me to no end. Given 3-4 hours i could figure this out, or throw my monitor across the screen. Either way I’m in a hurry. So here’s the problem.
I’m creating it so every NPC has a table that will decide whether he begins a set of action.
Table of Yago's Arrogance
List Action Interest
3 "Relax" 10
2 "Manipulate" 6
1 "Get Food" 4
List is just for organizing so I don’t have to refer to the action directly to save typing time and can be removed. Interest refers to the probability that he will carry out the action. And Action is just a shortcut for said set of actions, EG manipulate would have him find another character and strike up a conversation. What I need to know is how do I link the row to a set of action that have to be carried out out and can I add a random chance affected by Interest to change the chance of the character deciding whether to do it.
PS: And while I’m asking for help I realise that every turn would interrupt multi turn actions. So is there a way to create a objective that has to be finished before running throught the list again. I could probably create a set of flags that turn on and off restarting the list, but wouldn’t that mess up if the player interacted with the character.
I hope this is clear enough.
The first idea that came to my mind was to add a column of rule entries that control the set of actions to be tried:
Table of Yago's Arrogance
List Action Interest Rule
3 "Relax" 10 relax rule
2 "Manipulate" 6 manipulate people rule
1 "Get Food" 4 seek food rule
And then put some code like this in the right place:
if a random chance of the interest entry in 10 succeeds, abide by the rule entry;
You see I didn’t even know you could tie rules to a table. I’m clueless around them. Hmmm sounds good guess I’ll have to tinker with it. Thank you.
This Event Chains extension might also be helpful, as an inspiration for what you can do with tables in rules etc. and maybe also as a way of handling the multi-turn actions. Exactly what you do with those will depend on how you want to do with it (what would interrupt an action? does the NPC resume multi-turn actions after being interrupted or just go on to the next thing?)
You can put all kinds of things in tables. Rules (as you’ve seen), stored actions, action names (like “the taking action”); though in your case I think Felix’s suggestion of rules is far more flexible and the thing that would be best suited to your purposes.
[rant=Truly ugly code linked to here.]I think [url=https://intfiction.org/t/applying-a-to-decide-whether-phrase-as-an-advanced-kind/4776/1]this[/url[ holds the record for most ridiculous table column; the pseudorelation column entries are of the kind “phrase (object, object) -> nothing.” Don’t try this at home; for a couple of reasons I have never got the code surrounding this to work.[/rant]
Would for example the player talking to an NPC who is carrying out an action set clear the action set or pause it?
This is why I avoid tables so flexible its hard to get right. I guess it will just boil down to trial and error.
By default it wouldn’t do anything. (Unless perhaps you’re using one of the conversation extensions that interrupts the turn sequence in some way; I don’t have any experience with those.) If you had an every turn rule that (say) stepped through an event chain for the NPC’s action, and the player performed an action that involved talking to the NPC, the every turn rule would keep firing unless you told it not to.