Addon Idea/Coding Question: Talents require stat hardpoints

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
sajberhippien
Halfling
Posts: 114
Joined: Thu Jan 14, 2016 11:10 am

Addon Idea/Coding Question: Talents require stat hardpoints

#1 Post by sajberhippien »

I personally would enjoy the game a fair bit more if juggling dozens of stat-boosting pieces of equipment wasn't encouraged as much. Due to this, I tried and failed to make an addon that makes the stat requirements of talents be based on the "base" stat instead of the "current" stat, so that the main way to access them is through investing points.

It seems like it should be a fairly simple process in ActorTalents.Lua, but I know nearly nothing of LUA and very little about scripting in eneral, so my attempts failed.

If anyone has time and wish to make such an addon it'd be greatly appreciated, at least by me! :)

EDIT: Alteratively, if anyone can tell me how to call on the base stat instead of the increased stat in ActorTalents I guess I should be able to do it on my own. Ive tried using getStat(s, no_inc) and various other variants of getStat, but it won't work and to me it seems getStat scaling will always return the scaling value (looking at ActorStats, isnt the used forumla basically stat*scale/stat? That returns scale, every time.

Sorry for spelling so badly, bf had to take my laptop (only comp with internet atm) to the college so im stuck with this phone and a whole day of attempting to learn LUA offline, lol.

Thanks for any help!

EDIT2: Fixed spelling.
Last edited by sajberhippien on Wed Feb 17, 2016 6:00 pm, edited 2 times in total.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#2 Post by astralInferno »

This would actually be a pretty massive nerf. I wouldn't recommend doing it without also lowering talent requirements or raising stat gains.

sajberhippien
Halfling
Posts: 114
Joined: Thu Jan 14, 2016 11:10 am

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#3 Post by sajberhippien »

astralInferno wrote:This would actually be a pretty massive nerf. I wouldn't recommend doing it without also lowering talent requirements or raising stat gains.
Yes, making the game harder is definately an effect, one that I don't mind though; I'd rather play normal (or even easy) with that than nightmare without, so to speak. It's also why I suggested it as an addon, rather than posting in the "idea" subforum; I'm not saying it should be implemented in the base game, but just that I'd enjoy it as an addon.

That said, yes, if I understand how to work the code (been at it on and off throughout the day, but so far to no success; I can make talents and races and stuff, but I still have no idea how to call on the base stat rather than the modified one) I intended to also somewhat lower talent requirements and/or put in alternate stat requirements.

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

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#4 Post by HousePet »

I don't see an issue with an addon making the game harder.

I can't easily dig in the code at the moment, but I'll do it tonight if I remember and you haven't worked it out then.
My feedback meter decays into coding. Give me feedback and I make mods.

sajberhippien
Halfling
Posts: 114
Joined: Thu Jan 14, 2016 11:10 am

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#5 Post by sajberhippien »

Thanks, that would be greatly appreciated! :D

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

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#6 Post by HousePet »

You want actor:getStat(s, nil, false, true), or actor.stats[s] (but this is naughty).
My feedback meter decays into coding. Give me feedback and I make mods.

sajberhippien
Halfling
Posts: 114
Joined: Thu Jan 14, 2016 11:10 am

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#7 Post by sajberhippien »

Thanks a lot for the help, but unfortunately I still don't get it to work; the self:getStat(s, nil, false, true) causes this error, while using "local rawstat = self.stats[s]" and then calling for that in the calculation causes this error instead. Am I using the commands wrong?

Code: Select all

	if rawget(t, "require") then
		local req = t.require
		local rawstat = self.stats[s]
		if type(req) == "function" then req = req(self, t) end
		local tlev = self:getTalentLevelRaw(t) + (offset or 1)

		-- Obviously this requires the ActorStats interface
		if req.stat then
			for s, v in pairs(req.stat) do
				v = util.getval(v, tlev)
				if self.rawstat(s) < v then return nil, "not enough stat" end
			end
		end
Here's the code from ActorTalents; I've tried defining local rawstat with either self.stats[s] or self:getStat(s, nil, false, true) and those above are the errors I get.

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

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#8 Post by HousePet »

Undo what you have done as its silly and wrong. :P

Change this line:
if self:getStat(s) < v then return nil, "not enough stat" end
to:
if self:getStat(s, nil, false, true) < v then return nil, "not enough stat" end
My feedback meter decays into coding. Give me feedback and I make mods.

sajberhippien
Halfling
Posts: 114
Joined: Thu Jan 14, 2016 11:10 am

Re: Addon Idea/Coding Question: Talents require stat hardpoi

#9 Post by sajberhippien »

Huh, thanks! That worked! Thought I had tried exactly that before, but apparently not. Thanks! :D

Post Reply