I’ve seen a random actuator script in the “bunny loader” demo file, and I was wondering if anyone’s made a better one, or if that is a good script.
How would I go about placing/adding an object at the mouse’s position in python? I’m not sure how to get the mouse’s position. (I am trying to create way-points)
Is there any way to remove the blender window bar at the start of a game?
Do you mean, make the game full screen? In the render buttons is a drop-down panel called “Game Framing Settings”. In this is the setting for full screen as well as screen resolution etc.
I don’t think so - not any more. there used to be a full screen button several versions back, but I think it was removed as it was a bit of a crash magnet.
You might be able to script something? Otherwise it’s just down to CTRL-UP and CTRL-DOWN to maximise the play window.
I never looked over the “bunny loader” demo file, but I would just do the following for some random actuator action:
g = GameLogic
cont = g.getCurrentController()
# Call the actuators in bulk. So, when you have all your actuators connected to the
# python controller, "acts[0]" will call the first actuator from the top, and "acts[1]" the
# second, and so on...
acts = cont.getActuators()
rand = int(g.getRandomFloat() * 5) # Six possibilities: 0,1,2,3,4,5
g.addActiveActuator(acts[rand], 1) #Activate based on random
How would I go about placing/adding an object at the mouse’s position in python? I’m not sure how to get the mouse’s position. (I am trying to create way-points)
Hmm, I think you’re looking for the position in the “gamespace” that the mouse is over at the given moment.
Maybe something like:
from Rasterizer import showMouse
showMouse(1)
cont = GameLogic.getCurrentController()
marker = GameLogic.getCurrentScene().getObjectList()["OBmarker"]
mouse = cont.getSensor("mousesenname")
mpos = mouse.GetRayTarget() # Returns "mouse over ray" hit pos
marker.setPosition(mpos)
Never actually tested that one, but it makes sense to me. Play around with it, see what you get.
Is there any way to remove the blender window bar at the start of a game?
Not that I know of.
GetRaySource() doesn’t return the ray hit position. It records the ray casting “starting point.” Of course, I’ve never tried it either. I think this function could be useful for setting up custom cursors. I’m going to play around with it for a bit, and I’ll let you know what I come up with.
This is awesome! I just threw together a new custom cursor script! It works so much more reliably than the old methods. Once I get a decent texture on the cursor, I’ll start a new thread with the .blend file.
Hey Social
How would you get the number of actuators and use that as the random multiplier, so you can use the script on objects with different amounts of actuators?
Hey, an important note on that “GetRaySource()” function. The API Documentation show the “G” as a capital letter, but it is really lower case (which is standard for Blender Python functions). The real name for the function is “getRaySource()”. This is an important distinction since Python is case sensitive.
Thanks everybody! That helps a whole lot. Aahh, the wonderful creativity, inspiration, and knowledge of these forums:)
Social: That is some good stuff, I’ll definitely play with that!!
blendenzo: I’m glad this thread inspired you to great things…or something like that!
The reason I wanted to get rid of the windows bar was that it screws with an upward movement of the mouse. However, as long as it’s good in an exe, it doesn’t matter that much.
Thanks again,
~~Stu_Flowers
P.S. - These questions were for an up-coming RTS template. Following in Social’s footsteps? Just wait…