Page 1 of 1

Addon causes game to fail to create a new character.

Posted: Sat Jul 22, 2017 6:35 pm
by geoclasm
I'm trying to implement an addon that modifies the Actor.levelup( ) function.
I'm trying to superload the Actor.lua file but it's getting stuck when trying to create the initial level for some reason.
In order to rule out addon collisions, I've unsubscribed and removed all existing ( non-inclusive ) addons.

I've checked the path to the file, and dumbed down the code in the file to test if the problem was the code, but it's still not working...

This is all the code that I have in the file -

Code: Select all

local _M = loadPrevious(...)
local base_levelup = _M.levelup

function _M:levelup()
	base_levelup( )
end
I've checked the init file, and all that looks fine -

Code: Select all

-- GenerousLevels - Gives more per level.
-- tome-GenerousLevels/init.lua

long_name = "Generous Levels"
short_name = "Generous Levels" -- Determines the name of your addons file.
for_module = "tome"
version = {1,5,5}
addon_version = {0,0,2}
weight = 100 -- lower the value, sooner the addon will load relative to other addons.

homepage = {'http://www.stackoverflow.com'}
description = [[Is more generous with talents, types and stat points for each level gained.
Birth stats remain unchanged.
5 stat points per level, up 2 from 2.
2 talent points per level ( 3 if a multiple of 5 ), 1 ( 2 ) up from 1 ( 2 ).
2 generic points per level ( 1 if a multiple of 5 ), 1 ( 1 ) up from 1 ( 0 ).
4(!) category points per instance at levels 10, 20 and 36 ( and for every 30 levels after if that's a thing ), up 3 from 1.
2 prodigies at levels 30 and 42 ( up from 1 ). Additionally, +1 prodigies every 50 levels ( so 5 total at 50, and 1 more every 50 levels thereafter ).]]
tags = {'talents', 'categories', 'stats', 'levelup'}

overload = false
superload = true
data = false
hooks = false
Is this the correct place to be asking this question?
What am I doing wrong here?

Re: Addon causes game to fail to create a new character.

Posted: Sun Jul 23, 2017 1:50 am
by HousePet
We need an error message to help with this.
If it is erroring in level generation, you may need to enable flush log to get it.

Re: Addon causes game to fail to create a new character.

Posted: Sun Jul 23, 2017 2:22 am
by jenx
Place this at the end of your code

Code: Select all

return _M

Re: Addon causes game to fail to create a new character.

Posted: Sun Jul 23, 2017 11:23 am
by geoclasm
HousePet wrote:We need an error message to help with this.
If it is erroring in level generation, you may need to enable flush log to get it.
No error message. It just gets stuck on the "Creating Level" dialog.

Re: Addon causes game to fail to create a new character.

Posted: Sun Jul 23, 2017 11:25 am
by geoclasm
jenx wrote:Place this at the end of your code

Code: Select all

return _M
Within the function, or just at the end of the script?

Nvm - At either place it didn't have any affect on the outcome.

Re: Addon causes game to fail to create a new character.

Posted: Sun Jul 23, 2017 1:43 pm
by geoclasm
Figured it out. Should've paid more attention to the wiki -

Proper code -

Code: Select all

local _M = loadPrevious(...)
local base_levelup = _M.levelup
function _M:levelup( )
	--Your ( My ) Code Here
	return base_levelup(self)
end
return _M