Pinned [WIP] Fanpatch 4.3 [Deutsch]

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

    • [WIP] Fanpatch 4.3 [Deutsch]

      Einleitung:

      Der Fanpatch 4.3 basiert auf dem letzten offiziellen Update für Gilde 2: Renaissance. Der Fanpatch liefert Fixes der Community, insbesondere aus dem MegaModPack Projekt von Fajeth. Integriert werden scripttechnische Änderungen, die eindeutige Bugs beheben und notwendige Balance oder Quality of Life Änderungen. Stand Jetzt sind keine Änderungen an den Maps vorgesehen.



      Ziel:

      Das beste Vanilla-Spielerlebnis was die Community diesem alten Spiel bieten kann, als Basis für umfangreichere Modprojekte (wie die Neuauflage der MegaMod). Eine Alternative für jene, die mit den radikalen Änderungen, die ich persönlich bevorzuge, nicht einverstanden sind: Ein Dankeschön für die treue Community.


      Der Weg:


      Ich werde jeden einzelnen Bugfix in diesem Thread hier genau dokumentieren. Es wird aber eine Komplettinstallation geben, der Einbau von Hand ist an Modder gerichtet, die die Bugfixes in laufende Modprojekte integrieren möchten. Ich werde dabei alles durchgehen, was ich in der MegaMod gefixt habe, und unterwegs noch so entdecke. Weitere Fixes können von euch beigesteuert werden, meldet euch dann einfach bei mir.

      Stand: 23.06.2020

      6 von 1103 Scripten durchgesehen
    • Allgemeines

      - Einrückungen und Leerzeichen in den Scripten korrigiert.
      - Absätze und Kommentare hinzugefügt.
      - Scripte aufgeräumt/optimiert
      - Ungenutzte Dateien separiert in einen 'Removed' Ordner (macht Löschen des Scripts-Ordners vor Installation erforderlich)
      - Cutscene-Aufteilung in den Scripten entfernt
      - SetRepeatTimer mit SetMeasureRepeat bei allen Maßnahmen ersetzt.

      Bugfix-Liste

      - Falsche Itemnamen bei Artefakt-Skripten
      - Exploit: Man konnte Items nach Start einiger Maßnahmen aus dem Inventar entfernen und dennoch ihren Effekt nutzen.
      - Redundante Impacts entfernt
      - Der Vergiftete Kuchen (nur mittels Alchemistenmaßnahme erhältlich) senkte nicht die Kampfkraft des Opfers
      - Mehrere Probleme bei Medizinischen Behandlungen behoben
      - Thesenpapier-Script war kaputt

      Features

      - Medizinische Behandlungen steigern die Beliebtheit des Heilstubenbesitzers
    • Falscher Itemname bei Scripts/Measures/Artifacts/as_UseVoodo.lua


      ItemNamen sind case sensitive

      Lua Source Code

      1. if IsStateDriven() then
      2. local ItemName = "voodo"

      Ändern in

      Lua Source Code

      1. if IsStateDriven() then
      2. local ItemName = "Voodo"
      Und

      Lua Source Code

      1. RemoveItems("","voodo",1)
      ändern in

      Lua Source Code

      1. RemoveItems("", "Voodo", 1)

      Ebenfalls bei UseSpindel, UsePendel.lua
    • Exploit bei Scripts/Measures/Artifacts/as_UseVoodo.lua

      Item lässt sich nach Starten der Maßnahme aus dem Inventar entfernen und so erhalten.

      Lua Source Code

      1. RemoveItems("", "Voodo", 1)
      2. PlayAnimationNoWait("Owner", "use_object_standing")
      3. PlayAnimationNoWait("Destination","cogitate")
      4. Sleep(1)
      5. PlaySound3D("","Locations/wear_clothes/wear_clothes+1.wav", 1.0)
      6. CarryObject("","Handheld_Device/Doll_med_01.nif",false)
      7. Sleep(1)
      8. CarryObject("","",false)
      9. CarryObject("Destination","Handheld_Device/Doll_med_01.nif",false)
      10. PlayAnimationNoWait("Destination","fetch_store_obj_R")
      11. Sleep(1)
      12. PlaySound3D("Destination","Locations/wear_clothes/wear_clothes+1.wav", 1.0)
      13. CarryObject("Destination","",false)
      14. PlayFE("Destination", "smile", 0.5, 2, 0)
      15. Sleep(1)
      16. MsgSay("Destination","_HPFZ_ARTEFAKT_VODOO_SPRUCH_+0")
      17. if (GetSkillValue("Owner",SHADOW_ARTS) > GetSkillValue("Destination",EMPATHY)) then
      18. local DerFluch = Rand(10)
      19. GetPosition("Destination", "ParticleSpawnPos")
      20. PlayAnimationNoWait("Destination", "watch_for_guard")
      21. StartSingleShotParticle("particles/light_smoke.nif", "ParticleSpawnPos",2.7,5)
      22. Sleep(1)
      23. PlaySound3D("","Locations/destillery/destillery+1.wav", 1.0)
      24. MsgSay("Destination", "_HPFZ_ARTEFAKT_VODOO_SPRUCH_+1")
      25. Sleep(1)
      26. chr_GainXP("",GetData("BaseXP"))
      27. if DerFluch < 4 then
      28. AddImpact("Destination","totallydrunk",1,6)
      29. AddImpact("Destination","MoveSpeed",0.7,6)
      30. SetState("Destination",STATE_TOTALLYDRUNK,true)
      31. StopMeasure()
      32. elseif DerFluch < 7 then
      33. local SickChoice = Rand(8)+1
      34. if SickChoice==1 then
      35. diseases_Sprain("Destination",true,true)
      36. elseif SickChoice==2 then
      37. diseases_Cold("Destination",true,true)
      38. elseif SickChoice==3 then
      39. diseases_Influenza("Destination",true,true)
      40. elseif SickChoice==5 then
      41. diseases_Pox("Destination",true,true)
      42. elseif SickChoice==7 then
      43. diseases_Fracture("Destination",true,true)
      44. elseif SickChoice==8 then
      45. diseases_Caries("Destination",true,true)
      46. end
      47. SetState("Destination",STATE_SICK,true)
      48. else
      49. local FightPartners = Find("Destination", "__F((Object.GetObjectsByRadius(Sim)==3000)AND NOT(Object.HasDynasty())AND NOT(Object.GetState(unconscious))AND NOT(Object.GetState(dead))AND(Object.CompareHP()>30))","FightPartner", -1)
      50. if FightPartners>0 then
      51. if not BattleIsFighting(FightPartner) then
      52. MsgDebugMeasure("Force a Fight")
      53. SimStopMeasure(FightPartner)
      54. StopAnimation(FightPartner)
      55. MoveStop(FightPartner)
      56. AlignTo("Destination",FightPartner)
      57. AlignTo(FightPartner,"Destination")
      58. Sleep(1)
      59. PlayAnimationNoWait("Destination","threat")
      60. PlayAnimation(FightPartner,"insult_character")
      61. SetProperty(FightPartner,"Berserker",1)
      62. SetProperty("Destination","Berserker",1)
      63. BattleJoin("Destination",FightPartner,false,false)
      64. end
      65. else
      66. BattleJoin("Destination","",false,false)
      67. end
      68. end
      69. MsgNewsNoWait("","Destination","","intrigue",-1,
      70. "@L_HPFZ_ARTEFAKT_VODOO_NUTZER_KOPF_+0",
      71. "@L_HPFZ_ARTEFAKT_VODOO_NUTZER_RUMPF_+0",GetID("Destination"))
      72. MsgNewsNoWait("Destination","","","intrigue",-1,
      73. "@L_HPFZ_ARTEFAKT_VODOO_OPFER_KOPF_+0",
      74. "@L_HPFZ_ARTEFAKT_VODOO_OPFER_RUMPF_+0",GetID(""))
      75. end
      Display All

      ändern in:

      Lua Source Code

      1. if RemoveItems("", "Voodo", 1) == 1 then
      2. PlayAnimationNoWait("Owner", "use_object_standing")
      3. PlayAnimationNoWait("Destination","cogitate")
      4. Sleep(1)
      5. PlaySound3D("","Locations/wear_clothes/wear_clothes+1.wav", 1.0)
      6. CarryObject("","Handheld_Device/Doll_med_01.nif",false)
      7. Sleep(1)
      8. CarryObject("","",false)
      9. CarryObject("Destination","Handheld_Device/Doll_med_01.nif",false)
      10. PlayAnimationNoWait("Destination","fetch_store_obj_R")
      11. Sleep(1)
      12. PlaySound3D("Destination","Locations/wear_clothes/wear_clothes+1.wav", 1.0)
      13. CarryObject("Destination","",false)
      14. PlayFE("Destination", "smile", 0.5, 2, 0)
      15. Sleep(1)
      16. MsgSay("Destination","_HPFZ_ARTEFAKT_VODOO_SPRUCH_+0")
      17. if (GetSkillValue("Owner",SHADOW_ARTS) > GetSkillValue("Destination",EMPATHY)) then
      18. local DerFluch = Rand(10)
      19. GetPosition("Destination", "ParticleSpawnPos")
      20. PlayAnimationNoWait("Destination", "watch_for_guard")
      21. StartSingleShotParticle("particles/light_smoke.nif", "ParticleSpawnPos",2.7,5)
      22. Sleep(1)
      23. PlaySound3D("","Locations/destillery/destillery+1.wav", 1.0)
      24. MsgSay("Destination", "_HPFZ_ARTEFAKT_VODOO_SPRUCH_+1")
      25. Sleep(1)
      26. chr_GainXP("",GetData("BaseXP"))
      27. if DerFluch < 4 then
      28. AddImpact("Destination","totallydrunk",1,6)
      29. AddImpact("Destination","MoveSpeed",0.7,6)
      30. SetState("Destination",STATE_TOTALLYDRUNK,true)
      31. StopMeasure()
      32. elseif DerFluch < 7 then
      33. local SickChoice = Rand(8)+1
      34. if SickChoice==1 then
      35. diseases_Sprain("Destination",true,true)
      36. elseif SickChoice==2 then
      37. diseases_Cold("Destination",true,true)
      38. elseif SickChoice==3 then
      39. diseases_Influenza("Destination",true,true)
      40. elseif SickChoice==5 then
      41. diseases_Pox("Destination",true,true)
      42. elseif SickChoice==7 then
      43. diseases_Fracture("Destination",true,true)
      44. elseif SickChoice==8 then
      45. diseases_Caries("Destination",true,true)
      46. end
      47. SetState("Destination",STATE_SICK,true)
      48. else
      49. local FightPartners = Find("Destination", "__F((Object.GetObjectsByRadius(Sim)==3000)AND NOT(Object.HasDynasty())AND NOT(Object.GetState(unconscious))AND NOT(Object.GetState(dead))AND(Object.CompareHP()>30))","FightPartner", -1)
      50. if FightPartners>0 then
      51. if not BattleIsFighting(FightPartner) then
      52. MsgDebugMeasure("Force a Fight")
      53. SimStopMeasure(FightPartner)
      54. StopAnimation(FightPartner)
      55. MoveStop(FightPartner)
      56. AlignTo("Destination",FightPartner)
      57. AlignTo(FightPartner,"Destination")
      58. Sleep(1)
      59. PlayAnimationNoWait("Destination","threat")
      60. PlayAnimation(FightPartner,"insult_character")
      61. SetProperty(FightPartner,"Berserker",1)
      62. SetProperty("Destination","Berserker",1)
      63. BattleJoin("Destination",FightPartner,false,false)
      64. end
      65. else
      66. BattleJoin("Destination","",false,false)
      67. end
      68. end
      69. MsgNewsNoWait("","Destination","","intrigue",-1,
      70. "@L_HPFZ_ARTEFAKT_VODOO_NUTZER_KOPF_+0",
      71. "@L_HPFZ_ARTEFAKT_VODOO_NUTZER_RUMPF_+0",GetID("Destination"))
      72. MsgNewsNoWait("Destination","","","intrigue",-1,
      73. "@L_HPFZ_ARTEFAKT_VODOO_OPFER_KOPF_+0",
      74. "@L_HPFZ_ARTEFAKT_VODOO_OPFER_RUMPF_+0",GetID(""))
      75. end
      76. end
      Display All
      Selbiges Prinzip bei UseSpindel, Usepddv, UsePendel, UseHasstirade, UseHexerdokumentI, UseHexerdokumentII
    • Redundante Impacts entfernt

      as_194_UseThesisPaper.lua

      Löschen (kein Effekt)

      Lua Source Code

      1. --check if the artefact is ready to use
      2. if GetImpactValue("","thesispaper")==1 then
      3. StopMeasure()
      4. end

      Lua Source Code

      1. AddImpact("","thesispaper",1,RepeatTime)
      Aus der Impact-Liste löschen:

      Source Code: DB/Impacts.dbt

      1. 125 1 2 0 "thesispaper" 0 "" |
    • ms_MedicalTreatment.lua - Diverse Probleme bei der Behandlung

      Behandlung hängt sich auf:

      Suche

      Lua Source Code

      1. SetData("IsProductionMeasure", 0)
      2. SimSetProduceItemID("", -GetCurrentMeasureID(""), -1)
      3. SetData("IsProductionMeasure", 1)







      Verschiebe diesen Part vor die while true Schleife:

      Lua Source Code

      1. if not BedFree then
      2. StopMeasure()
      3. end
      4. SetData("IsProductionMeasure", 0)
      5. SimSetProduceItemID("", -GetCurrentMeasureID(""), -1)
      6. SetData("IsProductionMeasure", 1)
      7. while true do

      Locator sind anfällig für Bugs, daher ändern wir es zu properties

      Suche:

      Source Code

      1. local BedFree = false
      2. local BedNumber = 0
      3. for i=1,5 do
      4. if LocatorStatus("Hospital","Bed"..i)==1 then
      5. BedNumber = i
      6. GetLocatorByName("Hospital","Treatment"..BedNumber,"TreatmentPos")
      7. if BlockLocator("","TreatmentPos") then
      8. BedFree = true
      9. break
      10. end
      11. end
      12. end
      Display All
      Ändere in:

      Lua Source Code

      1. local MyID = GetID("")
      2. -- check property instead of locator
      3. for i=1,5 do
      4. if HasProperty("Hospital", "Locator"..i) then
      5. if GetProperty("Hospital", "Locator"..i) == MyID then
      6. BedFree = true
      7. BedNumber = i
      8. SetData("BedNumber", i)
      9. break
      10. end
      11. else
      12. SetProperty("Hospital", "Locator"..i, MyID)
      13. BedFree = true
      14. BedNumber = i
      15. SetData("BedNumber", i)
      16. break
      17. end
      18. end
      Display All
      Zudem brauchen wir noch diesen Part

      Source Code

      1. -- go to your place
      2. GetLocatorByName("Hospital","Treatment"..BedNumber,"TreatmentPos")
      3. if not f_BeginUseLocator("","TreatmentPos",GL_STANCE_STAND,true) then
      4. return
      5. end

      Kleiner gleich 0 geht auch einfacher

      Lua Source Code

      1. if NumSickSims <= 0 then
      daher

      Lua Source Code

      1. if NumSickSims < 1 then
      Gelangweilte Ärzte sorgen für Bugs

      Lua Source Code

      1. if BuildingGetAISetting("Hospital", "BuySell_Selection")>=0 then
      2. StopMeasure()
      3. end
      4. SetProperty("","Bored",1)
      5. if Rand(100)>80 then
      6. local BoredDocFilter = "__F((Object.GetObjectsByRadius(Sim) == 5000) AND (Object.Property.Bored==1))"
      7. local NumBoredDocs = Find("", BoredDocFilter,"BoredDoc", -1)
      8. if NumBoredDocs > 0 then
      9. f_MoveTo("","BoredDoc",GL_MOVESPEED_WALK,100)
      10. AlignTo("","BoredDoc")
      11. AlignTo("BoredDoc","")
      12. Sleep(1.5)
      13. local AnimTime = PlayAnimationNoWait("","talk")
      14. if SimGetGender("")==GL_GENDER_MALE then
      15. PlaySound3DVariation("","CharacterFX/male_neutral",1)
      16. else
      17. PlaySound3DVariation("","CharacterFX/female_neutral",1)
      18. end
      19. Sleep(3)
      20. if Rand(100)<50 then
      21. PlayAnimationNoWait("BoredDoc","nod")
      22. else
      23. PlayAnimationNoWait("BoredDoc","shake_head")
      24. end
      25. Sleep(AnimTime-3)
      26. end
      27. else
      28. MoveStop("")
      29. PlayAnimation("","cogitate")
      30. end
      Display All
      Daher raus damit und ersetzen mit
      (KI-Verbesserung gratis)

      Source Code

      1. -- bored
      2. MoveStop("")
      3. PlayAnimation("","cogitate")
      4. -- AI stops measure if no patients are available to do better things
      5. if BuildingGetAISetting("Hospital", "Produce_Selection") >0 then
      6. if BuildingGetProducerCount("Hospital", PT_MEASURE, "MedicalTreatment") > 1 then
      7. SimSetProduceItemID("", -1, -1)
      8. StopMeasure()
      9. end
      10. end
      Obsolet, löschen:

      Lua Source Code

      1. if HasProperty("","Bored") then
      2. RemoveProperty("","Bored")
      3. end
      Alias-Fehler sind überall, lohnt sich immer, die abzufangen, daher einfügen:

      Lua Source Code

      1. if not AliasExists("SickSim0") then
      2. return
      3. end
      Wir verzichten auf locator, daher kann dieser Teil hier weg

      Source Code

      1. --all beds full
      2. if BedNumber == 0 then
      3. return
      4. end
      5. GetLocatorByName("Hospital","Treatment"..BedNumber,"TreatmentPos")
      6. if not f_BeginUseLocator("","TreatmentPos",GL_STANCE_STAND,true) then
      7. return
      8. end

      Suche:


      Lua Source Code

      1. Sleep(2)
      2. StopAllAnimations("")
      3. MoveStop("")
      Ersetze mit (wir nehmen State_Duel, weil es zu Bugs kommt, wenn die Maßnahme unterbrochen wird)

      Lua Source Code

      1. Sleep(1)
      2. MeasureSetNotRestartable()
      3. SetState("",STATE_DUEL,true) -- no measure cancel

      Suche

      Lua Source Code

      1. local Costs = 50
      2. local Cured = false
      Füge darunter ein (Favormod Optional):

      Lua Source Code

      1. local Disease = false
      2. local CanHeal = false
      3. local Medicine, Label
      4. local FavorMod

      Eine große Überarbeitung der Behandlungsfunktion. Suche:

      Source Code

      1. --SPRAIN
      2. if GetImpactValue("SickSim0","Sprain")==1 then
      3. Costs = diseases_GetTreatmentCost("Sprain")
      4. if RemoveItems("Hospital","Bandage",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Bandage",1,INVENTORY_SELL)>0 then
      5. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      6. CreditMoney("Hospital",Costs,"Offering")
      7. MsgSay("","@L_MEDICUS_TREATMENT_DOC_SPRAIN")
      8. diseases_Sprain("SickSim0",false)
      9. Cured = true
      10. else
      11. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      12. AddItems("SickSim0","Bandage",1,INVENTORY_STD)
      13. end
      14. else
      15. --not enough mats
      16. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Bandage",false))
      17. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      18. AddImpact("Hospital","hospitalmessagesent",1,4)
      19. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      20. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      21. GetID("Hospital"),ItemGetLabel("Bandage",false))
      22. end
      23. end
      24. --COLD
      25. elseif GetImpactValue("SickSim0","Cold")==1 then
      26. Costs = diseases_GetTreatmentCost("Cold")
      27. if RemoveItems("Hospital","Bandage",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Bandage",1,INVENTORY_SELL)>0 then
      28. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      29. CreditMoney("Hospital",Costs,"Offering")
      30. MsgSay("","@L_MEDICUS_TREATMENT_DOC_COLD")
      31. diseases_Cold("SickSim0",false)
      32. Cured = true
      33. else
      34. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      35. AddItems("SickSim0","Bandage",1,INVENTORY_STD)
      36. end
      37. else
      38. --not enough mats
      39. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Bandage",false))
      40. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      41. AddImpact("Hospital","hospitalmessagesent",1,4)
      42. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      43. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      44. GetID("Hospital"),ItemGetLabel("Bandage",false))
      45. end
      46. end
      47. --INFLUENZA
      48. elseif GetImpactValue("SickSim0","Influenza")==1 then
      49. Costs = diseases_GetTreatmentCost("Influenza")
      50. if RemoveItems("Hospital","Medicine",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Medicine",1,INVENTORY_SELL)>0 then
      51. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      52. CreditMoney("Hospital",Costs,"Offering")
      53. MsgSay("","@L_MEDICUS_TREATMENT_DOC_INFLUENZA")
      54. diseases_Influenza("SickSim0",false)
      55. Cured = true
      56. else
      57. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      58. AddItems("SickSim0","Medicine",1,INVENTORY_STD)
      59. end
      60. else
      61. --not enough mats
      62. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Medicine",false))
      63. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      64. AddImpact("Hospital","hospitalmessagesent",1,4)
      65. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      66. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      67. GetID("Hospital"),ItemGetLabel("Medicine",false))
      68. end
      69. end
      70. --BURNWOUND
      71. elseif GetImpactValue("SickSim0","BurnWound")==1 then
      72. Costs = diseases_GetTreatmentCost("BurnWound")
      73. if RemoveItems("Hospital","Medicine",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Medicine",1,INVENTORY_SELL)>0 then
      74. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      75. CreditMoney("Hospital",Costs,"Offering")
      76. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      77. MsgSay("","@L_MEDICUS_TREATMENT_DOC_BURNWOUND")
      78. diseases_BurnWound("SickSim0",false)
      79. RemoveData("LayStill")
      80. Cured = true
      81. else
      82. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      83. AddItems("SickSim0","Medicine",1,INVENTORY_STD)
      84. end
      85. else
      86. --not enough mats
      87. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Medicine",false))
      88. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      89. AddImpact("Hospital","hospitalmessagesent",1,4)
      90. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      91. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      92. GetID("Hospital"),ItemGetLabel("Medicine",false))
      93. end
      94. end
      95. --POX
      96. elseif GetImpactValue("SickSim0","Pox")==1 then
      97. Costs = diseases_GetTreatmentCost("Pox")
      98. if RemoveItems("Hospital","Medicine",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Medicine",1,INVENTORY_SELL)>0 then
      99. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      100. CreditMoney("Hospital",Costs,"Offering")
      101. MsgSay("","@L_MEDICUS_TREATMENT_DOC_POX")
      102. diseases_Pox("SickSim0",false)
      103. Cured = true
      104. else
      105. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      106. AddItems("SickSim0","Medicine",1,INVENTORY_STD)
      107. end
      108. else
      109. --not enough mats
      110. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Medicine",false))
      111. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      112. AddImpact("Hospital","hospitalmessagesent",1,4)
      113. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      114. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      115. GetID("Hospital"),ItemGetLabel("Medicine",false))
      116. end
      117. end
      118. --PNEUMONA
      119. elseif GetImpactValue("SickSim0","Pneumonia")==1 then
      120. Costs = diseases_GetTreatmentCost("Pneumonia")
      121. if RemoveItems("Hospital","PainKiller",1,INVENTORY_STD)>0 or RemoveItems("Hospital","PainKiller",1,INVENTORY_SELL)>0 then
      122. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      123. CreditMoney("Hospital",Costs,"Offering")
      124. MsgSay("","@L_MEDICUS_TREATMENT_DOC_PNEUMONIA")
      125. diseases_Pneumonia("SickSim0",false)
      126. Cured = true
      127. else
      128. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      129. AddItems("SickSim0","PainKiller",1,INVENTORY_STD)
      130. end
      131. else
      132. --not enough mats
      133. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("PainKiller",false))
      134. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      135. AddImpact("Hospital","hospitalmessagesent",1,4)
      136. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      137. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      138. GetID("Hospital"),ItemGetLabel("PainKiller",false))
      139. end
      140. end
      141. --BLACKDEATH
      142. elseif GetImpactValue("SickSim0","Blackdeath")==1 then
      143. Costs = diseases_GetTreatmentCost("Blackdeath")
      144. if RemoveItems("Hospital","PainKiller",1,INVENTORY_STD)>0 or RemoveItems("Hospital","PainKiller",1,INVENTORY_SELL)>0 then
      145. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      146. CreditMoney("Hospital",Costs,"Offering")
      147. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      148. MsgSay("","@L_MEDICUS_TREATMENT_DOC_BLACKDEATH")
      149. diseases_Blackdeath("SickSim0",false)
      150. RemoveData("LayStill")
      151. Cured = true
      152. else
      153. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      154. AddItems("SickSim0","PainKiller",1,INVENTORY_STD)
      155. end
      156. else
      157. --not enough mats
      158. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("PainKiller",false))
      159. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      160. AddImpact("Hospital","hospitalmessagesent",1,4)
      161. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      162. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      163. GetID("Hospital"),ItemGetLabel("PainKiller",false))
      164. end
      165. end
      166. --FRACTURE
      167. elseif GetImpactValue("SickSim0","Fracture")==1 then
      168. Costs = diseases_GetTreatmentCost("Fracture")
      169. if RemoveItems("Hospital","PainKiller",1,INVENTORY_STD)>0 or RemoveItems("Hospital","PainKiller",1,INVENTORY_SELL)>0 then
      170. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      171. CreditMoney("Hospital",Costs,"Offering")
      172. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      173. MsgSay("","@L_MEDICUS_TREATMENT_DOC_FRACTURE")
      174. diseases_Fracture("SickSim0",false)
      175. RemoveData("LayStill")
      176. Cured = true
      177. else
      178. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      179. AddItems("SickSim0","PainKiller",1,INVENTORY_STD)
      180. end
      181. else
      182. --not enough mats
      183. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("PainKiller",false))
      184. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      185. AddImpact("Hospital","hospitalmessagesent",1,4)
      186. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      187. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      188. GetID("Hospital"),ItemGetLabel("PainKiller",false))
      189. end
      190. end
      191. --CARIES
      192. elseif GetImpactValue("SickSim0","Caries")==1 then
      193. Costs = diseases_GetTreatmentCost("Caries")
      194. if RemoveItems("Hospital","PainKiller",1,INVENTORY_STD)>0 or RemoveItems("Hospital","PainKiller",1,INVENTORY_SELL)>0 then
      195. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",Costs,"Offering") then
      196. CreditMoney("Hospital",Costs,"Offering")
      197. MsgSay("","@L_MEDICUS_TREATMENT_DOC_CARIES")
      198. diseases_Caries("SickSim0",false)
      199. Cured = true
      200. else
      201. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      202. AddItems("SickSim0","PainKiller",1,INVENTORY_STD)
      203. end
      204. else
      205. --not enough mats
      206. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("PainKiller",false))
      207. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      208. AddImpact("Hospital","hospitalmessagesent",1,4)
      209. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      210. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      211. GetID("Hospital"),ItemGetLabel("PainKiller",false))
      212. end
      213. end
      214. --ELSE (HP LOSS)
      215. elseif (GetHP("SickSim0") < GetMaxHP("SickSim0")) then
      216. if RemoveItems("Hospital","Bandage",1,INVENTORY_STD)>0 or RemoveItems("Hospital","Bandage",1,INVENTORY_SELL)>0 then
      217. local ToHeal = GetMaxHP("SickSim0") - GetHP("SickSim0")
      218. if IsPartyMember("SickSim0")==false or SpendMoney("SickSim0",ToHeal,"Offering") then
      219. CreditMoney("Hospital",ToHeal,"Offering")
      220. MsgSay("","@L_MEDICUS_TREATMENT_DOC_HPLOSS")
      221. ModifyHP("SickSim0",ToHeal,true)
      222. Cured = true
      223. else
      224. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      225. AddItems("SickSim0","Bandage",1,INVENTORY_STD)
      226. end
      227. else
      228. --not enough mats
      229. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel("Bandage",false))
      230. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      231. AddImpact("Hospital","hospitalmessagesent",1,4)
      232. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      233. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      234. GetID("Hospital"),ItemGetLabel("Bandage",false))
      235. end
      236. end
      237. else
      238. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOTHING")
      239. end
      Display All
      Ersetze mit (Enthält Minimod: Gunst fürs Behandeln:

      Source Code

      1. --SPRAIN
      2. if GetImpactValue("SickSim0","Sprain")==1 then
      3. Disease = "Sprain"
      4. Medicine = "Bandage"
      5. FavorMod = 5
      6. Label = "SPRAIN"
      7. --COLD
      8. elseif GetImpactValue("SickSim0","Cold")==1 then
      9. Disease = "Cold"
      10. Medicine = "Bandage"
      11. FavorMod = 5
      12. Label = "COLD"
      13. --INFLUENZA
      14. elseif GetImpactValue("SickSim0","Influenza")==1 then
      15. Disease = "Influenza"
      16. Medicine = "Medicine"
      17. FavorMod = 5
      18. Label = "INFLUENZA"
      19. --FRACTURE
      20. elseif GetImpactValue("SickSim0","Fracture")==1 then
      21. Disease = "Fracture"
      22. Medicine = "PainKiller"
      23. FavorMod = 10
      24. Label = "FRACTURE"
      25. --BURNWOUND
      26. elseif GetImpactValue("SickSim0","BurnWound")==1 then
      27. Disease = "BurnWound"
      28. Medicine = "Salve"
      29. FavorMod = 10
      30. Label = "BURNWOUND"
      31. --POX
      32. elseif GetImpactValue("SickSim0","Pox")==1 then
      33. Disease = "Pox"
      34. Medicine = "Medicine"
      35. FavorMod = 10
      36. Label = "POX"
      37. --CARIES
      38. elseif GetImpactValue("SickSim0","Caries")==1 then
      39. Disease = "Caries"
      40. Medicine = "PainKiller"
      41. FavorMod = 10
      42. Label = "CARIES"
      43. --PNEUMONIA
      44. elseif GetImpactValue("SickSim0","Pneumonia")==1 then
      45. Disease = "Pneumonia"
      46. Medicine = "PainKiller"
      47. FavorMod = 15
      48. Label = "PNEUMONIA"
      49. --BLACKDEATH
      50. elseif GetImpactValue("SickSim0","Blackdeath")==1 then
      51. Disease = "Blackdeath"
      52. Medicine = "PainKiller"
      53. FavorMod = 15
      54. Label = "BLACKDEATH"
      55. --ELSE (HP LOSS)
      56. elseif (GetHP("SickSim0") < GetMaxHP("SickSim0")) then
      57. Medicine = "Salve"
      58. FavorMod = 5
      59. Label = "HPLOSS"
      60. -- NOTHING
      61. else
      62. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOTHING")
      63. Cured = true
      64. SimResetBehavior("SickSim0")
      65. RemoveProperty("SickSim0","WaitingForTreatment")
      66. end
      67. if Cured == false then
      68. -- TREATMENT
      69. if Disease == false then -- special case HP LOSS
      70. Costs = GetMaxHP("SickSim0") - GetHP("SickSim0")
      71. else
      72. Costs = diseases_GetTreatmentCost(Disease)
      73. end
      74. local NumOfMeds = 0
      75. if GetItemCount("Hospital",Medicine,INVENTORY_STD)>0 then
      76. CanHeal = 1
      77. elseif GetItemCount("Hospital",Medicine,INVENTORY_SELL)>0 then
      78. CanHeal = 2
      79. elseif HasProperty("Hospital",Medicine.."s") and GetProperty("Hospital",Medicine.."s")>0 then
      80. NumOfMeds = GetProperty("Hospital",Medicine.."s")
      81. CanHeal = 3
      82. end
      83. if CanHeal ~= false then
      84. if DynastyIsPlayer("SickSim0") then
      85. -- only Players need to pay
      86. if SpendMoney("SickSim0",Costs,"Offering") then
      87. -- remove medicine
      88. if CanHeal == 1 then
      89. RemoveItems("Hospital",Medicine,1,INVENTORY_STD)
      90. elseif CanHeal == 2 then
      91. RemoveItems("Hospital",Medicine,1,INVENTORY_SELL)
      92. elseif CanHeal == 3 then
      93. SetProperty("Hospital",Medicine.."s",(NumOfMeds-1))
      94. end
      95. CreditMoney("Hospital",Costs,"Offering")
      96. -- for the balance
      97. local TotalIncome = 0
      98. if HasProperty("Hospital", "TotalIncome") then
      99. TotalIncome = GetProperty("Hospital","TotalIncome")
      100. end
      101. local RoundIncome = 0
      102. if HasProperty("Hospital", "RoundIncome") then
      103. RoundIncome = GetProperty("Hospital","RoundIncome")
      104. end
      105. local MedicalIncome = 0
      106. if HasProperty("Hospital", "MedicalIncome") then
      107. MedicalIncome = GetProperty("Hospital","MedicalIncome")
      108. end
      109. SetProperty("Hospital", "TotalIncome",(TotalIncome+Costs))
      110. SetProperty("Hospital", "RoundIncome",(RoundIncome+Costs))
      111. SetProperty("Hospital", "MedicalIncome",(MedicalIncome+Costs))
      112. MsgSay("","@L_MEDICUS_TREATMENT_DOC_"..Label)
      113. if Disease == "Sprain" then
      114. diseases_Sprain("SickSim0",false)
      115. elseif Disease == "Cold" then
      116. diseases_Cold("SickSim0",false)
      117. elseif Disease == "Influenza" then
      118. diseases_Influenza("SickSim0",false)
      119. elseif Disease == "Fracture" then
      120. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      121. diseases_Fracture("SickSim0",false)
      122. elseif Disease == "BurnWound" then
      123. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      124. diseases_BurnWound("SickSim0",false)
      125. elseif Disease == "Pox" then
      126. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      127. diseases_Pox("SickSim0",false)
      128. elseif Disease == "Caries" then
      129. diseases_Caries("SickSim0", false)
      130. elseif Disease == "Pneumonia" then
      131. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      132. diseases_Pneumonia("SickSim0", false)
      133. elseif Disease == "Blackdeath" then
      134. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      135. diseases_Blackdeath("SickSim0",false)
      136. -- 120 hours immunity to stop black death
      137. AddImpact("SickSim0","PlagueImmunity",1,120)
      138. else
      139. local ToHeal = GetMaxHP("SickSim0") - GetHP("SickSim0")
      140. ModifyHP("SickSim0",ToHeal,true)
      141. end
      142. if HasData("LayStill") then
      143. RemoveData("LayStill")
      144. end
      145. -- modify the favor to the boss
      146. if BuildingGetOwner("Hospital","MyBoss") then
      147. chr_ModifyFavor("SickSim0","MyBoss",FavorMod)
      148. end
      149. Cured = true
      150. else
      151. -- no money
      152. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMONEY")
      153. end
      154. else
      155. -- heal the AI
      156. -- remove medicine
      157. if CanHeal == 1 then
      158. RemoveItems("Hospital",Medicine,1,INVENTORY_STD)
      159. elseif CanHeal == 2 then
      160. RemoveItems("Hospital",Medicine,1,INVENTORY_SELL)
      161. elseif CanHeal == 3 then
      162. SetProperty("Hospital",Medicine.."s",(GetProperty("Hospital",Medicine.."s")-1))
      163. end
      164. CreditMoney("Hospital",Costs,"Offering")
      165. -- for the balance
      166. local TotalIncome = 0
      167. if HasProperty("Hospital", "TotalIncome") then
      168. TotalIncome = GetProperty("Hospital","TotalIncome")
      169. end
      170. local RoundIncome = 0
      171. if HasProperty("Hospital", "RoundIncome") then
      172. RoundIncome = GetProperty("Hospital","RoundIncome")
      173. end
      174. local MedicalIncome = 0
      175. if HasProperty("Hospital", "MedicalIncome") then
      176. MedicalIncome = GetProperty("Hospital","MedicalIncome")
      177. end
      178. SetProperty("Hospital", "TotalIncome",(TotalIncome+Costs))
      179. SetProperty("Hospital", "RoundIncome",(RoundIncome+Costs))
      180. SetProperty("Hospital", "MedicalIncome",(MedicalIncome+Costs))
      181. MsgSay("","@L_MEDICUS_TREATMENT_DOC_"..Label)
      182. if Disease == "Sprain" then
      183. diseases_Sprain("SickSim0",false)
      184. elseif Disease == "Cold" then
      185. diseases_Cold("SickSim0",false)
      186. elseif Disease == "Influenza" then
      187. diseases_Influenza("SickSim0",false)
      188. elseif Disease == "Fracture" then
      189. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      190. diseases_Fracture("SickSim0",false)
      191. elseif Disease == "BurnWound" then
      192. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      193. diseases_BurnWound("SickSim0",false)
      194. elseif Disease == "Pox" then
      195. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      196. diseases_Pox("SickSim0",false)
      197. elseif Disease == "Caries" then
      198. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      199. diseases_Caries("SickSim0", false)
      200. elseif Disease == "Pneumonia" then
      201. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      202. diseases_Pneumonia("SickSim0", false)
      203. elseif Disease == "Blackdeath" then
      204. ms_medicaltreatment_LayToBed("","SickSim0",BedNumber)
      205. diseases_Blackdeath("SickSim0",false)
      206. else
      207. local ToHeal = GetMaxHP("SickSim0") - GetHP("SickSim0")
      208. ModifyHP("SickSim0",ToHeal,true)
      209. end
      210. if HasData("LayStill") then
      211. RemoveData("LayStill")
      212. end
      213. -- modify the favor to the boss
      214. if BuildingGetOwner("Hospital","MyBoss") then
      215. chr_ModifyFavor("SickSim0","MyBoss",FavorMod)
      216. end
      217. Cured = true
      218. end
      219. else
      220. --not enough mats
      221. MsgSay("","@L_MEDICUS_TREATMENT_DOC_NOMATS",ItemGetLabel(Medicine,false))
      222. if GetImpactValue("Hospital","hospitalmessagesent")==0 then
      223. AddImpact("Hospital","hospitalmessagesent",1,4)
      224. feedback_MessageWorkshop("Hospital","@L_MEDICUS_TREATMENT_MSG_NOMATS_HEAD_+0",
      225. "@L_MEDICUS_TREATMENT_MSG_NOMATS_BODY_+0",
      226. GetID("Hospital"),ItemGetLabel(Medicine,false))
      227. end
      228. end
      229. end
      Display All
      Suche

      Lua Source Code

      1. if HasProperty("SickSim0","WaitingForTreatment") then
      2. RemoveProperty("SickSim0","WaitingForTreatment")
      3. end
      4. SetData("Blocked", 1)
      5. Sleep(10)
      Ersetze mit (State_Duel aufheben, SleepZeit reduzieren)

      Lua Source Code

      1. if HasProperty("SickSim0","WaitingForTreatment") then
      2. RemoveProperty("SickSim0","WaitingForTreatment")
      3. end
      4. end
      5. SetData("Blocked", 1)
      6. Sleep(2)
      7. SetState("",STATE_DUEL,false)

      Suche

      Lua Source Code

      1. function BlockMe()
      2. while GetData("Blocked")~=1 do
      3. Sleep(0.8)
      4. end
      5. Sleep(3)
      6. f_ExitCurrentBuilding("")
      7. if DynastyIsAI("") then
      8. SimSetBehavior("","idle")
      9. end
      10. end
      Ersetze mit

      Lua Source Code

      1. function BlockMe()
      2. while GetData("Blocked")~=1 do
      3. Sleep(1)
      4. if not GetState("", STATE_DUEL) then
      5. SetState("", STATE_DUEL, true)
      6. end
      7. end
      8. if HasProperty("", "WaitingForTreatment") then
      9. RemoveProperty("", "WaitingForTreatment")
      10. end
      11. SetState("", STATE_DUEL, false)
      12. CreateScriptcall("SendHome", 0.001, "Measures/ms_MedicalTreatment.lua", "LeaveBuilding", "")
      13. return
      14. end
      15. function LeaveBuilding()
      16. f_ExitCurrentBuilding("")
      17. if DynastyIsAI("") then
      18. if Rand(2) == 0 then
      19. f_Stroll("", 1000, 6)
      20. else
      21. idlelib_GoHome()
      22. end
      23. end
      24. end
      Display All
      Suche:

      Lua Source Code

      1. AlignTo(Doc, SickSim)
      2. Sleep(1)
      3. PlayAnimation(Doc,"treatpatientinbed_01")
      4. f_EndUseLocator(Doc,"TreatmentPos",GL_STANCE_STAND)
      5. f_EndUseLocator(SickSim,"BedPos",GL_STANCE_LAY)
      Ersetze mit:

      Lua Source Code

      1. AlignTo(Doc, SickSim)
      2. Sleep(0.5)
      3. PlayAnimation(Doc, "treatpatientinbed_01")
      4. Sleep(0.5)
      5. f_EndUseLocator(Doc, "TreatmentPos", GL_STANCE_STAND)
      6. Sleep(0.5)
      Suche:

      Lua Source Code

      1. function CleanUp()
      2. RemoveData("LayStill")
      3. StopAnimation("")
      4. if HasProperty("","Bored") then
      5. RemoveProperty("","Bored")
      6. end
      7. if HasProperty("", "BigBrother") then
      8. RemoveProperty("","BigBrother")
      9. end
      10. end
      Ersetze mit

      Lua Source Code

      1. function CleanUp()
      2. SetData("Blocked",1)
      3. if HasData("BedNumber") then
      4. RemoveProperty("Hospital","Locator"..(GetData("BedNumber")))
      5. RemoveData("BedNumber")
      6. end
      7. RemoveData("LayStill")
      8. StopAnimation("")
      9. f_EndUseLocator("", "TreatmentPos", GL_STANCE_STAND)
      10. if HasProperty("", "BigBrother") then
      11. RemoveProperty("", "BigBrother")
      12. end
      13. SetState("", STATE_DUEL, false)
      14. if AliasExists("SickSim0") then
      15. SetState("SickSim0", STATE_DUEL, false)
      16. end
      17. end
      Display All