Game random 1 of 10 generator

Hey everyone.
Just a thought, I decided to share with You guys. Something that i have discovered after messing with Blenders collision sensors/detection. Make a 10, 4 or 6 face Rigid body Diamonds with flat faces and add 10, 4 or 6 static parent objects set perpendicularly from 10, 4 or 6 or even 20, 77 or 80 face objects in a decent but same distance. Set them up with a collision sensors with the object that is being set with action to move up from the bottom to the position below the “drop tower” where the 10,4 or 6 face Diamond gets dropped and where the sensors should be after diamond falls into a static drop tower, and as diamond gets released from empty with add object stuff set in empties logic tab from layer 2 on some button along with mouse rotation applied to empty and passed through from a character mouse look in order to give it some extra spin on all 3 axis to back up its randomness possibility for it’s result position after fall. Also this would need another object set at higher -Z hight in order to hit the sensored diamond object to give it extra turn and hit it from the top as it is being released in same time but at higher velocity downwards. I guess this background game engine random generator can be activated as for example if character collides with invisible plates as it approaches the game assets or npc’s in order for it to execute the drop of this generator for random execution of animation so that things repeat less with no coding at all or a drop of numbers for pre-generation of rigid body data balls released on a slope so they reach the bottom of the slope and then guided by geometry of static shelf in long cues with data takers or boxer like equalizer punchers in end of the slope shelves that can even be set to parent the objects “data takers” with stored property data and moved for special places and then unparented for random values for something else to be there for its value or incriesement actions or for user ui or something like that. Or set up an object next to the character or parented to characters tile and parent one to the the character itself or its armature and set it up so that it grooves in its idle animation a bit as it stands waving for a bit from left to right or applied to its breath animation and so that little move works as a trigger for collision to make a drop of generator in order to generate and pregenerate a random animation towards it’s theme . I also would like to read some feedback on this, is it a good practice to apply these kind of things as i am not able to write stuff in code and fiddle with all of the symbols in my mind in order to write like some more expert programmers would. I guess for applying this for characters/game assets or it would take too much resource of CPU and make things harder for cpu to deal with instead of making this by writing in code - that for me seems too complicated… atm i am thinking of making something up related to generating random data for loot from wicked creeps like in other games and the item card visualization and property values as the monster gets the first hit so that items are being randomly generated or taken from pregenerated resource while the creep is being killed. And i guess this could be linked to countless other actions as a chance drop for spawning an extra creeps/rare bosses or a chance of adding or activating extra rtfx to spells… or a chance reducer, or set something for failing some actions. If there are any different ways how to make something similar as i mentioned above that would involve more of coding please let me know i would like to see different alternatives as my knowledge about programming and coding skills are not very great. I would appreciate any thoughts. Cheers!

Well that’s a nice trick, but It requires a ton of ressources. You can also just do


in Python ^^

1 Like

I think i will model a monster and call it Mersenne prime Thank You, I will look into it and see if my brain will take in any of it. Honestly i can’t write code but i can dream and that is i guess more important for anyone who thinks in blender and this mind wrecking stuff that logic editor can apply to objects with mathematical features and principles for any kind of properties. My head cant keep stuff together everything about it and how smart this software or people are. :rofl:

1 Like

This thread gave me a good laugh. Obviously the OP’s technique is ingenious, but Python just throws it all out. I really do need to learn to code…

Nice job though @Sitag, very impressed.


Coding for me is a total nightmare, i Barely understand it. I’ve been through countless tutorials and i end up disappointed as stuff works for a person who makes the video but doesn’t work for me and i keep bumping into these dodgy videos in hopes that i will learn something from them but then i try to resolve the error and i really know what to write. Then i get sleepy and sick of staring at some text that i hardly understand. For example there’s one thing i know if You or someone deletes some lines from some scripts, then some things simply wont work if You have ever managed to do something like downloading .blend files from other people on this forum who shared i guess their inventions and possibilities of this software. I guess i’ll have to find more time to read stuff about IT. So i downloaded loads of tutorial .blends also a lot that i have found on this website to go through their logic editor setups and to have a look into their .py’s. in order to understand more o how this thing works but honestly i ofthen don’t understand some scripts but some things just work. I’m excited as i see Blender is something incredible and it blows my mind. In fact after overthingking loads of things ive seen related to programming sometimes You start to think that If you can make a blender engine to drop a letter and then if empty would move to the right with servo control as you type in most of the text input sectors you can then add something for backspace to move empty back but with an object sticking out that after collision with a dropped letter from layer2 would end it. And if You make enter button to actuate something like a plate to parent dropped letters to it and then move and unparent them on something like a board that would move up every time a new text line is added to it then thinking higher up there could be something that beams through lines and could search for something like a value that has added or built up in line if some certain !"£$%^&*()_:@~<>? symbol or letter chains contain values or something that is set to activate something by something like [ if “Defined object” value = 5 ] then make something to happen depending on what you want to do or achieve. But many attempts to get something to work by working with text editors are failing and often i feel stuck in a dark space reminiscing times when i was writing some simple scripts for ultima online helping software called razor and available possibilities that it provides in order to make the character do more upon a single click. For example in a game theres a spell for example called Divine fury that refills characters stamina and adds other property values that decreases to 0 if character is carrying something more than character can hold on its every step being overweight. and after this action i would put in a loop that simply checks if target is poisoned as the character often is in battles and an option if the target is posioned which is already implemented in options it would execute a spell called cleanse by fire and remove the poison effect. Or even to check strenght value and if it is lower than your normal state without some offensive spells that lower characters strenght or other parameters it would execute a spell to remove curse so that and its decreasement or spells penalty and these if statements would work straight after executing their first actions and then turn on other loops that are keeping character in check. I found these things mindblowing for playing games but as you never know how good are scripts of those who are playing against you. Still… inspiring and makes me think how to make these things happen… then if something that beams through the line detects a value and if script pics up the value for something to happen yet and still i find coding a nightmare… somekind of thoughts of inventing your own type of coding or rewarding type of typing thing…But to be honest most of the things i liked about programming was an example of what .css files do with text and other things like to code for spacing and arrangement of stuff and to invent something similar like that in blender would probably take a while… or like these moments when you’re stuck repeating a tutorial for something like mysql database and you kinda feel huppy until some textlines light up indicating that a bit of code is correct or would work but how far do you stretch the whole context and paticular things in project towards your thing until errors keep beating me down… sorry my english is total disaster and my vocabulary allows me to express myself as good as i can, after learning many separate things about blender i notice how bits of knowledge or understanding are drawing a bigger picture towards understanding more about it and realizing how to make so many things happen but just a bit differently than in examples seen in tutorials. I’m glad to read that things i wrote here are impressive to someone as they are really for myself. Im mindblown and theres so much more to learn about this software. I guess i’ll just have to sink in this forum and try to pick up as much as i can about computing so that i can master my workflow towards something i keep thinking and modelling about @Kelthor what did You mean by OP’s?

Thinking out of the Box like this is exactly what would make you a good Programmer :hugs:! Maybe don’t start with Tutorials on coding for the Game Engine, but with pure Python or any other Language (maybe not C++ as a first one). If it still doesn’t appeal to you then, maybe it’s just not for you.

This Series is Great! And also it’s Python:

1 Like

Thanks. Going watch all of these now and also write down notes of what He is saying.

1 Like

OP stands for Original Poster. I.E, OP is a fantastic human being.

I think I have the brain for coding, but it just doesn’t interest me for whatever reason. I grew up with Legos, and I see the 3D world as a sort of extension of that, messing with blocks rather than numbers.

Still, I bet it would benefit me, and this thread has encouraged me to learn a bit more.

1 Like

Done right programming is like LEGOs too :stuck_out_tongue:

Anyway, it is just a matter of finding a project where writing Python/whatever is necessary (to some extend).


Maybe You could show me an example of some script in which You apply random.randint(1,10)
That would be really cool.

import random

def random_nr():

    rand_nr = random.randint(1,10)

Could You put it into .blend with a short instruction to demonstrate the result of it?

random_nummer.blend (506.7 KB)
left click to change number

I pressed P followed by left click but nothing happens

ah ok im using upbge.

You need to create your own .blend then.

add a text object, give it a text property
add mouse sensor - python -module mode- scriptname.random_nr (make sure the scriptname ends (in the text editor).

put the script in it and run it

import random

def random_nr(cont):
    own = cont.owner
    mouse = cont.sensors['Mouse']
    if mouse.positive:
        rand_nr = random.randint(1,10)
        own['Text'] = rand_nr

I added a mouse movement>and>visibility in logic editor for camera as nothing happens if i click left mouse after pressing P
I guess… the text property should be set on float?
I cant get it to work if i follow Your instructions.
But if i set the text property with float then text object itself turns into a decimal number.

randint.blend (414.0 KB)

Randomly on 10 positions. Cool… i made as random.randint(-16, 16)
As i understand they are moving by blender units like if i’d hold down CTRL and then would move it by clicking and dragging the axis?

randint.blend (444.8 KB)

Thanks! I really got it! This stuff widens me view and makes me think of so many possibilities.

Stroking Your fur, Fluff Fluff. Good Foxy!

Thank you for this link. Of all the Python tutorials, this seems like a great one to follow along with. I’m only 15 minutes in and I like how he gets you to do some code by yourself already. This playlist has been added to my “must watch”.