Consequences of failed Pickpocket

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Consequences of failed Pickpocket

      Hello,

      Let me preface this with I do not know coding or modding. I do not think you need to hold my hand, but please try to keep explanation as simple as possible. I am just throwing myself into fire, hehe.

      I was hoping you might be able to point me in the direction of where to look on how the guards react to the environment. I would like to try to start off small and for this particular change to the mod, I would like to make the guards chase thiefs who try to pickpocket and get caught.

      I am assuming they are getting caught because I see a message that is along the line of "Hey, stop that thief!"

      I have started going through and reading the db and script files... some things I can grasp and others just do not make sense- mostly because I do not know the language.

      Anyways, I guess I am asking is instead of going through every file, can you help limit me a few files and let me fumble around.

      BTW, if this takes more than two minutes to reply to, then no worries. I do not want to be taking up your time for my fiddling around.
    • Hi, because this i a more general modding question I moved the topic.

      Before I can answer your question you have to be aware that there are two types of guard-reactions.

      First is attacking anyone who is comitting a crime. Not every "red" action is a crime, only very few actualy like attacking, murdering, breaking bones etc. You can see what is defined as an crime in actions.dbt (and see the script bs_illegalDetection.lua)

      Pickpocketing is not an illegal action. If you have a good site for automatic translation check out this thread (I want to translate every tutorial to English and vice versa but that needs time I currently not have): [Deutsch] Behaviours, Actions und States erklärt
      In actions.dbt you could change that line:

      Source Code

      1. 21 "pickpocket" 3 0 0 0 0 300 "" 0 |

      change the "" to bs_IllegalDetection.lua or a new script you make for a specific behavior.

      You could also take a look into the actual pickpocket script to see whats happening there. You need to start an "action" before guards can behave to it - that usually happens in the script of the crime.

      Hope that helps a bit
    • Hello,

      Ok, so I spent some time looking at ms_068_PickpocketPeople.lua and I think that this works just fine. If they get caught they are suppose to hide or run. If they hide, then they should not be attacked by the guards.

      The whole reason I went off on this tangent is because the NPC thieves where getting caught and running way. They never hid, they always ran away. I thought, if your going to run away, then you should be able to be attacked by the guards.

      This block from pickpocket measure is:

      CommitAction("pickpocket", "", "", DestAlias)
      feedback_OverheadComment(DestAlias,
      "@L_THIEF_068_PICKPOCKETPEOPLE_SCREAM_+0", false, true)
      if BuildingHasUpgrade("MyHome",543) then
      if GetState("", STATE_FIGHTING) == false then
      ms_068_pickpocketpeople_FastHide()
      end
      else
      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")
      Sleep(50)

      I interpret this to mean that hiding is based on the level of a building. I assume MyHome is the thieves den. My thieves den is lvl 3 the building in this particular town is lvl 2. However, when I look at the building improvements, it does show anything about an ability to hide, so I do not understand what the lvl of the building has to do with the thief's ability to hide. Also, I do not get 543. **As I typed this I went back into game and looked at building improvements again and "shadow cloak" is 543 in BuildingUpgrades.dbt. (The first time I read the descriptions it did not mean anything. Afterwards, the description still does not make it clear, but I figured it out.) So now this code makes sense to me.**

      I do not think I want to add bs_IllegalDetection.lua to the pickpocket action because I think that will cause the guards to attack anytime there is an attempt at pickpocket.

      Having learned a bit more from reading ms_068_PickpocketPeople.lua, I think now instead of getting the guards involved, I want to make it so that failed attempts that end with your thief running away would create evidence against you. I think this creates more opportunity to utilize game features other than just hiring another thief that was killed by guards.

      I could only find this in ms_FightKill.lua:

      if IsType("Destination", "Sim") and DynastyIsPlayer("Destination") then
      AddEvidence("Destination", "", "Destination", 16) -- Murder
      end

      I am guessing this is the code to make evidence against you... I could not find anything else on evidence. But if I did this:

      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")

      AddEvidence("Destination", "", "Destination", 16) -- Murder

      Sleep(50)

      Would that make a murder charge against you if failed and had to run?

      ------

      So I found this from the tutorial thread:

      Number AddEvidence(Alias ( of type sim) pWitness, Alias ( of type sim) pOffender, Alias ( of type guildobject) pVictim, Number TypeID)

      Parameters:
      Alias ( of type sim) pWitness :
      the one who gets the evidence
      Alias ( of type sim) pOffender :
      the one who commited the crime
      Alias ( of type guildobject) pVictim :
      victim of the crime
      Number TypeID :
      see Database: cs_memoryevent
      Return Value:
      Number :
      no comment
      Description:
      creates a new event, and stores evidence in pWitnesses memory

      Also, noticed that pickpocket measure used DestAlias, and I found MemoryEvent.dbt had Murder as 16 so I assumed this is were the TypeID was coming from... Theft is 20 and listed as isevidence so then:

      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")

      AddEvidence("DestAlias", "", "DestAlias", 20) -- Theft

      Sleep(50)

      Thoughts?

      The post was edited 1 time, last by AbarenboSaru ().

    • Hello,

      So i tried:

      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")
      AddEvidence("DestAlias", "", "DestAlias", 20) -- Theft
      Sleep(50)

      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")
      AddEvidence("Destination", "", "Destination", 20) -- Theft
      Sleep(50)

      AddEvidence("Destination", "", "Destination", 20) -- Theft
      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")
      Sleep(50)

      I was hoping this would auto populate in the evidence tab of the diary.

      So I noticed in the description of AddEvidence says it creates a new event, and stores evidence in pWitnesses memory. So if I understand this correctly, that means I have to get pWitness to give me the information. So I spent five turns thieving and gathering information and all I would get is evidence on other people nothing on myself.

      I tried looking at ms_211_OrderCollectEvidence.lua but nothing jumps out as to how the game takes a successful collection and transfers that to the diary.

      I think I will continue to play with this to see if I ever get it working.
    • Evidence works on two ways:

      AddEvidence creates a NEW evidence - only the Destination will get it.
      CommitAction will create a visible source of action - in case of crimes all people nearby noticing it will get the same copy of evidence.
      There is a function on sharing evidence but that is barely useful because you can't select a specific memory but only all evidence or all evidence about a specific person. So if you would use it you would probably transfer evidence you don't want to get shared.
    • Hello,

      SOOOO... I took an easy way out.

      If you fail a pickpocket and you do not have the cloak upgrade, then instead of running away you attack the mark:

      if chr_GetTitle(DestAlias) > 3 then
      chr_ModifyFavor(DestAlias,"",-5)
      CommitAction("pickpocket", "", "", DestAlias)
      feedback_OverheadComment(DestAlias,
      "@L_THIEF_068_PICKPOCKETPEOPLE_SCREAM_+0", false, true)
      if BuildingHasUpgrade("MyHome",543) then
      if GetState("", STATE_FIGHTING) == false then
      ms_068_pickpocketpeople_FastHide()
      end
      else
      -- f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      -- StopAction("pickpocket","")
      -- Sleep(50)
      CommitAction("attack", "", "", DestAlias)
      end
      f_MoveTo("","Destination",GL_MOVESPEED_WALK,50)
      end

      Thief gets killed and you get evidence against you for attacking civilian.

      I do not know enough about coding, but I think I should be able write a function that would:

      function Flee()

      -- stops the pickpocket action
      -- creates evidence
      -- updates diary immediately, like with attacking civilian
      -- thief runs away

      I say this because they just wrote Fasthide() in the pickpocketpeople measure... to me, this means I should also be able to make a one off action.

      I am going to peruse the script documentation some and see if I can figure this out...
    • Hello,

      Yes, it does start the attack. As "intended" it will only attack if : A) pickpocket fails and B) if you do not have the cloak upgrade.

      As of right now, this is the easiest way to get some evidence against you (evidence is for attacking a civilian). Thus far, every thief has died in the attack.

      Next is me trying to figure out the function so I can get the this to work how I want.
    • Hello,

      I GOT IT!!!

      From ms_068_PickpocketPeople.lua:

      if chr_GetTitle(DestAlias) > 3 then
      chr_ModifyFavor(DestAlias,"",-5)
      CommitAction("pickpocket", "", "", DestAlias)
      feedback_OverheadComment(DestAlias,
      "@L_THIEF_068_PICKPOCKETPEOPLE_SCREAM_+0", false, true)
      local failure = Rand(20) -- Chance to fail FastHide
      if BuildingHasUpgrade("MyHome",543) and failure >= 2 then
      if GetState("", STATE_FIGHTING) == false then
      ms_068_pickpocketpeople_FastHide()
      end
      else
      GetDynasty("DestAlias", "VictimDyn") -- Get victim's dynasty
      ModifyFavorToDynasty("", "VictimDyn", -10) -- Lose Favor for getting caught pickpocketing
      GetDynasty("", "PickpocketDyn") -- Get pickpockets dynasty
      DynastyGetFamilyMember("PickpocketDyn" , 0, "PickpocketDynBoss") -- Get pickpocket dynasty's leader
      AddEvidence("PickpocketDynBoss", "PickpocketDynBoss", "DestAlias", 20) -- Add evidence against pickpocket dynasty's leader
      f_MoveTo("","MyHome",GL_MOVESPEED_RUN,0)
      StopAction("pickpocket","")
      Sleep(50)
      end

      So, this may be a little premature, but I wanted to post anyways. Failing and getting caught creates theft evidence against you.

      I still have to test after getting the cloak upgrade to see if it hides you and if my random works to cause a failed hide attempt. Also, have to see if AI can/will use the evidence against me.
      Images
      • Success.jpg

        138.74 kB, 651×607, viewed 2,842 times
    • Hello,

      So I just noticed that it does not show the victim in the diary.

      I think this may be an issue, as after 3 turns the AI never tried to use evidence against me. I had one of my thieves attack a civilian, and in the same turn AI used evidence.

      ----
      Update:

      So I built three thieves dens and had fifteen thieves pickpocket for six turns. Had over 200 theft entries with no victim name. Never had AI use evidence against me.

      One thing that I have a question about, in the definition of AddEvidence, the value for victim is a guildobject. DestAlias is defined in the measure as:

      local DestAlias = "Sims"..Rand(NumOfObjects-1)

      Is DestAlias considered a guildobject?

      The post was edited 1 time, last by AbarenboSaru: Update ().

    • DestAlias is a variable. You must not put it in quotes

      Also: you cant use the function for getting the dyn boss, because you will always get the same person even if hes already dead. So better get the owner of the pickpocket buisness.

      The favor loss should be between dynasties because if "" is an enployee the victim will only dislike your employee not your dynasty.

      Addevidence: the first alias needs to be the alias of the victim. Make a check for if the victim is part of a dynasty and then give it to someone from the dynasty (dynastygetrandomMember will do it)
    • Hello,

      So I got rid of the quotes, and now the victim shows up.

      Hmm, I was hoping that 0 would be the active toon of the dynasty and not hard code to the first toon of the dynasty.

      I will play with more and see what happens.

      Took me a bit before I realized to turn off the pickpocket timer and to change the favor by a large number for testing so I can tell if its working or not.

      My random does work, I changed it to >= 6... still testing to find a sweet spot for failure.
      Images
      • 20171024121854_1.jpg

        147.46 kB, 653×613, viewed 75 times