help with level script

ok guys i really need some one to help me with this because.
i have like 1% knowledge in coding:o so i could be glad if some one cuold help me.

im looking/creat a level script (for example) if i kill 3mob:ba: or something i get level 2 and unluck a weapon or something. hope someone can help me

p.s i hope you guys understande me :smiley:

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)

i didn’t find any RPG templates :S

link to your pthon request thread plz :slight_smile:

http://blenderartists.org/forum/showthread.php?t=145117

I’ll see if I find any level scripts in that thread

thanks -[killer]-:slight_smile:

no one that can find me a RPG templates/leveling templates

i have looked my soul out to find one :frowning:

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.

thanks joeman16