little help please

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Poe
Wayist
Posts: 20
Joined: Sun Aug 14, 2011 6:23 pm

little help please

#1 Post by Poe »

Hi, I have no knowledge of coding, but trying to stumble through making an add-on.
when I activate this sustain (cobbled together from other sustains)
newTalent{
name = "Tiger Form",
type = {"wild-gift/tiger", 1},
require = gifts_req1,
points = 5,
cooldown = 10,
mode = "sustained",
sustain_equilibrium = 15,
getDam = function(self, t) return self:combatScale(self:getWil(7, true) * self:getTalentLevel(t), 5, 0, 40, 35)end,
getSpeed = function(self, t) return self:combatTalentScale(t, 0.15, 0.5, 0.75) end,
getPower = function(self, t) return math.ceil(self:combatTalentScale(t, 1.5, 7.5, 0.75) + self:combatTalentStatDamage(t, "wil", 5, 20)) end,
activate = function(self, t)
return {
stats = self:addTemporaryValue("inc_stats", {[self.STAT_STR] = t.getPower(self, t),
[self.STAT_DEX] = t.getPower(self, t),
}),
ps = self:talentTemporaryValue("combat_physspeed", t.getSpeed(self, t)),
dam = self:addTemporaryValue("combat_dam", t.getDam(self, t)),
mentalresist = self:addTemporaryValue("combat_mentalresist", -10),
-- self.replace_display = mod.class.Actor.new{image = "npc/tiger-form.png"},
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("inc_stats", p.stats)
self:removeTemporaryValue("combat_physspeed", p.ps)
self:removeTemporaryValue("combat_dam", p.dam)
self:removeTemporaryValue("combat_mentalresist", p.mentalresist)
-- self:replace_display = nil
return true
end,
info = function(self, t)
return([[Assume the aspect of a monstrous tiger]])
end
}
i keep getting this error
Lua Error: /engine/interface/ActorTalents.lua:232: /engine/interface/ActorTalents.lua:796: attempt to index local 'p' (a string value)

and i cannot see why, i mean i don't really understand the code very well, so , give us a hint.

Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Re: little help please

#2 Post by Hachem_Muche »

In your activate function, you're using

ps = self:talentTemporaryValue(...

which should be

ps = self:addTemporaryValue(...

Also, your code is much more readable if you enclose it in a code box:

Code: Select all

newTalent{
	name = "Tiger Form",
	type = {"wild-gift/tiger", 1},
	require = gifts_req1,
	points = 5,
	cooldown = 10,
	mode = "sustained",
	sustain_equilibrium = 15,
	getDam = function(self, t) return self:combatScale(self:getWil(7, true) * self:getTalentLevel(t), 5, 0, 40, 35) end,
	getSpeed = function(self, t) return self:combatTalentScale(t, 0.15, 0.5, 0.75) end,
	getPower = function(self, t) return math.ceil(self:combatTalentScale(t, 1.5, 7.5, 0.75) + self:combatTalentStatDamage(t, "wil", 5, 20)) end,
	activate = function(self, t)
		return {
		stats = self:addTemporaryValue("inc_stats", {[self.STAT_STR] = t.getPower(self, t),
		[self.STAT_DEX] = t.getPower(self, t),
		}),
		ps = self:talentTemporaryValue("combat_physspeed", t.getSpeed(self, t)),
		dam = self:addTemporaryValue("combat_dam", t.getDam(self, t)),
		mentalresist = self:addTemporaryValue("combat_mentalresist", -10),
		-- self.replace_display = mod.class.Actor.new{image = "npc/tiger-form.png"},
		}
	end,
	deactivate = function(self, t, p)
		self:removeTemporaryValue("inc_stats", p.stats)
		self:removeTemporaryValue("combat_physspeed", p.ps)
		self:removeTemporaryValue("combat_dam", p.dam)
		self:removeTemporaryValue("combat_mentalresist", p.mentalresist)
		-- self:replace_display = nil
		return true
	end,
	info = function(self, t)
		return([[Assume the aspect of a monstrous tiger]])
	end
}
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

Poe
Wayist
Posts: 20
Joined: Sun Aug 14, 2011 6:23 pm

Re: little help please

#3 Post by Poe »

Cheers man, I must have read that about 20 times but never saw it, still, i'll check it next time won't I.
Thanks again.

Post Reply