Hey guys, I’m currently working on an exp script for a game to count exp and to add levels to the characters. Here is what I have so far and it works, but with a slight few issues for future reference.
import GameLogic as gl
cont = gl.getCurrentController()
me = cont.owner
expk = cont.sensors[“expcon”]
mes = cont.actuators[“lvlup.mes”]
lvl = cont.actuators[“lvladd.act”]
if me[‘exp’]>=10 and me[‘level’]<=1:
expk is an Always sensor put on true pulse so it’s constantly scanning. When the character is given 10 exp (from 0) and is currently equal to or lower then lvl 1, then he lvl’s up, very simple script, but now here’s the issue
What about lvls 2-99. Theoretically I could just an ‘if statement’ for every level… but that would be to much work for one code. Then I thought, just make a dictionary array, but then when ‘level’ is checked it’s going to be less then 99, so it’ll just go up all the way to that level, and thats not good.
My brain is on overload right now inbetween working at my job and working on this script. Just wondering if someone had a good idea on how to resolve this and I bet I’m going to end up hitting my head in the end. Thanks guys
(I’m also still learning python with Blender GE)