Jump to content

[Help] Bot script using slothbot


JuAnY

Recommended Posts

Posted

Hi, I need another help, this time with a simple resource that use slothbot.

This generates 5 bots in a random position near the player to attack him with random skin/weapon, but sometimes one or two bots dont die and they keep jumping around me, I dont know if its a problem with my script or is a bug of slothbot. :-k

local skins = {102, 103, 104, 108, 109, 110, 114, 115, 116, 121, 122, 123, 173, 174, 175, 124, 105, 106, 107, 19, 21, 22, 28, 29, 67, 15, 20, 165, 73, 179, 287, 280, 282, 283, 284, 285, 286} 
local armas = {22, 24, 25, 27, 28, 32, 30, 31} 
local prtabla = {-2, -4, -6, -8, -10, -12, -14, -16, -18, -20, -22, -24, -26, -28, -30, -32, -34, -36, -38, -40, -42, -44, -46, -48, -50, -52, -54, -56, -58, -60, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60} 
  
function Spawnbot1 (bot) 
    local x,y,z = getElementPosition (source) 
    local rot=90 
    local interior=0 
    local dimension= 0 
    local team=false 
    local mode= "hunting" 
    local modesubject= source 
     
    exports[ "slothBot" ]:spawnBot (x+prtabla[ math.random( 1,#prtabla)], y+prtabla[ math.random( 1,#prtabla)], z, rot, skins[ math.random( 1,#skins)], interior, dimension, team, armas[ math.random( 1,#armas)], mode, modesubject) 
    exports[ "slothBot" ]:spawnBot (x+prtabla[ math.random( 1,#prtabla)], y+prtabla[ math.random( 1,#prtabla)], z, rot, skins[ math.random( 1,#skins)], interior, dimension, team, armas[ math.random( 1,#armas)], mode, modesubject) 
    exports[ "slothBot" ]:spawnBot (x+prtabla[ math.random( 1,#prtabla)], y+prtabla[ math.random( 1,#prtabla)], z, rot, skins[ math.random( 1,#skins)], interior, dimension, team, armas[ math.random( 1,#armas)], mode, modesubject) 
    exports[ "slothBot" ]:spawnBot (x+prtabla[ math.random( 1,#prtabla)], y+prtabla[ math.random( 1,#prtabla)], z, rot, skins[ math.random( 1,#skins)], interior, dimension, team, armas[ math.random( 1,#armas)], mode, modesubject) 
    exports[ "slothBot" ]:spawnBot (x+prtabla[ math.random( 1,#prtabla)], y+prtabla[ math.random( 1,#prtabla)], z, rot, skins[ math.random( 1,#skins)], interior, dimension, team, armas[ math.random( 1,#armas)], mode, modesubject) 
  
    outputChatBox("Mata a todos los enemigos!", root, 255, 0, 255, false ) 
     
end 
addCommandHandler("bot", Spawnbot1) 
  

Posted

Im trying with timer but the error continues...

When debugscript get: "ERROR: slothbot\sbclient.lua:115: Attempt to compare boolean wth number"

Im going crazy, I cant find the solution :roll:

Posted
Im trying with timer but the error continues...

When debugscript get: "ERROR: slothbot\sbclient.lua:115: Attempt to compare boolean wth number"

Im going crazy, I cant find the solution :roll:

Put the part where the error exist

Posted
I change the code a little bit, I did appear less bots and was fixed :D

Great to hear that, also do what i told you in my 2nd post it, to check after killing the bot if he exist then destroy it to avoid bugs

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