Property Greater Than Another Property

So I’ve been trying to add a feature in my game and I’m apparently having some difficulties. So I have three properties, two integers and one boolean. I attempted to make that if one property greater than the other one…the boolean property would be true.

I did something like this…


use the expression brick:


this results in True

#edit
best option is to set the property sensor to changed, so if the property changes it checks the expression etc.

Thanks, it worked! I didn’t know it was as simple as that.

But I have a another question. How do you make two properties from two different objects add up to a property for another object?

For that you should probably use a python code…

import bge

scene = bge.logic.getCurrentScene()
obj1 = scene.objects["Object1"]
obj2 = scene.objects["Object2"]
obj3 = scene.objects["Object3"]

obj3["prop"] = obj1["prop"] + obj2["prop"]

The obj lines are getting what objects to use, as the names in “” are the actual objects’ names. Then, the obj[“prop”] is getting the property prop in obj. It then adds the two first properties and makes the the result the third property’s value.
Put it in a Python conroller, connect it to a sensor that will trigger it, and you are done.

Is there a way to do this in a logic brick format?

make a master object, call it ‘property handler’ or something. Put al the properties you need onto that object, connect messages sensors to property actuators like the screen shot above.

now let all objects send a message to the ‘property handler’.
now you have your objects that sends messages to the ‘property handler’, the ‘property handler’ then counts the properties, just like in the screenshot.

What relation is between these two objects?

Can this relation change during game?

So there’s three objects. Two objects have the same properties that can change during the game. They both add up to equal a property on an object.

Nevermind, I went with the script and it worked smoothly. Thanks for assisting…