I’d love to help, unfortunately it’s not like there’s a few lines of code. Even though it’s simple you still need to have a few logic bricks and stuff setup. Look for some RPG templates or leveling templates around here, there’s plenty (I know i’ve made quite a few, check out my old python request thread… I know I’ve posted a few level scripts there)
You probably should say how much coding knowledge you really are comfortable with; can you do some simple object initializing code? For example…
import logic from bge
cont = logic.getCurrentController()
obj = cont.owner
If you want a leveling up script, just have something like this in the Player’s logic brick setup, with an Always sensor leading to a Python controller that has this script:
if not ‘init’ in obj:
obj[‘init’] = 1
obj[‘xp’] = 0
obj[‘xpmax’] = 100
obj[‘level’] = 1
And then, every time a creature is killed, put this script in each enemy’s python controller (with an Always sensor driving it):
import logic from bge
cont = logic.getCurrentController() # the python controller of the enemy
enemy = cont.owner
if not ‘init’ in enemy:
enemy[‘init’] = 1
enemy[‘hp’] = however much the enemy’s HP should be
enemy[‘xp’] = however much experience the Player is awarded with on defeat of the enemy
if enemy[‘hp’] <= 0:
## An enemy has been killed
player = logic.getCurrentScene().object[-the name of the player object here-]
player[‘xp’] += obj[‘xp’]
obj.endObject()
This is basic python, so just learning this would be helpful.