Post by Gando on Mar 7, 2008 18:11:11 GMT -5
first the init.lua section
then the part in passive.lua starting at line 122
the function for deciding what the skill points allocation should be
and finally the bit that calls that in skill_points_per_levels()
Notes:
I figured following what Variaz suggested in the suggestions/tips section that it would fairly straightforward and since I already had visual studios open for another project..what the heck eh? hehe...not so quick slick!
It took me a while to decide on the stats to use for each class and longer to find the CONSTANTS used to represent the class ids. In the end I guessed on EL's id but there is no way for me to test this as the code seems to break the games ability to display stats and skills
I have no idea what went wrong or how to debug it. I considered making the ifs into an if/else type branching but figured that wasnt needed since there shouldnt be any conflicts between classes as you can only be one at a time.
Any comments on what might be breaking the game please post asap meanwhile I will be restoring my backup lib folder.
sp_from_stats = ()
sp_from_stats[1] = 0
sp_from_stats[2] = 0
sp_from_stats[3] = 0
sp_from_stats[4] = 0
sp_from_stats[5] = 0
sp_from_stats[6] = 0
then the part in passive.lua starting at line 122
sp_from_stats[1] = p_ptr.stat_add[A_STR+1]
sp_from_stats[2] = p_ptr.stat_add[A_INT+1]
sp_from_stats[3] = p_ptr.stat_add[A_WIS+1]
sp_from_stats[4] = p_ptr.stat_add[A_DEX+1]
sp_from_stats[5] = p_ptr.stat_add[A_CON+1]
sp_from_stats[6] = p_ptr.stat_add[A_CHR+1]
the function for deciding what the skill points allocation should be
-- function for getting sp bonuses based on stats and class
function get_bonus_sp()
local cls = p_ptr.class
local retamt = 0;
--apprentices and monsters get a flat bonus of 5 sp per level regardless of stats
if(p_ptr.PRACE == MONSTER or cls == CLASS_APPRENTICE) then retamt = 3 end
--Warriors, Fighters, and Defenders get sp from STR and CON
if (cls == CLASS_WARRIOR or cls == CLASS_FIGHTER or cls == CLASS_DEFENDER) then
retamt = (lua_mod(sp_from_stats[1], 5) + lua_mod(sp_from_stats[5], 5))
end
--Mages and High Mages get sp from Int
if (cls == CLASS_MAGE or cls == CLASS_HIGH_MAGE) then
retamt = (lua_mod(sp_from_stats[2], 6) + 1)
end
--Priests get sp from Wis
if (cls == CLASS_PRIEST) then
retamt = (lua_mod(sp_from_stats[3], 6) + 1)
end
--Rogues, Shadow Stalkers,Marksmen and Gunners all depend on dex for sp
if (cls == CLASS_ROGUE or cls == CLASS_SHADOW or cls == CLASS_MARKSMAN or cls == CLASS_GUNNER) then
retamt = (lua_mod(sp_from_stats[4], 6) + 1)
end
--Rangers get sp from Dex and Str
if (cls == CLASS_RANGER) then
retamt = (lua_mod(sp_from_stats[4], 5)) + (lua_mod(sp_from_stats[1], 5))
end
--Paladins, Justice Warriors and Soul Guardians get sp from Wis and Cha
if(cls == CLASS_PALADIN or cls==CLASS_JUSTICE_WARRIOR or cls == CLASS_SOUL_GUARDIAN) then
retamt = (lua_mod(sp_from_stats[3], 5)) + (lua_mod(sp_from_stats[6], 5))
end
--Monks and High Monks derive sp from WIS and CON
if(cls == CLASS_MONK or cls == CLASS_ZELAR) then
retamt = (lua_mod(sp_from_stats[3], 5)) + (lua_mod(sp_from_stats[5], 5))
end
--Elemental Lords get sp from Str and Int. not sure what the CONSTANT for this class is
--Im guessing class # is 11
if(cls == 11) then
retamt = (lua_mod(sp_from_stats[1], 5)) + (lua_mod(sp_from_stats[2], 5))
end
--Monstermages get their sp from Int and Con
if(cls == CLASS_MONSTER_MAGE) then
retamt = (lua_mod(sp_from_stats[2], 5)) + (lua_mod(sp_from_stats[5], 5))
end
return retamt
end
and finally the bit that calls that in skill_points_per_levels()
--amt = 5
amt = get_bonus_sp() + 2
Notes:
I figured following what Variaz suggested in the suggestions/tips section that it would fairly straightforward and since I already had visual studios open for another project..what the heck eh? hehe...not so quick slick!
It took me a while to decide on the stats to use for each class and longer to find the CONSTANTS used to represent the class ids. In the end I guessed on EL's id but there is no way for me to test this as the code seems to break the games ability to display stats and skills
I have no idea what went wrong or how to debug it. I considered making the ifs into an if/else type branching but figured that wasnt needed since there shouldnt be any conflicts between classes as you can only be one at a time.
Any comments on what might be breaking the game please post asap meanwhile I will be restoring my backup lib folder.