ToME: the Tales of Maj'Eyal
http://forums.te4.org/

A Veritable Menagerie of Talent Modding Issues
http://forums.te4.org/viewtopic.php?f=45&t=50777
Page 1 of 1

Author:  Jason K. [ Mon Mar 09, 2020 12:26 am ]
Post subject:  A Veritable Menagerie of Talent Modding Issues

This is my first time working in Lua. I've gotten my other changes to work, just not these three. These are all in regards to adjustments to the Possessor class.

First, I tried to turn T_ASSUME_FORM into an instant action. "no_energy = true" didn't seem to work, neither did cribbing "no_energy = true" + energy reset from T_QUICK_SHOT, nor did setting the speedtype to special_combat (used elsewhere). So how can a skill be defined as an instant action?

Second, I tried to change the range of T_POSSESS from a fixed value to a talent level driven value (cribbing the method from other skills). Changes to the range value appear to be being ignored/overwritten and I do not know why. Even setting the value to a different number doesn't affect the range in-game.

New range setting:
Code:
TD.T_POSSESS.Range = function(self, t) return 3 + math.floor(self:getTalentLevel(t) * 0.5 - 0.5) end


Finally: I tried to change the description of T_POSSESS to remove references to creature type limits.

Original code:
Code:
info = function(self, t)
      local fake = {rank=2}
      local rt0, rc0 = self.TextRank(fake)
      fake.rank = 3; local rt3, rc3 = self.TextRank(fake)
      fake.rank = 3.5; local rt5, rc5 = self.TextRank(fake)
      fake.rank = 4; local rt7, rc7 = self.TextRank(fake)

      return ([[You cast a psionic web at a target that lasts for %d turns. Each turn it deals %0.2f mind damage.
      If the target dies with the web in place you will capture its body and store it in a hidden psionic reserve.
      At any further time you can use the Assume Form talent to temporarily shed your own body and assume your new form, strengths and weaknesses both.
      You may only use this power if you have room for a new body in your storage.

      You may only steal the body of creatures of the following rank %s%s#LAST# or lower.
      At level 3 up to rank %s%s#LAST#.
      At level 5 up to rank %s%s#LAST#.
      At level 7 up to rank %s%s#LAST#.

      You may only steal the body of creatures of the following types: #LIGHT_BLUE#%s#LAST#
      When you try to possess a creature of a different type you may learn this type permanently, you can do that %d more times.]]):
      format(
         t.getDur(self, t), damDesc(self, DamageType.MIND, t.getDamage(self, t)),
         rc0, rt0, rc3, rt3, rc5, rt5, rc7, rt7,
         table.concat(table.append({"humanoid", "animal"}, table.keys(self.possess_allowed_extra_types or {})), ", "), t.allowedTypesExtraNb(self, t)
      )
   end,



New Code:
Code:
TD.T_POSSESS.info = function(self, t)
   local fake = {rank=2}
   local rt0, rc0 = self.TextRank(fake)
   fake.rank = 3; local rt3, rc3 = self.TextRank(fake)
   fake.rank = 3.5; local rt5, rc5 = self.TextRank(fake)
   fake.rank = 4; local rt7, rc7 = self.TextRank(fake)

   return ([[You cast a psionic web at a target that lasts for %d turns. Each turn it deals %0.2f mind damage.
   If the target dies with the web in place you will capture its body and store it in a hidden psionic reserve.
   At any further time you can use the Assume Form talent to temporarily shed your own body and assume your new form, strengths and weaknesses both.
   You may only use this power if you have room for a new body in your storage.

   You may only steal the body of creatures of the following rank %s%s#LAST# or lower.
   At level 3 up to rank %s%s#LAST#.
   At level 5 up to rank %s%s#LAST#.
   At level 7 up to rank %s%s#LAST#.]]):
      format(
         t.getDur(self, t), damDesc(self, DamageType.MIND, t.getDamage(self, t)),
         rc0, rt0, rc3, rt3, rc5, rt5, rc7, rt7
      )
end


This new code trips an error of 'attempt to call global 'damDesc' (a nil value)'. The only place I have found damDesc defined is in the data\talents.lua in the tome-1.6.7 addon files. I am unsure how to link this function call to that function (or even if that is what I should be doing)

Author:  Razakai [ Wed Mar 11, 2020 8:37 am ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

For instant use,

Code:
   no_energy=true,


Should be fine.

For the last one, under talents.lua I tend to set damdesc as so:

Code:
damDesc = function(self, type, dam)
   -- Increases damage
   if self.inc_damage then
   local inc = self:combatGetDamageIncrease(type)
   dam = dam + (dam * inc / 100)
   end
   return dam
end


I think you're supposed to import it another way, but don't have that code to hand.

As a bunch of your talents aren't working, it sounds like it's less a problem with your code and more that your modules aren't being called correctly. Can you zip up and attach the addon?

Author:  HousePet [ Wed Mar 11, 2020 10:35 pm ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

How/where are you doing all this code?

I've somehow got a damDesc call working fine, even though I haven't redefined it.

Author:  Jason K. [ Thu Mar 12, 2020 2:42 am ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

Attached is the current version.

Attachments:
Possessors 2.0.zip [2.39 KiB]
Downloaded 23 times

Author:  HousePet [ Thu Mar 12, 2020 6:42 am ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

Okay, I have defined a damDesc for myself, I just forgot where it was. Its a local function. Just make yourself one.

I can't see any reason the no_energy on Assume Form wouldn't work. However, the
TD.T_ASSUME_FORM.speed_type = special_combat
line above can't possibly do anything good. special_combat does not exist in this scope, or as a speed type.

Your range change on Possess will not be working because you have changed "Range", not "range".

As for the damDesc, still this at the top of you load file:
Code:
damDesc = function(self, type, dam)
   -- Increases damage
   if self.inc_damage then
      local inc = (self.inc_damage.all or 0) + (self.inc_damage[type] or 0)
      dam = dam + (dam * inc / 100)
   end
   return dam
end

Author:  Jason K. [ Wed Mar 18, 2020 4:07 am ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

Quote:
I can't see any reason the no_energy on Assume Form wouldn't work. However, the
TD.T_ASSUME_FORM.speed_type = special_combat
line above can't possibly do anything good. special_combat does not exist in this scope, or as a speed type.


I tried just 'no_energy = true' first. I had been testing by getting targeted by a hostile, then casting assume form. Whenever I cast it, the hostile immediately took a turn. Though now when I try it, it works. Hrm. The joys of cargo-cult coding.

Quote:
Your range change on Possess will not be working because you have changed "Range", not "range".


Gah. Caught by the case sensitivity. Fixing that corrected the range not changing with rank. Thanks.

Quote:
Okay, I have defined a damDesc for myself, I just forgot where it was. Its a local function. Just make yourself one.


That worked. For design reasons, I am not thrilled with the idea of having to rebuild all local functions. The original possession addon manages to call that local function without redefining it. Maybe an init issue? I'll do some more digging.

Author:  HousePet [ Wed Mar 18, 2020 5:30 am ]
Post subject:  Re: A Veritable Menagerie of Talent Modding Issues

I don't actually define damDesc inside my talent category files. I define it in the file that then loads all my talent category files. So it inherits it from that. (Which is pretty much how it works for the vanilla game anyway.)

However, you are just running your changes via one file. So you shouldn't worry too much about it.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/