ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Jul 16, 2020 12:21 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Mar 09, 2020 12:26 am 
Offline
Low Yeek

Joined: Sun Mar 08, 2020 11:30 pm
Posts: 5
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)


Top
 Profile  
 
PostPosted: Wed Mar 11, 2020 8:37 am 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 888
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?


Top
 Profile  
 
PostPosted: Wed Mar 11, 2020 10:35 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 6108
How/where are you doing all this code?

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

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Thu Mar 12, 2020 2:42 am 
Offline
Low Yeek

Joined: Sun Mar 08, 2020 11:30 pm
Posts: 5
Attached is the current version.


Attachments:
Possessors 2.0.zip [2.39 KiB]
Downloaded 36 times
Top
 Profile  
 
PostPosted: Thu Mar 12, 2020 6:42 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 6108
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

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Wed Mar 18, 2020 4:07 am 
Offline
Low Yeek

Joined: Sun Mar 08, 2020 11:30 pm
Posts: 5
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.


Top
 Profile  
 
PostPosted: Wed Mar 18, 2020 5:30 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 6108
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.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group