Object disappearing

I have a problem, I’ve searched the forums but couldn’t find anything about this one…

I have an object that disappears at a particular point in my game. I read somewhere that this is likely to be an actuator that’s not set up properly, but I can’t see any problem… :confused:

Here is the link to file .blend file http://www.savefile.com/files/146409

It’s supposed to be a pirate AD&D style RPG game. I’m just working on the combat part of the game at present.

Pathfinding, melee and shooting all work fine. AI for pathfinding and melee work fine (if a little basic) :slight_smile:
But the problem is in trying to get AI shooting happening.

It’s fairly complex, but if you grab the file and have a look at the README text, hopefully the problem will be clear…

I am using Blender 2.41 to make it.

Any assistance would be greatly appreciated!

The game is already very complex, and I am trying to figure out what isn’t working right. Gimme a few more minutes and I might come up with something.

btw, not all your textures are packed :eek:

cool game!!! will try to find the problem…

nothing wrong only very VERY SLOW!!!

could you (or someone else) explain the pathfinding a little? or point me to some place where I can learn it. Have been trying some by myself, but with slow progress.

oops… :o

I have edited the first post with the link to the new file (this one has all the textures packed.)

Hmmm… let me try to explain my problem. It’s pretty specific which is why I’m having so much trouble with it…

Do the following to replicate my problem:
http://testchurch.davisco.com.au/pirateproblem.jpg

1: move the first guy to the position shown in picture 1
2: Hit U key to make the 2nd guy (with the bow) go automatic - he should walk to here and shoot at the badguy
3: end the first guys turn (E key) then when the guy with the bow get’s his turn he won’t stand still and shoot as he is supposed to but he walks up to the guy.

Here’s the problem: See that white rectangle in pictures 1 and 2? in picture 3 it’s missing.

It is just there for debugging purposes, but it disappears because the empty which is it’s parent disapears. The empty is called “nearsensor”

I need to work out how to stop that empty disappearing… I hope that makes sense…

Yes it is very slow at the moment, I have a few ideas about how to make things faster, but I just need to get it working first.

Sim88 - watch this space, I’ll try to explain what I have done, but give me a couple of days to get it all sorted out into some sort of clear order (first in my brain, then in some sort of explanation)

Thanks everyone for your replys so far…

sim88 (and anyone else who’s interested): here’s an attempted explanation of the pathfinding I have used…

The game area is divided into squares. in my game the squares are 1x1 blender units, with the centre of each square being the integers.
so when a chracter is standing in a square they are on integer coordinates (eg: [0,0], [1,0] etc)

I haven’t used the z axis for much so we can ignore it for this example. But I have used the 3rd set of coordinates to store information about the square. (eg: # means unpassable, character means a character is in this square, charattack means this character is the target being attacked, a number is used for passable squares to find the shortest distance)
First of all you need a “start point” and an “end point” (pairs of coordinates) (in my project: script- ray, def- characterMove)
then, basically you have to find your way from the end to the start. Every square you check gets assigned a time, then going from the start you move the character to the square that has the lowest time - that will always be the shortes path to the end point.
(This part is in script- point)

set the time of all passable squares to a ridiculously high number (my project: 1000)
set variable time = 0
set the time of the end square to variable time (0)
set time = time + 1
check every square around the end point if it is passable and not timestamped give it a timestamp of value time (1)
check every square around each of these squares and timestamp these if not done and passable, incrementing time after each layer of squares is checked.
if one of the squares being checked is the start square, stop.

(This part done in script- move)
Then when you move the character from the start point, check the squares around him and find the one with the lowest timestamp - move him to that one. The repeat this until he reaches the end one.
It’s very confusing theory and I’m sure my code is even more confusing. I found it helpful to sit down with some graph paper and a pencil and work out some examples to see what it looks like. I’ll dry and draw one up here:

key:
1000 = unmarked pasable squares
End = end point
start = start point

= unpassable (wall, etc)

…| …-2…|…-1…|…0… |… 1… | …2
----±----------±--------------±--------------±--------------±---------------
2 …| …1000… | …# …| …1000 …| …1000 …| …1000
----------------±--------------±--------------±--------------±---------------
1 …| …1000… | …# …| …1000 …| …1000… | …1000
----------------±--------------±--------------±--------------±---------------
0 …| …End… | …#… | …1000… | …1000… | …1000
----------------±--------------±--------------±--------------±---------------
-1 …| …1000… | …#… | …1000…| …# …| …1000
----------------±--------------±--------------±--------------±---------------
-2 …| …1000… | …1000… | …1000… | …#… | …Start

MARK ALL SQUARES UNTIL THE START IS REACHED
…| …-2… | …-1… | …0… | …1… | …2
----±----------±--------------±--------------±--------------±---------------
2 …| …2 …| …# …| …6… | …6 …| …6
----------------±--------------±--------------±--------------±---------------
1 …| …1 …| …# …| …5 …| …5 …| …5
----------------±--------------±--------------±--------------±---------------
0 …| …End(0) . | …# …| …4 …| …4 …| …5…
----------------±--------------±--------------±--------------±---------------
-1 …| …1 …| …# …| …3 …| …# …| … 5
----------------±--------------±--------------±--------------±---------------
-2 …| …2 …| …2 …| …3 … … | …#… | … Start(6)

To get the path from start to end, simply follow the lowest number - if there are 2 possible lowest numbers it doesn’t matter which one you go to they will both get there in the same number of moves.

The algorithm is called “antrace” you could do a search for it and see if you can find a better explaination…
My code is only ever going to be useful for turn based pathfinding because it chugs the framerate for a second or so - that’s wont make a difference because it takes longer then that for a human to make a decision and when the computer is having a turn it only moves one person at a time. This code would need some serious optimizing before it could be used for anything else…
I hope this is helpful, feel free to ask me any questions you have and I’ll answer them as best I can, or better yet if some adventerous souls wanna use my code and optimize it, that would be pretty cool.
I hope this is is a helpful contribution to the blender community. (feel free to use any of my scripts for any purpose.)

thank you! will try it out and hunt you down for questions later