Can AI be cleared by using the bricks after a task has been completed?

(modelinblender) #1


Just thought I’d see if it is possible? I don’t think it was. So a check system, AI 1 is removed, 2, 3, and then scene needs to go to another scene to give confirmation or instruction.

(BluePrintRandom) #2


if objective achieved-----and-------set property in ai

if property is = what you set------do other thing

(modelinblender) #3

Not sure how that would work. Would python code be a better and quicker option for this?

(theoldguy) #4

I personally wouldn’t use python for that. If I have an AI script on the object and then delete the object in python, AI.endObject() I usually get an error, (because I suck at python). Instead I use a logic brick to end the object. Then I get no errors.
There is a way to do it in python though, so it’s up to you.

(modelinblender) #5

Well I prefer the bricks setup, but as others have stated with what I produced, it isn’t possible to do much with them, and if so, a lot of effort, and has buggy results.

I may plan to expand on this file, using bricks to get a character moving to a location. I tried that with a WIP file last year, was inspired from a game, but it never worked out due to the problems with getting AI to go to one place and then other, so timed and all of that.

(theoldguy) #6

You can do way, way more with python, than with logic bricks. But you can still make a small game with bricks. It’s been done before. As long as you keep your expectations low. You can also use both, python and logic bricks.

you can do that with bricks. I use the track-to actuator, it’s cheap and easy.
(cheaper than navmesh I think)

place nodes where you want your character to move to. Just a simple Plane, static, invisible, ghost, and give it a property.
“N1” boolean for example. name it something, “Node1” maybe, don’t matter.

Use states. If you want the character to move when the game starts, use state 1. if not use state 2.

on state 1-- Always, level, pin it so you can re-use it on state 2.

So - Always------and-------trackto “Node1” and a motion brick and your walk/run action. So the char will move to the Node1 plane. when he collides with the “N1” plane property, change the state to do something else.
collision “N1” ----- and------state 2.

on state 2. move to another node, or play an animation, whatever you have in mind.

I made an entire city with lots of people walking here and there, from home to a store, etc. using this method.

like this
nodes test.blend (1.1 MB)

(Cotaks) #7

just use simple messages for this.

When ai dies send a message.

then on an empty (or any object) you put a receiver for messages.
now if the receiver gets a message it increase a property by 1.

now you can simply use a property brick, if property equals 3 then load new scene/blend.

(theoldguy) #8

That will work, as long as the player doesn’t toss a grenade, or use an RPG to kill all the AI (enemy?) at once. (assuming AI are spawned) If so, only one message will be sent. Even though all AI died.
That’s where Python would be needed I think. :slight_smile:

For clarity;
AI = enemy?

(Cotaks) #9

depends on enemies indeed.

if multiple different enemies they can simply send different messages (for ex. enemy_1 killed, enemy_2 killed, etc). For multiple enemies that are spawned in, it gets harder, as @theoldguy mentioned they indeed will all send the same message, the downside of messages, the same message can only be received once per frame. on the same object)

python will then be indeed the way to go.

ai = enemy in this case indeed

(theoldguy) #10

Monster wrote a script that will handle this, it’s called MessageCount and works well in this case. All enemies send the message when dead. It’s probably in his signature. if not I think I still have a copy of the blend on my HDD if anyone needs it. :slight_smile: