Page 2 of 2

Re: Levelling up Skills beyond 1-10

Posted: Sun Dec 11, 2011 11:41 pm
by imaginethat
thanks,
a

Code: Select all

player.update()
worked a treat.

I think one of the issues I was finding with the skill_from_db was it coming back with a nil value all the time, until I realised that the MAGE_WISDOM skill is not in the skills.xml DB.
I can kind of understand why, as it is not a skill that gets cast in game. But how do you recommend I get the skill level (rank) for this and other skills that are not in the skills.xml file.
Do I need to create and maintain another copy of this file? I do not want to edit the original skills.xml, as it will be overwritten each time it is updated with a new patch.

I am just looking for a way to find the difference between the player level, and the level of the skill to be levelled.

Code: Select all

numberoftimestolevelskill = player.Level - rank
(how to get rank of skill not in skills.xml)

thanks

Re: Levelling up Skills beyond 1-10

Posted: Mon Dec 12, 2011 12:29 am
by lisa
Well I am sure you have some sort of code which calls the
function levelupSkill(_skillname, _times)

So at that stage do a check for the skill you want and if it isn't in the database then you could insert into the skill database table the skill you want.

Code: Select all

if database.skills["MAGE_WISDOM"] == nil then
local tmp = CSkill();
tmp.skilltab = 2
tmp.skillnum = 3
database.skills["MAGE_WISDOM"] = tmp
end
Tested and works fine.

Re: Levelling up Skills beyond 1-10

Posted: Mon Dec 12, 2011 8:19 pm
by imaginethat
Hi, thanks for this code, I have added it into my function and seems to be working well.
I have only been testing the function for about 30mins, so still may have some bugs etc, but looks to be working well.

I'm sure you already knew, but for other looking at this, I found the skillnum and skilltab would come back nil if the skill was not learned yet. Seems obvious now, but caused me some head scratching even after adding or checking the skills was in skills.xml.

I also added the skillnum and skilltab into the table for the skill(s) not in the skills.xml

The function is just a combination of the 1-10 function you(?) did Lisa, and some other bits, and I merged it all together, added some checks and seems to still be running.

I'm sure it looks horrible for the coder elite among you, but for me its working well.

The table of skills obviously needs much work, and I will continue to add to it as my character levels up and I find out what skills I would upgrade at each level. I will then end up with an automated skills leveller.

Here is the function:

Code: Select all

function LevelUpSkills1To70(_loadonly)

		if _showdebug then cprintf(cli.blue," DEBUGl:: Starting LevelUpSkills1To70()  \n") ; end
		local skillLevelupMap = {
			[CLASS_WARRIOR]	= {  [1] = { aslevel = 1, skillname = "WARRIOR_SLASH", atlevel = {99} },
								 [2] = { aslevel = 2, skillname = "WARRIOR_OPEN_FLANK", atlevel = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,30 } },
								 [3] = { aslevel = 2, skillname = "WARRIOR_PROBING_ATTACK", atlevel = {0} },
								 [4] = { aslevel = 4, skillname = "WARRIOR_ENRAGED", atlevel = {0} },
								 [5] = { aslevel = 6, skillname = "WARRIOR_THUNDER", atlevel = {0} } },
			[CLASS_SCOUT]	= {  [1] = { aslevel = 1, skillname = "SCOUT_SHOT", atlevel = {0} },
								 [2] = { aslevel = 2, skillname = "SCOUT_WIND_ARROWS", atlevel = {0} },
								 [3] = { aslevel = 4, skillname = "SCOUT_VAMPIRE_ARROWS", atlevel = {99} } },
			[CLASS_ROGUE]	= {  [1] = { aslevel = 1, skillname = "ROGUE_SHADOWSTAB", atlevel = {0} },
								 [2] = { aslevel = 2, skillname = "ROGUE_LOW_BLOW", atlevel = {0} },
								 [3] = { aslevel = 6, skillname = "ROGUE_WOUND_ATTACK", atlevel = {0} },
								 [4] = { aslevel = 8, skillname = "ROGUE_BLIND_STAB", atlevel = {0} } },
			[CLASS_MAGE]	= {  [1] = { aslevel = 1, skillname = "MAGE_FLAME", atlevel = {99} }, 
								 [2] = { aslevel = 2, skillname = "MAGE_ELECTROSTATIC_CHARGE", atlevel = {2,3,4,5,6,7,8,10,12,14,16,18,20,22,24,26,28,30} },
								 [3] = { aslevel = 4, skillname = "MAGE_FIREBALL", atlevel = {4,6,8,10,12,14,16,18,20,22,24,26,28,30} },
								 [4] = { aslevel = 8, skillname = "MAGE_LIGHTNING", atlevel = {8,10,12,14,16,18,20,22,24,26,28,30} },
								 [5] = { aslevel = 10, skillname = "MAGE_DISCHARGE", atlevel = {0} },
								 [6] = { aslevel = 10, skillname = "MAGE_ELECTRIC_BOLT", atlevel = {10,11,12,14,16,18,20,22,24,26,28,30} },
								 [7] = { aslevel = 12, skillname = "MAGE_WISDOM", skilltab = 2, skillnum = 3, skillatlevel = {99} },
								 [8] = { aslevel = 14, skillname = "MAGE_METEOR_SHOWER", atlevel = {14,16,18,20,22,24,26,28,30} },
								 [9] = { aslevel = 16, skillname = "MAGE_INTENSIFICATION", atlevel = {99} } },
			[CLASS_PRIEST]	= {  [1] = { aslevel = 1, skillname = "PRIEST_RISING_TIDE", atlevel = {0} },
								 [2] = { aslevel = 1, skillname = "PRIEST_URGENT_HEAL", atlevel = {0} },
	--							 [3] = { aslevel = 2, skillname = "PRIEST_WAVE_ARMOR", atlevel = {0} },	-- needs too much mana
								 [3] = { aslevel = 4, skillname = "PRIEST_REGENERATE", atlevel = {0} } ,
								 [4] = { aslevel = 8, skillname = "PRIEST_HOLY_AURA", atlevel = {0} } },
			[CLASS_KNIGHT]	= {  [1] = { aslevel = 1, skillname = "KNIGHT_PUNISHMENT", atlevel = {0} },
								 [2] = { aslevel = 1, skillname = "KNIGHT_HOLY_STRIKE", atlevel = {0} } },
			[CLASS_WARDEN]	= {  [1] = { aslevel = 1, skillname = "WARDEN_CHARGED_CHOP", atlevel = {0} },
								 [2] = { aslevel = 1, skillname = "WARDEN_ENERGY_ABSORB", atlevel = {0} },
								 [3] = { aslevel = 2, skillname = "WARDEN_THORNY_VINE", atlevel = {0} },
								 [4] = { aslevel = 4, skillname = "WARDEN_BRIAR_SHIELD", atlevel = {0} },
								 [5] = { aslevel = 8, skillname = "WARDEN_POWER_OF_THE_WOOD_SPIRIT", atlevel = {0} } },
			[CLASS_DRUID]	= {  [1] = { aslevel = 1, skillname = "DRUID_RECOVER", atlevel = {0} },
								 [2] = { aslevel = 1, skillname = "DRUID_EARTH_ARROW", atlevel = {0} },
								 [3] = { aslevel = 2, skillname = "DRUID_BRIAR_ENTWINEMENT", atlevel = {0} },
								 [4] = { aslevel = 6, skillname = "DRUID_RESTORE_LIFE", atlevel = {0} } },
			};
			
		player:update()
		local leveluptable = skillLevelupMap[player.Class1];
		printf(" Player: Level:%d Class:%s\n", player.Level, player.Class1)
		for i,v in pairs(leveluptable)  do
			if (_loadonly ~= "loadonly") and ( player.Level >= v.aslevel ) then
				player:update()
				local _skillname = v.skillname
				if database.skills[_skillname] == nil then
					printf(" Skill:%s is not in the Skill database, going to add it in.\n", _skillname)
					local tmp = CSkill();
					tmp.skilltab = v.skilltab
					tmp.skillnum = v.skillnum
					database.skills[_skillname] = tmp
				end
				local skill_from_db = database.skills[_skillname];
				local name, _, icon, _, rank, type, upgradeCost, isSkillable, isAvailable = RoMScript("GetSkillDetail("..skill_from_db.skilltab..","..skill_from_db.skillnum..")")
				local whentolevel = v.atlevel
				for j,w in ipairs(whentolevel) do
					if w == 99 then							
						local _timestolevel = player.Level - rank
						if _timestolevel > 0 then
							printf(" Adding (or attempting to add) levels to skill:%s x%d\n",_skillname, _timestolevel) ;
							levelupSkill(v.skillname, _timestolevel);
						end
					elseif w == player.Level then
						if j > rank then
							_timestolevel = j - rank
							printf(" Adding (or attempting to add) %d level(s) to skill:%s \n", _timestolevel, _skillname)
							levelupSkill(v.skillname, _timestolevel);
						else
							printf(" Skill:%s is already at the desired rank:%d for the class level:%d \n", _skillname, rank, player.Level)
						end
					end
				end
			end
		end
	end
function attached

Re: Levelling up Skills beyond 1-10

Posted: Mon Dec 12, 2011 11:13 pm
by imaginethat
I have run into an issue with

Code: Select all

RoMScript("GetSkillDetail("..skill_from_db.skilltab..","..skill_from_db.skillnum..")")
is does not seem to be pulling data for MAGE_ELECTRIC_BOLT and MAGE_DISCHARGE, both of which are in the skills.xml.

I don't pretend to understand how the skills.xml file functions if the GetSkillDetail is pulling stuff straight from memory (or not?)

I have even manually added skillnum and skilltab which is a static number so not a real issue, but it want give me rank which is a variable, so I can fix this number.

Using your code to add the skill to the skills.xml file is no use, as the skill is already listed.

My character is level 10, and these are level 10 skills. My code works fine for skills up to level 10, what is different about these skills?

Re: Levelling up Skills beyond 1-10

Posted: Tue Dec 13, 2011 12:21 am
by lisa
works fine for me

Code: Select all

Command> levelupSkill("MAGE_DISCHARGE")
Use MACRO: Executing RoMScript "SetSpellPoint(4,6);".

Code: Select all

Command> local name, _, icon, _, rank, type, upgradeCost, isSkillable, isAvailab
le = RoMScript("GetSkillDetail(4,6)") print(upgradeCost)
205