Post by Gando on Mar 10, 2008 10:51:44 GMT -5
Ok so I promised Id post this when I was more compus mentus and here I am awake and as compus as Ill get...so here goes:
first
in init.lua
notes: the initial plan was to use an array (as Im a js coder Im used to using arrays to deal with objects etc...makes for more efficient coding) but for some reason a global array defined in init.lua kept zeroing out the stats so I settled for individual variables instead.
next...
in passive.lua starting on line 1288
I decided to follow Variaz's last advice concerning which stat to use. also decided to put the class into a variable just in case using it in the other script was goofy.
next...
in scripts.lua
on line 14
on line 67 in function skill_points_per_levels()
and finally (very important)
on line 409
Notes:
The function I wrote is very simple...it assigns sp gain formula to an array the length of the number of classes in game.
If a new class gets added the array will need an additional element.
Then it returns the sp gained according to the current class of the character...I have not tested what happens when you have 2 classes (pal 3 war 3 for example) so this is still an iffy script.
the line in skill_points_for_levels that I altered calls the function and assigns its return value to the amt variable that it will return to the game.
The last thing I added is important to add an event handler for the new function so the game doesnt freak out (or just ignore it and do something odd)
first
in init.lua
sp_str = 0
sp_int = 0
sp_wis = 0
sp_dex = 0
sp_con = 0
sp_cha = 0
sp_class = 0
notes: the initial plan was to use an array (as Im a js coder Im used to using arrays to deal with objects etc...makes for more efficient coding) but for some reason a global array defined in init.lua kept zeroing out the stats so I settled for individual variables instead.
next...
in passive.lua starting on line 1288
sp_str = p_ptr.stat_ind[A_STR+1]
sp_int = p_ptr.stat_ind[A_INT+1]
sp_wis = p_ptr.stat_ind[A_WIS+1]
sp_dex = p_ptr.stat_ind[A_DEX+1]
sp_con = p_ptr.stat_ind[A_CON+1]
sp_cha = p_ptr.stat_ind[A_CHR+1]
sp_class = p_ptr.pclass
I decided to follow Variaz's last advice concerning which stat to use. also decided to put the class into a variable just in case using it in the other script was goofy.
next...
in scripts.lua
on line 14
function get_bonus_sp ()
local arBonus={}
--warriors and fighters
arBonus[1] = (sp_str/5) + (sp_con/5) + 2
arBonus[2] = (sp_str/5) + (sp_con/5) + 2
--mages and priests
arBonus[3] = (sp_int/5) + (sp_wis/5) + 2
arBonus[4] = (sp_int/5) + (sp_wis/5) + 2
--rogues
arBonus[5] = (sp_dex/5) + (sp_int/5) + 2
--rangers
arBonus[6] = (sp_str/5) + (sp_dex/5) + 2
--paladins
arBonus[7] = (sp_wis/5) + (sp_cha/5) + 2
--monks
arBonus[8] = (sp_wis/5) + (sp_con/5) + 2
--marksmen
arBonus[9] = (sp_dex/5) + (sp_con/5) + 2
--highmages
arBonus[10] = (sp_int/5) + (sp_wis/5) + 2
--elemental lords
arBonus[11] = (sp_str/5) + (sp_int/5) + 2
--monster mages
arBonus[12] = (sp_int/5) + (sp_con/5) + 2
--defenders
arBonus[13] = (sp_str/5) + (sp_con/5) + 2
--justice warriors
arBonus[14] = (sp_wis/5) + (sp_cha/5) + 2
--high monks
arBonus[15] = (sp_wis/5) + (sp_con/5) + 2
--soul guardians
arBonus[16] = (sp_wis/5) + (sp_cha/5) + 2
--shadow stalkers
arBonus[17] = (sp_dex/5) + (sp_int/5) + 2
--gunners
arBonus[18] = (sp_dex/5) + (sp_con/5) + 2
--enchanters
arBonus[19] = (sp_int/5) + (sp_wis/5) + 2
--apprentices and monsters get 5 total
if (sp_class == CLASS_APPRENTICE or p_ptr.prace == RACE_MONSTER) then
return 5
end
msg_print("You get some sp equal to ")
msg_print(arBonus[sp_class])
return arBonus[sp_class]
end
on line 67 in function skill_points_per_levels()
amt = get_bonus_sp()
and finally (very important)
on line 409
add_event_handler("get_bonus_sp", get_bonus_sp)
Notes:
The function I wrote is very simple...it assigns sp gain formula to an array the length of the number of classes in game.
If a new class gets added the array will need an additional element.
Then it returns the sp gained according to the current class of the character...I have not tested what happens when you have 2 classes (pal 3 war 3 for example) so this is still an iffy script.
the line in skill_points_for_levels that I altered calls the function and assigns its return value to the amt variable that it will return to the game.
The last thing I added is important to add an event handler for the new function so the game doesnt freak out (or just ignore it and do something odd)