Jump to content

[REL] SlothBot an AI fighting Bot for MTA


Slothman

Recommended Posts

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

slothman, better return bot element if bot is spawned, then its posible for scripters to integrate own features

document that spawnBot will return bot element, not bool

-----------------

ped nametags from peds resurce(credits to 50p)

addEventHandler( "onClientRender", getRootElement(),function()
for k, myPed in pairs( myPeds ) do
local x, y, z = getElementPosition( myPed )
if isElementOnScreen( myPed ) then
local X, Y = getScreenFromWorldPosition( x, y, z )
if X then
dxDrawRectangle( X - 30, Y - 20, 60, 10, tocolor( 0, 0, 0, 120), 10 )
local health = getElementHealth( myPed )
local lineLength = 56 * ( health / 100 )
dxDrawRectangle( X - 28, Y - 18, lineLength, 6, tocolor( 255, 0, 0, 100 ), 6 );
end
end
end
end)

Edited by Guest
Link to comment

This looks nice, maybe you can have an EDF where you can place bot spawnpoints and in their properties, you can set their skin, team ( Which will have the default team colour ), name and so on.

Justnow, I think you have to script bots into maps and since I don't have a clue on much scripting, it might be a bit hard for me to script bots into a load of maps.

Anyways, it looks good so far, keep up the good work.

Link to comment

Yeah that really rocked the bot system, SA-MP can't do that yet!

Bot scripting Capabilities score graph (not that perfect :P):

5|      - 
4|      -
3|      -               -
2|      -               -
1|      -               - 
   MTA Bots       SA-MP bots

Hey actually I sucessfully created a bot already. Thanks Sid the Sloth(man)! You rock! :D

Link to comment

honestly ive never seen the samp bot in action, i hear conflicting stories about what it's capable of. I've really focused on the fighting aspect of the bot so far, but im sure other capabilities wouldnt be hard to add (ie: driving)

Link to comment

Hmm okay then.

Since MTA bots are 3x better (+shooting and targeting capability), I'm sure SA-MP bots are knocked out for good.

To all newbies:

Here's the simple example of creating a bot which will chase and kill the creator of the bot (bots can also shoot each other too sometimes) with a command "spawnbot"

bot.lua (Server-side):

function Spawnbot1 (source)
local x,y,z = getElementPosition (source)
local rot= 90
local skin=220
local interior=0
local dimension= 0
local team=false
local weapon=26
local mode= "chasing"
local modesubject=source
call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject)
call (getResourceFromName("slothbot"), "spawnBot", x, y+7, z, rot, skin-9, interior, dimension, team, weapon+2, mode, modesubject)
end
addCommandHandler("spawnbot", Spawnbot1)

call is a function to take functions from other resources. Slothbot uses one of these. Wiki: https://wiki.multitheftauto.com/wiki/Call

And don't forget about the Meta.xml that you need to export the function!

<meta>
<info type="script" author="XX3" Version="1.0" name="Simple bot script" />
<script src="bot.lua" type="server" /> -- The bot script file
<export function="spawnBot" type="server"/> --This is the function you want to export
meta>

Link to comment

any gamemode creators who need help implementing the bots, or any questions on modifying the script, don't hesitate to ask me. I check the forum and irc religiously, and i really would like to see this bot used (just to prove to myself it wasnt a waste of time)

Link to comment
any gamemode creators who need help implementing the bots, or any questions on modifying the script, don't hesitate to ask me. I check the forum and irc religiously, and i really would like to see this bot used (just to prove to myself it wasnt a waste of time)

I tried to contact you with the pm, but you don't response.

Link to comment
  • 2 weeks later...
  • 3 weeks later...
  • 4 weeks later...

hello everyone, i'm having trouble to istall the slothbot, if someone can tell me step by step..

i download the slothbot..

go to mta folder,mta resources and replace sbtest, then, i create a server and use the command spawnbot? is it?

can someone help me?

grateful.

Link to comment

guys i am having trouble setting bot as my teammate can some please help me

function Spawnbot1 (source)

local x,y,z = getElementPosition (source)

local rot= 90

local skin=285

local interior=0

local dimension= 0

local team="BotTeam"

local weapon=21

local mode= "following"

local modesubject=source

call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject)

call (getResourceFromName("slothbot"), "spawnBot", x, y+7, z, rot, skin-9, interior, dimension, team, weapon+2, mode, modesubject)

end

addCommandHandler("spawnbot", Spawnbot1)

as u can see it's team BotTeam i made that botteam too in my server with panel adn put mysellf in it but bots follow me adn kill me why they kill me? it said it follows a teammate if it's following on wiki slothman resource can somone plz help adn nice resource btw slothman :D

Link to comment

exactly, its one of the hardest things to remember is to not use the team name as the team element, even when i was scripting it i forrgot that fact and had to go back and revice it.

TheDynho : the new slothbot resource isnt the same as sbtest. that was an older script i made with an early version of the slothbot. in order to use the slothbot now, you need to actually script something to spawn a bot. a cmmand to spawn a bot would be simple, the above script that ahmedkhaled posted is a good example of that. but you could also write a script that spawns bots in a gamemode automatically, or even make something like a marker ingame that when you walk into it, it'll spawn a gang member for you

Link to comment
  • 2 weeks later...

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