Page 1 of 1

onLeaveCombat error

Posted: Thu Apr 14, 2011 12:48 pm
by Mushroomstamp
Getting this error when I reach the next level;
Error in your profile: onLeaveCombat error: .../functions.lua:817: attempt to index local 'skill_from_db' <a nil value>
Since it happens when I go up a level, I'm guessing it's getting a nil value for "Ranged Weapon Mastery", which I have a SetSpellPoint for under onLevelup. If I'm right, how do I fix it?

Just in case I'm wrong, here's my functions.lua, lines 814-822, which should be unaltered.

Code: Select all

	local skill_from_db = database.skills[_skillname];	-- read skill parameters from database

	-- check is skill has an aslevel in skills.xml
	if ( skill_from_db.aslevel ~= nil ) and
		 ( skill_from_db.aslevel > player.Level ) then
			cprintf(cli.yellow, "You need at least level %d to levelup skill %s. Your level is %d.\n",
		   skill_from_db.aslevel, _skillname, player.Level );
		return false;
	end
Profile, onLevelup

Code: Select all

	<onLevelup>
		-- single skill would be: sendMacro("SetSpellPoint(4,2);");
		-- or levelupSkill(_skillname, _times)
	sendMacro("SetSpellPoint(4,4);");		
	levelupSkills1To10();	
		-- open giftbag and equipt content
	openGiftbags1To10(player.Level);
	</onLevelup>
And onLeaveCombat;

Code: Select all

	<onLeaveCombat>
		-- Additional Lua code to execute after a target is finished
		-- if(player.Level == 10) then
		--	  __WPL:setForcedWaypointType("TRAVEL")
		-- end;
		lootBodies();
	</onLeaveCombat>

Re: onLeaveCombat error

Posted: Thu Apr 14, 2011 2:16 pm
by Administrator
Can you post the whole skills section for your profile, so we know exactly which skills you are using that could be causing this?

Re: onLeaveCombat error

Posted: Thu Apr 14, 2011 4:19 pm
by Mushroomstamp

Code: Select all

	<skills_scout>
		<skill name="SCOUT_VAMPIRE_ARROWS"      hotkey="MACRO" priority="100" />
		<skill name="SCOUT_SHOT"        		hotkey="MACRO" priority="90" />
		<skill name="SCOUT_WIND_ARROWS"         hotkey="MACRO" priority="80" />
		<skill name="SCOUT_AUTOSHOT"    		hotkey="MACRO" priority="70" />
	</skills_scout>
On what is probably a completely unrelated note... I just realized that < modifier="" > is no longer in there... why is that not needed anymore?

Re: onLeaveCombat error

Posted: Thu Apr 14, 2011 9:12 pm
by lisa
Yeah I know this error well, you just hit lvl 6 and bammo error. This is because the levelupSkills1To10(); wants to lvl up range weapon mastery but it was removed from the skills.xml as it wasn't an actual skill you can cast.

For now you can just add the skill into skills.xml in the database folder.

Code: Select all

	<skill name="SCOUT_RANGED_WEAPON_MASTERY aslevel="6" skilltab="4" skillnum="4" />