Guest User

confusion

a guest
May 11th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.44 KB | None | 0 0
  1.  
  2.  
  3.  
  4. straight from iron will talent, i just added the confusion code to match the stun code:
  5.  
  6. passives = function(self, t, p)
  7.         self:talentTemporaryValue(p, "confusion_immune", t.confusionImmune(self, t))
  8.         self:talentTemporaryValue(p, "stun_immune", t.stunImmune(self, t))
  9.     end,
  10.     info = function(self, t)
  11.         return ([[Dual-self mental sturdiness improves Mental Saves by %d, and confusion and stun immunity by %d%%.]]):
  12.         format(self:getTalentLevelRaw(t)*6, t.confusionImmune(self, t)*100, t.stunImmune(self, t)*100)
  13.     end,
  14.    
  15.    
  16.     Result = nil value error:
  17.    
  18.     Lua Error: /data-Chrono_Xorn/talents/Chrono_Xorn.lua:533: attempt to call field 'confusionImmune' (a nil value)
  19.     At [C]:-1 confusionImmune
  20.     At /data-Chrono_Xorn/talents/Chrono_Xorn.lua:533 passives
  21.     At /engine/interface/ActorTalents.lua:435 learnTalent
  22.     At /mod/class/Actor.lua:4065 learnTalent
  23.     At /engine/Birther.lua:369 apply
  24.     At /mod/dialogs/Birther.lua:292 fct
  25.     At /mod/dialogs/Birther.lua:191 checkNew
  26.     At /mod/dialogs/Birther.lua:241 atEnd
  27.     At /mod/dialogs/Birther.lua:63 fct
  28.     At /engine/ui/Button.lua:62 fct
  29.     At /engine/Mouse.lua:56 receiveMouse
  30.     At /engine/Mouse.lua:94 delegate
  31.     At /engine/ui/Dialog.lua:602 mouseEvent
  32.     At /engine/ui/Dialog.lua:343 fct
  33.     At /engine/Mouse.lua:56
  34.    
  35.    
  36.     and this is the mental timed effects confusion code in the game:
  37.    
  38.    
  39. newEffect{
  40.     name = "CONFUSED", image = "effects/confused.png",
  41.     desc = "Confused",
  42.     long_desc = function(self, eff) return ("The target is confused, acting randomly (chance %d%%) and unable to perform complex actions."):format(eff.power) end,
  43.     type = "mental",
  44.     subtype = { confusion=true },
  45.     status = "detrimental",
  46.     parameters = { power=50 },
  47.     on_gain = function(self, err) return "#Target# wanders around!.", "+Confused" end,
  48.     on_lose = function(self, err) return "#Target# seems more focused.", "-Confused" end,
  49.     activate = function(self, eff)
  50.         eff.power = math.floor(math.max(eff.power - (self:attr("confusion_immune") or 0) * 100, 10))
  51.         eff.power = util.bound(eff.power, 0, 50)
  52.         eff.tmpid = self:addTemporaryValue("confused", eff.power)
  53.         if eff.power <= 0 then eff.dur = 0 end
  54.     end,
  55.     deactivate = function(self, eff)
  56.         self:removeTemporaryValue("confused", eff.tmpid)
  57.         if self == game.player and self.updateMainShader then self:updateMainShader() end
  58.     end,
  59. }
  60.  
  61. and my talent which is needed because having a zillion bloated horrors dropping confusion on me all at once became just bad:
  62.  
  63.  
  64. newTalent{
  65.     short_name = "2_MIND",
  66.     name = "2 Mountains Mind",
  67.     --code adapted from iron will
  68.     type = {"race/Chrono_Xorn", 1},
  69.     image = "talents/overseer_of_nations.png",
  70.     require = psi_wil_req3,
  71.     points = 5,
  72.     no_npc_use = true,
  73.     no_unlearn_last = true,
  74.     mode = "passive",
  75.     stunImmune = function(self, t) return self:combatTalentLimit(t, 1, 0.17, 0.50) end,
  76.     on_learn = function(self, t)
  77.         self.combat_mentalresist = self.combat_mentalresist + 6
  78.     end,
  79.     on_unlearn = function(self, t)
  80.         self.combat_mentalresist = self.combat_mentalresist - 6
  81.     end,
  82.     passives = function(self, t, p)
  83.         self:talentTemporaryValue(p, "confusion_immune", t.confusionImmune(self, t))
  84.         self:talentTemporaryValue(p, "stun_immune", t.stunImmune(self, t))
  85.     end,
  86.     info = function(self, t)
  87.         return ([[Dual-self mental sturdiness improves Mental Saves by %d, and confusion and stun immunity by %d%%.]]):
  88.         format(self:getTalentLevelRaw(t)*6, t.confusionImmune(self, t)*100, t.stunImmune(self, t)*100)
  89.     end,
  90. }
  91.  
  92.  
  93. what is confusing it?
Advertisement
Add Comment
Please, Sign In to add comment