Jump to content

Slothbot spawnBot.


DRW

Recommended Posts

Posted

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) 
  
  

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

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.

Posted

Probably the bot is entering the marker. You should definitely check the element entering inside the function.

Try logging everything you work with (the bots created and the element entering the marker) You should see what is entering this way.

My GitHub

function brain()   return nil end 
Posted
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!

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
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.

Posted

Thanks but I still have a problem, when I shoot them they dont get damaged

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

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...