A Veritable Menagerie of Talent Modding Issues

Moderator: Moderator

Post Reply
Message
Author
Jason K.
Low Yeek
Posts: 5
Joined: Sun Mar 08, 2020 11:30 pm

A Veritable Menagerie of Talent Modding Issues

#1 Post by Jason K. »

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: Select all

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: Select all

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: Select all

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)

Razakai
Uruivellas
Posts: 889
Joined: Tue May 14, 2013 3:45 pm

Re: A Veritable Menagerie of Talent Modding Issues

#2 Post by Razakai »

For instant use,

Code: Select all

	no_energy=true,
Should be fine.

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

Code: Select all

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?

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: A Veritable Menagerie of Talent Modding Issues

#3 Post by HousePet »

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.

Jason K.
Low Yeek
Posts: 5
Joined: Sun Mar 08, 2020 11:30 pm

Re: A Veritable Menagerie of Talent Modding Issues

#4 Post by Jason K. »

Attached is the current version.
Attachments
Possessors 2.0.zip
(2.39 KiB) Downloaded 743 times

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: A Veritable Menagerie of Talent Modding Issues

#5 Post by HousePet »

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: Select all

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.

Jason K.
Low Yeek
Posts: 5
Joined: Sun Mar 08, 2020 11:30 pm

Re: A Veritable Menagerie of Talent Modding Issues

#6 Post by Jason K. »

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.
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.
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.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: A Veritable Menagerie of Talent Modding Issues

#7 Post by HousePet »

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.

Post Reply