Jump to content

question about slothbot


Chaos

Recommended Posts

Posted

hi there

when i create 4 bots and set them mode hunting they will kill each others

i don't want to kill each others is that possible??

  • Moderators
Posted

set them in the same team.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
Team = createTeam('Test',255,0,0) 
  
function boss ( ) 
       nemesi = exports [ "slothBot" ]:spawnBot ( 1193.314453125, -2038.7626953125, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi1 = exports [ "slothBot" ]:spawnBot ( 1174.3984375, -2045.65234375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi2 = exports [ "slothBot" ]:spawnBot ( 1155.3125, -2021.0068359375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi3 = exports [ "slothBot" ]:spawnBot ( 1137.0380859375, -2037.9990234375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
        
setBotTeam ( nemesi ,Team  ) 
setBotTeam ( nemesi1,Team  ) 
setBotTeam ( nemesi2 ,Team  ) 
setBotTeam ( nemesi3 ,Team  ) 
 end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 
  
  

is that correct ?

  • Moderators
Posted

setBotTeam don't have to be exported?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
Team = createTeam('Test',255,0,0) 
  
function boss ( ) 
       nemesi = exports [ "slothBot" ]:spawnBot ( 1193.314453125, -2038.7626953125, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi1 = exports [ "slothBot" ]:spawnBot ( 1174.3984375, -2045.65234375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi2 = exports [ "slothBot" ]:spawnBot ( 1155.3125, -2021.0068359375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
       nemesi3 = exports [ "slothBot" ]:spawnBot ( 1137.0380859375, -2037.9990234375, 69.0, 90,  1, 0, 0, Nemesis, 38,         "hunting", true ) 
        
       exports [ "slothBot" ]:setBotTeam ( nemesi ,Team  ) 
       exports [ "slothBot" ]:setBotTeam ( nemesi1,Team  ) 
       exports [ "slothBot" ]:setBotTeam ( nemesi2 ,Team  ) 
       exports [ "slothBot" ]:setBotTeam ( nemesi3 ,Team  ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 

Omerta Roleplay

  • Moderators
Posted

by the way, read the syntax clearly.

element spawnBot ( float x, float y, float z, int rotation = 0, [ int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil, int weapon = 0, string theMode = "hunting", element theModesubject = nil ] )

You don't have to use an extra export.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
getBotTeam

returns the Team the bot is on, false if no team

Syntax

string getBotTeam ( element theBot) 

Maybe you should check that.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

EDIT

function boss ( ) 
       local Team = createTeam("Nemsis",255,0,0) 
       local nemesi = exports ["slothBot"]:spawnBot (1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
       local nemesi1 = exports ["slothBot"]:spawnBot (1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
       local nemesi2 = exports ["slothBot"]:spawnBot (1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following") 
       local nemesi3 = exports ["slothBot"]:spawnBot (1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 

Omerta Roleplay

  • Moderators
Posted

Why don't you check that with the function I gave you !!!!!

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
function boss ( ) 
    local Team = createTeam ( "Nemsis", 255, 0, 0 ) 
    local nemesi = exports ["slothBot"]:spawnBot (1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
    local nemesi1 = exports ["slothBot"]:spawnBot (1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
    local nemesi2 = exports ["slothBot"]:spawnBot (1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following") 
    local nemesi3 = exports ["slothBot"]:spawnBot (1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") 
    local botTeam = exports [ "slothbot" ]:getBotTeam ( nemesi ) 
    if ( botTeam ) then 
        outputChatBox ( "nemesi bot is on the team Nemsis" ) 
    else 
        outputChatBox ( "nemesi bot is not in a team." ) 
    end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 

Try that and see what it outputs to the chatbox when you start the resource.

P.S: Bots won't show up on the scoreboard ( TAB ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

So, that means that the bot is not being set to that team.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function boss ( ) 
    createTeam ( "Nemsis", 255, 0, 0 ) 
    local Team = getTeamFromName ( "Nemsis" ) 
    local nemesi = exports [ "slothbot" ]:spawnBot (1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi1 = exports [ "slothbot" ]:spawnBot (1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi2 = exports [ "slothbot" ]:spawnBot (1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi3 = exports [ "slothbot" ]:spawnBot (1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local botTeam = exports [ "slothbot" ]:getBotTeam ( nemesi ) 
    if ( botTeam ) then 
        outputChatBox ( "nemesi bot is on the team Nemsis" ) 
    else 
        outputChatBox ( "nemesi bot is not in a team." ) 
    end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 

Try that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function boss ( ) 
    local Team = createTeam ( "Nemsis", 255, 0, 0 ) 
    local nemesi = exports [ "slothbot" ]:spawnBot ( 1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi1 = exports [ "slothbot" ]:spawnBot ( 1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi2 = exports [ "slothbot" ]:spawnBot ( 1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    local nemesi3 = exports [ "slothbot" ]:spawnBot ( 1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) 
    setTimer ( 
        function ( b, b1, b2, b3 ) 
            local Team = getTeamFromName ( "Nemsis" ) 
            exports [ "slothbot" ]:setBotTeam ( b, Team ) 
            exports [ "slothbot" ]:setBotTeam ( b1, Team ) 
            exports [ "slothbot" ]:setBotTeam ( b2, Team ) 
            exports [ "slothbot" ]:setBotTeam ( b3, Team ) 
            local botTeam = exports [ "slothbot" ]:getBotTeam ( b ) 
            if ( botTeam ) then 
                outputChatBox ( "nemesi bot is on the team Nemsis" ) 
            else 
                outputChatBox ( "nemesi bot is not in a team." ) 
            end 
        end 
        ,1000, 1, nemesi, nemesi1, nemesi2, nemesi3 
    ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Copy it again.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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