Posted May 15, 2024 by ferniss
#levels #turns #stealing #bugs #logs #inventory
I created a jail cell in the security room out of existing assets. I added 4 prisoner stations for NPCs when the get arrested.
I created an arrest caution that throws the NPC in jail for 10 turns. All NPCs can snitch on each other and the player.
At this point testing was getting cumbersome and I needed to review my AI workflow.
then… this code:
local watcher = tasksystem.address_cautions()
if watcher.npc ~= nil then confrontation_scene(watcher) end
I use two separate functions for witnessing the player steal and an NPC steal. I need to combine repeated code. Nothing really happens when the player is confronted. Needs a lot of consequences. Need to delete old cautions after they are addressed, like when someone is arrested. Addressing cautions needs to happen more often (each turn and interaction).
For confrontations, I need to add the npc’s current room and past room to their state and check to see if the pass each other through a “doorway”.
instead of just stealing a random item I added 3 functions for stealing. Steal most valuable, the one that best aligns with your skills, the last item that was added or a random item.
I also added stat bonuses for every item.
Noticed when NPCs are sent to jail, they are cloned, and one of them is still walking around free.
I created logs to show what is going on in through the process of stealing and getting caught.
DEBUG:SCRIPT: Quest related checks:::
DEBUG:SCRIPT: steal attempt - visitor01 SEEN by: labor02 in grounds
DEBUG:SCRIPT: labor02 did not confront: visitor01
DEBUG:SCRIPT: consulation_checks: reckless
DEBUG:SCRIPT: labor02 saw visitor01 do theft and created caution: reckless
DEBUG:SCRIPT: consulation_checks: snitch
DEBUG:SCRIPT: RC::: visitor02 has NO effect but a caution: snitch because of gossip from labor02 that visitor01 was caught for theft
DEBUG:SCRIPT: visitor02 saw visitor01 do theft and created caution: snitch
I think what is interesting here is that V01 was seen stealing by L02, but L02 didn’t snitch to security. Instead L02 recklessly gossiped to V02 about the crime. Then V02 snitched to security third hand.
I thought it was fun to see the environment be a little “alive”.
I wanted to mimic stealing, but instead NPCs could stash items. I could see in the future NPCs having hot, stolen items that they want to “hide” or cheap items they need to unload.
Now NPCs will either steal or stash. This should help keep inventories level and not have too much crime going on at once.
My inventory code was messy but I ironed out the adding and removing of stat bonuses and also have them applying on “New Game”