i got a python problem… dont know where is here the problem. did my self this python, but it has somewhere mistake. i am still very weak on python, probably i dont know some python tricks… if i do without randoms, it goes okay. but with random it is wrong somewhere… please check this:
import random cont = GameLogic.getCurrentController() own = cont.owner sensor2 = cont.sensors['sensor2'] scene = GameLogic.getCurrentScene() objects = scene.objects player = objects['OBplayer'] x = 0.1*(100-((player['evasion'])/(own['ontaget'])*100)) #problem can be here if sensor2.positive: own.endObject() if own['damage'] < player['defence']: own['damage'] = 0 own['Damage'] = 1 #it does so, that my real damage would go back after 0.1 second else: if player['evasion'] < own['ontarget']: if random.randint(1,str(x)) == 1 : #problem can be here own['damage'] = 0 own['Damage'] = 1 else: player['health'] -= own['damage'] - player['defence'] if player['evasion'] > own['ontarget']: own['damage'] = 0 own['Damage'] = 1
why for me this doesnt work? here is everything clear - i think i wrote right… but doesnt work. checked everything - have all propertys added right… maybe i wrote bad variable?
pls help - where is the problem here?