Jump to content
Sign in to follow this  
Rinor

exp problem

Recommended Posts

@KONG I'm tagging you again xD cuz i took this from your script ( customs.lua )

This is the luaerr.txt:
err1.png

This is the script:
err2.png

- When i kill any of mobs, the error appears at luaerr.txt ( it doesnt give exp, not even shows on system ).
Full Script of ShareExpTeam:
 

- I'm not running it through Customs.lua ( I have replaced it at exp_and_lvl.lua )

Share this post


Link to post
Share on other sites

Hi. Sorry for the logic errors. Change

if MapEXP[chamap] ~= nil then

to

if MapEXP ~= nil and MapEXP[chamap] ~= nil then

 

Inside variable.lua or outside share team exp;

MapEXP = {}

-- format: map = rate

--example

MapEXP['garner'] = 5

 


kong.png

a2.png

Share this post


Link to post
Share on other sites

These are simple issues. (a nil value) simply means it doesn't exist. Lua_err explains it well. U need to find that missing function in the extension and put it in your files. 

 

EDIT: the above comment is used to fix all the next errors You will have.


kong.png

a2.png

Share this post


Link to post
Share on other sites

@Rinor If your problem is nil error, the solution is:

19 hours ago, KONG said:

These are simple issues. (a nil value) simply means it doesn't exist. Lua_err explains it well. U need to find that missing function in the extension and put it in your files. 

As explained already, to solve the next errors you encountered:

19 hours ago, KONG said:

EDIT: the above comment is used to fix all the next errors You will have.

i don't know any better way to explain this...


kong.png

a2.png

Share this post


Link to post
Share on other sites

@KONG I'm also saying that there is not missing anything.. i have complied all ur exctensions within my files..

Also without complie them with files if i run them from extensions they give even more errors.

Edited by Rinor

Share this post


Link to post
Share on other sites

@Billy @KONG
This is the function inside the shareteamexp:

			-- ANTI LEVEL JUMP
			if(lvPerson ~= LV_LIMIT)then
				if lvPerson >= PreventJumpLevel then
					exp_up = ExpToNextLevel(TurnToCha(t[i]),exp_up)
				end
			end

I tried using this outside shareteamexp, at the end of exp_and_lvl.lua:

function ExpToNextLevel(cha,a)
local LevelJumpToPrevent = 1
local ExpNeed = DEXP[Lv(cha) + LevelJumpToPrevent]
if ExpNeed == nil 
then
return 0
end
local ChaExp = GetChaAttr ( cha , ATTR_CEXP )
local ExpReq = ExpNeed - ChaExp
if a > ExpReq then
return ExpReq
else
return a
end
end

Now it doesn't show any error at lua_err.txt, but it doesnt give any exp ingame when killing any mob.

Share this post


Link to post
Share on other sites

@KONG on the top of exp_and_level.lua:
42423.png
I tried run this from customs.lua too but same error..

All this which are placed inside shareteamexp, gives errors - something is missing but i cant find it at extension too..
All these gives errors

			-- ANTI LEVEL JUMP
			if(lvPerson ~= LV_LIMIT)then
				if lvPerson >= PreventJumpLevel then
					exp_up = ExpToNextLevel(TurnToCha(t[i]),exp_up)
				end
			end
			-- From PKO2.4
			if LV_EXP ~= nil then
				local expraid = LV_EXP[Lv(TurnToCha(t[i]))] or 1
				exp_up = math.floor(exp_up*expraid)
			end						
			-- Add exp
			exp = exp + exp_up
			local playerLv = Lv(TurnToCha(t[i]))
			-- CAP MAX LEVEL
			if playerLv == LV_LIMIT then exp = 1; end
			if NullExperience then
				exp = 0
			end					

 

Share this post


Link to post
Share on other sites

@KONG It's same i posted those all to tell you that all of those gives error, i tried put 1 and remove others and it still give the error ( no exp ingame and it shows error at luaerr.txt as i showed you up there.

Share this post


Link to post
Share on other sites

@KONG I just Tested editing Exp_and_level.lua once again from another clean one..
I tried using just one function but it gives error and doesnt give any exp ingame, something is missing that must be used outside of shareexpteam ( but that doesnt exist on ur extension folder ) you may used them at ur variable.lua or function.lua in calculate files when you were working with pko 1.38 and forgot to add them at extension when you shared them. ( everything works at shareexpteam until these last ones )

			-- ANTI LEVEL JUMP
			if(lvPerson ~= LV_LIMIT)then
				if lvPerson >= PreventJumpLevel then
					exp_up = ExpToNextLevel(TurnToCha(t[i]),exp_up)
				end
			end
			-- From PKO2.4
			if LV_EXP ~= nil then
				local expraid = LV_EXP[Lv(TurnToCha(t[i]))] or 1
				exp_up = math.floor(exp_up*expraid)
			end						
			-- Add exp
			exp = exp + exp_up
			local playerLv = Lv(TurnToCha(t[i]))
			-- CAP MAX LEVEL
			if playerLv == LV_LIMIT then exp = 1; end
			if NullExperience then
				exp = 0
			end		

These requires something else outside shareexpteam.. but can't be found inside extension folder.
Just like the first Post you told me to add at variable at the end of expandlevel:

MapEXP = {}

MapEXP['garner'] = 5
This one also doesn't exist on ur extension which gave me error about map exp. but now it is solved..
Those function also needs something.. I hope you can help me.

Edited by Rinor

Share this post


Link to post
Share on other sites

0) make sure your exp function isn't bug before adding anything. 

1) add one sub routine at a time.

2) Make sure all variable are initialized

3) post errors here

4) post what you added to your files

5) guess what the error is


kong.png

a2.png

Share this post


Link to post
Share on other sites

@KONG I have added on exp_and_level.lua everything that has to do with it ( from customs.lua )
The shareteamexp function which i took from customs.lua and added to exp_and_level.lua works fine until i add this ones at the end of it
The Exp works fine with the original one.. but gives error when adding ur custom function at the end.

After adding the ones you shared i get error's like there's something else missing? but which can't be found in ur extension.

This one is how it looks on ur custom one:

			if exp_up > 20000 then
				local cha_name = GetChaDefaultName ( TurnToCha(t[i]) )
				local Monster_name = GetChaDefaultName ( dead )
				LG ( "Big_exp" ,"Player ["..cha_name.."]	Attacked ["..Monster_name.."]	Obtained ["..exp_up.."] EXP" )
			end
			if exp_up == 0 then 
				SystemNotice ( TurnToCha(t[i]) , "Your level is too high to obtain any experience" )
			end
			-- NIL EXP STONE 
			if CheckBagItem(TurnToCha(t[i]), NoExpStone) > 0 then
				exp_up = 0
				SystemNotice ( TurnToCha(t[i]) , "Zero EXP Stone activated." )
			end
			-- ANTI LEVEL JUMP
			if(lvPerson ~= LV_LIMIT)then
				if lvPerson >= PreventJumpLevel then
					exp_up = ExpToNextLevel(TurnToCha(t[i]),exp_up)
				end
			end
			-- From PKO2.4
			if LV_EXP ~= nil then
				local expraid = LV_EXP[Lv(TurnToCha(t[i]))] or 1
				exp_up = math.floor(exp_up*expraid)
			end
			-- Add exp
			exp = exp + exp_up
			local playerLv = Lv(TurnToCha(t[i]))
			-- CAP MAX LEVEL
			if playerLv == LV_LIMIT then exp = 1; end
			if NullExperience then
				exp = 0
			end
			SetChaAttrI ( TurnToCha(t[i]) , ATTR_CEXP, exp ) 
			LG("exp" , "exp_now = " , exp ) 
		else 
		end 
	end 
	local star112 = GetChaAttr(team_atker, ATTR_CEXP) --The current level of experience
	LG("star_exp" , "Player ["..cha_name1100.."]	At present, experience: "..star112.." [End of ShareTeamExp]" ) 
	--LG("exp" , "end getexp " )
end

And this is how it looks on original:

			if exp_up > 20000 then
				local cha_name = GetChaDefaultName ( TurnToCha(t[i]) )
				local Monster_name = GetChaDefaultName ( dead )
				LG ( "Big_exp" ,"Character"..cha_name.."Attack"..Monster_name.."Obtained"..exp_up.."EXP" )
			end
			if exp<DEXP[80] and (exp+exp_up)>DEXP[80] then
				--SystemNotice ( TurnToCha(t[i]) , "DEXP[80] = "..DEXP[80] )
				--SystemNotice ( TurnToCha(t[i]) , "exp_up前 = "..exp_up)
				exp_up =math.floor((DEXP[80]-exp) +(exp_up-(DEXP[80]-exp))/50)
				--SystemNotice ( TurnToCha(t[i]) , "exp_up后 = "..exp_up)
			end                                                                                  -------------避免79级到80级之后,拿到超出额度的经验 Jack


			if Lv ( TurnToCha(t[i]) ) >= 80 then 
				exp_up = math.floor ( exp_up / 50 ) 
			end 
			--防沉迷系数  
			local retExpState = GetExpState(t[i])

			if exp_up == 0 and retExpState ~= 0 then 
				SystemNotice ( TurnToCha(t[i]) , "Your level is too high to obtain any experience" )
			end 


			--Notice("打怪获取经验的防沉迷系数为"..retExpState)
			--Notice("防沉迷之前的exp"..exp_up)
			
			exp_up =exp_up *GetExpState(t[i])/100
			--Notice("防沉迷之后的exp"..exp_up)

			--SystemNotice ( TurnToCha(t[i]) , "经过各种计算后得到的exp_up = "..exp_up)
			exp = exp + exp_up  
			
			SetChaAttrI ( TurnToCha(t[i]) , ATTR_CEXP, exp ) 
			LG("exp" , "exp_now = " , exp ) 
		else 
	        --SystemNotice ( team_atker , "队员排位["..i.."]的值为空")
		end 
	end 
	local star112=GetChaAttr (  team_atker , ATTR_CEXP )----------当前等级经验
	LG("star_exp" , "Player"..cha_name1100.."Current Experience is"..star112.."End ShareTeamExp" ) 
	LG("exp" , "end getexp " )
end 

 

Edited by Rinor

Share this post


Link to post
Share on other sites

You did not follow the steps i've provided, so it is yet again hard to debug.

For example:

1) I added:

-- NIL EXP STONE
if CheckBagItem(TurnToCha(t[i]), NoExpStone) > 0 then
  exp_up = 0
  SystemNotice ( TurnToCha(t[i]) , "Zero EXP Stone activated." )
end 

2) variables associated with sub-routine:

NoExpStone

3) Errors: comparing to nil value (NoExpStone)

4) Steps 1 and 2

5) I think I forgot to initialize NoExpStone

 


kong.png

a2.png

Share this post


Link to post
Share on other sites

After I initialized NoExpStone = 5, the subroutine works.

 

Example 2: Now I will try to add the next subroutine:

1)

-- ANTI LEVEL JUMP
if(lvPerson ~= LV_LIMIT)then
  if lvPerson >= PreventJumpLevel then
    exp_up = ExpToNextLevel(TurnToCha(t[i]),exp_up)
  end
end

 

2) variables associated:

lvPerson
PreventJumpLevel
ExpToNextLevel

 

3) Errors: none in lua_err and none in console.

 

4) 1 and 2

 

5) Something smells fishy here. I think this is the subroutine that gives me error...

What can it be??? I will try to initialize all the associated variable/functions.

 

 


kong.png

a2.png

Share this post


Link to post
Share on other sites

@KONG finaly fixed it xD, thanks alot. btw just one more thing..
This one that i added:

lvPerson
PreventJumpLevel
ExpToNextLevel

I added like this:

lvPerson	= 100
PreventJumpLevel	= 75
ExpToNextLevel	= 1

Not sure if i added the numbers right?!
My Max Lv in server is 100.

Edited by Rinor

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...