TheMadHerbalist Posted January 28, 2012 Share Posted January 28, 2012 (edited) I was trying to make a perk similar to the educated perk that would give you an extra perk each time you level with out it being affected by the iLevelsPerPerk.Example leveling from level 1 to 2 you would get to select 2 perks and level 2 to 3 you would get just one. SCN PerkRate int initialized int preXP int postXP int diffXP int leveled int currlevel int nextlevel int tmplevel begin GameMode if initialized !=1 set diffXP to 0 set currlevel to player.getlevel set nextlevel to (currlevel +1) set initialized to 1 endif set currlevel to player.getlevel if currlevel >= nextlevel if player.hasperk Educated player.addperk stopEducated ; gives a perk that subtracts 2 skill points endif player.addperk noSP ;multiplies skill points by 0 set preXP to player.getav xp set nextlevel to (currlevel + 1) if (currlevel % 2) ==0 set tmplevel to (currlevel - 1) else set tmplevel to (currlevel - 2) endif player.setlevel tmplevel ;seems to be causing crashes player.advlevel player.setlevel currlevel set postXP to player.getav xp set diffXP to (preXP - postXP) if player.hasperk Educated player.removeperk stopEducated endif player.removeperk noSP endif ;add loop to correct xp Label 2 if diffXP >= 1 player.rewardxp diffxp set postXP to player.getav xp set diffXP to (preXP - postXP) goto 2 endif end the codes seems hang then crashes in game when i get to the first player.setlevel tmp level, as when i comment it out and recompile it everything works fine, but does not have the effect that was intend Edited January 28, 2012 by TheMadHerbalist Link to comment Share on other sites More sharing options...
Recommended Posts