Jump to content

Slothbot spawnBot.


DRW

Recommended Posts

Hello.

I've tried to create a server-sided marker linked to a function that spawns a slothbot bot, it appears and shoots when he sees me. For now all works perfectly, but the problem is that when the bot sees me, another bot appears in the same place he is at, and another, and another...

After all, bots don't even get damage when they get shot.

What did I do wrong and how can I solve both problems?

Server

  
Marker2a = createMarker (-2065, -118, 52,"cylinder",80,100,255,150,0) 
function botenemy1 
()enemy1a = exports [ "slothBot" ]:spawnBot(-2068,-144,35,0,2,0,0,enemies,22,"guarding") 
end 
addEventHandler ("onMarkerHit", Marker2a, botenemy1) 
  
  

Link to comment

You mean multiple bots are being spawned? That would only happen if you hit marker multiple times, is it happening even when you hit marker only once? In that case, provide rest of the code so that we can detect where else this bug might be, maybe in a loop or something.

Link to comment
You mean multiple bots are being spawned? That would only happen if you hit marker multiple times, is it happening even when you hit marker only once? In that case, provide rest of the code so that we can detect where else this bug might be, maybe in a loop or something.

Oh I forgot other map elements can count as hitelements, thanks!

Link to comment
You mean multiple bots are being spawned? That would only happen if you hit marker multiple times, is it happening even when you hit marker only once? In that case, provide rest of the code so that we can detect where else this bug might be, maybe in a loop or something.

Oh I forgot other map elements can count as hitelements, thanks!

My pleasure, and like rain_gloom said, you can also add a check to see whether the hitelement is a player or some other element.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...