Using EndObject actuator from python script?

Hi, all.

Still learning the basics here, and have come up against a small problem. As I mentioned in my previous thread, I’m trying to make a small bomberman clone, which has left me with two main problems: one, duplicating objects with ghost properties, I’ve set aside for the moment, and the second I am now trying to deal with is ending objects from a python script.

I’ve got my bomb object in a second layer and have given it a timer property of boom. When I hook this up directly to an end object actuator via an expression controller boom > 5, it disappers as expected. However, I need to write a python script to handle removing the blocks it can destroy via a ray sensor, so I need to migrate that functionality into a script.

I think I’m doing it correctly - I see no errors in the consol - but the bomb objects refuse to be destroyed. Do I need anything other than:

endObject = cont.getActuators(“myEndObjectActuator”)
GameLogic.addActiveActuator(endObject, 1)


Any help appreciated!

it should be cont.getActuator() . Actuator should not be plural. I assume you remembered to set up the beginning, such as from GameLogic import * , and defining own and cont?


Damn s key…

Thanks, PlantPerson. I’m going to go slink away in shame now…


Just as a tip…getActuators() produces an array (list) of all the actuators connected to the controller. Then you could tell them to all fire at once, or randomly choose a certain one.

That, by the way, is the first time I’ve answered a Python question. A historic moment. Maybe.

Huh - didn’t know that. Guess it explains why there wasn’t an error in the consol window. Good to know, though - thanks, Toomai.

And Plantperson, the date has been noted - your biographers alerted. Expect a call sometime later today. :slight_smile:

And, if you want to make it a two-fer, maybe you could explain to me why a ray sensor testing for a particular property is firing like an always sensor, even when the desired object is nowhere in line of site?

That’s actually not a Python question. Rays tend to trip if the object casting them has the property they’re looking for.