Problem with "End Object".

Hi,

Yesterday evening I followed some tuts from the noob-to-pro wiki about the Game-engine, and learnt a lot of new things. I wanted to make a kind of “Cannon-ball” game.

I use “add-object” for the bullets.
I want the bullet to disappear when it EITHER hits the floor or the enemy tower. I used
“bullet --> collision with floor --> end object”
and
“bullet --> message “Health-1” —> end object”

This doesn’t work very good, as when I shoot 4 bullets,

  • they disappear 1 after another (when they hit the floor), which is ok
  • they disappear all simultaniously as soon as the first bullet hits the enemy tower.

Could someone please take a look at the .blend, and tell me why they don’t disappear one after another in the second case?

(Be warned, I haven’t named the sensors & actuators yet, and some of the functions work only from tower a to tower b, not from tower b to tower a)

The file:
http://www.4shared.com/file/14969990/624bcddc/Cannon.html

Thanks in advance,

Svenniemannie

I can’t look at the .blend right now because I’m at work, but it sounds like the problem is with the message sensor. I’m guessing that when the bullet hits the tower, the tower sends out a message, right? Well messages are global (meaning they get sent to every object), so every time a bullet hits the tower, it sends the message to all of the bullets and they all end. You will need to find a different way to communicate with the bullets (maybe just use the collision method like you did with the floor). Hope that helps.

Thanks for the reply. I thought of the same thing this morning when I woke up :slight_smile:

I also can’t remember why I chose to use the message instead of collision:spin:

Question answered.

(But I might come up with other questions)

And I was right :slight_smile:

I fixed that old thing, and named (almost) all sensors & acuators, and made the actions possible in both directions.

When I play the game in blender, this happens:
(Note, player one is right, player 2 is left)

10 shots from the right to the left (player 1 to player 2), they all hit. Property “healthplayer2” is 0 –> send message “player2down”. Everyone receiving this message, (which are “baseplayer2” and “shooterplayer2”) terminate themselve by “End object”. This works fine.

Now exactly the same, but from the left player to the right. All actuaters etc same name, only player1, not player2. After the 10th hit, the base and shooter disappear, but as soon as a new bullet is added to the scene, blender shuts down.

Anyone tips?
The file:
http://www.4shared.com/file/15023986/89764570/_2__Cannon.html

Controls:

Player1 (right)
Turn up: Arrow-right
Turn down: Arrow-left
Increase power: Arrow-up
Decrease power: Arrow-down
Shoot: Space

Player2 (left)
Turn up: a
Turn down: d
Increase power: w
Decrease power: s
Shoot: f

Thanks for looking!

EDIT: The first 5 times or so blender just shut down. Last time I got a message:

When you run the game look in the console window and see if anything is happening there. Usually when blender crashes, you have a coupld seconds to see whats happening there.

I’m still trying to get a screenshot, but I didn’t manage to get it yet, blender shuts down very fast :slight_smile: (Within 0.5 seconds :S)

But I managed to read one thing:
“Pure virtual message fail” or something like that.

EDIT:
Sometimes a screencaptureprogram can help :slight_smile:
This is the message that comes up when blender shuts down. (Only last two lines.)

Extra; How can I change the thread-title?

Attachments


Extra; How can I change the thread-title?

To change the THREAD title Go to ADVANCED.

So you have a python error.

One question… What OS are you using. I tried it with Windows XP, SP2. No error found. Tried it about 10 tiems, using both the tanks/bunkers at time as well. I also used Blender 2.43. One thing to try is, if you recently upgraded to 2.43 try unistalling and reinstalling Blender. Might have been a glitch during install.

I’m using windows XP. Not sure what SP though… I could check if I’m using blender 2.43, and not .42, because when I start up blender 2.43, and open a file, it automaticly searches in the 2.42 map. (Very often). Maybe I start up blender2.42 sometimes too…

So, you are opening the game with the wrong version then?

No, I just checked, it’s definitely 2.43…

Ok so i retried it… I got an error to happen, only when both tanks die at the same time or are going to die together. If that is what’s causing it, how I got it to fix, and not quit when they both die, was to add another object(just a cube). Not sure if that is what is causing your error though. I am guessing that the scene is looking for an object, but cannot find it. I haven’t tried it in the camera view yet to see if the error is diplayed there too or not. I will get back to you on that one.

Edit:
It gives the error in the camera view as well… So the cube doe not work there. I will let you know if I figure anything else out.

svenniemannie,
I have fixed the blend and here is the link.
http://www.box.net/shared/kh5shklmo2
From what I found out, was that as a player died, and the bullet was still visible, but the item that added it was destryoed, that was the error that I was getting. What I did, if you look, is when the message is sent, instead of ending the gun(which adds the bullet), it changes to invisible, so the bullet can continue. Also, the cube is set to receive the messages and when both players are destryoed, it restarts the scene.
Edit: I also set the camera view up.

Hope that helps.

Thanks for taking a look at it. When I have a little more time I’ll download the .blend.

Thanks:)