Jump to content

[REL] SlothBot an AI fighting Bot for MTA


Slothman

Recommended Posts

Btw, I've noticed one thing: if there are no players on your server and you start resource 'slothbot' and your bots-resource (to spawn some bots on the map) through a console, the bots won't be moving even if you will walk near them.

The trick to get rid of this is simple: restart resource if you are the first joined player.

addEventHandler( 'onPlayerJoin', root, function()
if #getElementsByType( 'player' ) == 1 then
restartResource( getResourceFromName( 'slothbot' ) );
end;
end);

Anybody had such problem ?

---

if someone could make a gui for freeroam

*facepalm*

Link to comment
  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

It must be your script. the bot will only be created 1 time. but if you are the person who had the trouble with spawning bots using "onResourceStart", then you need to make sure you don't have it set to happen when EVERY resource starts.

Link to comment
  • 1 month later...
  • 3 weeks later...

k i tried something with the example spawn script, this is the code:

It's about spawnbot1, it says bad argument @ Getelementinterior and dimension, string defined function, what am i doing wrong?? Sorry for asking, but i would really like bodyguards etc.

EDIT: it starts now, but doesnt set it in team GNR, new code:

  
  
function Spawnbot1 (source) 
local dimen = getElementDimension (source) 
local inter = getElementInterior (source) 
local x,y,z = getElementPosition (source) 
local rot= 90 
local skin=220 
local interior=inter 
local dimension=dimen 
local team=GNR 
local weapon=26 
local mode= "guarding" 
local modesubject=source 
call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin-9, 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) 
  
function Spawnbot2 (source) 
local x,y,z = getElementPosition (source) 
local rot= 90 
local skin=22 
local interior=inter 
local dimension=dimen 
local team=GNR 
local weapon=26 
local mode= "guarding" 
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, interior, dimension, team, weapon+2, mode, modesubject) 
end 
  
addCommandHandler("spawnbot2", Spawnbot2) 

Thanks for any help

btw yes i am team GNR i set it in admin panel

EDIT2: lolz sorry it works now, i should have looked it trough better before posting :(

EDIT3: 1 question, i would like to make it respawn after death, how to use onbotwasted, im kinda a noob :)

coul i do this: addEventHandler ( onBotWasted, Name bot, function ) will that work?

Link to comment
  • 2 months later...
  • 1 month later...

Hey Slothman. I making some gamemode using your resource, and i have one problem.

I made paths in Map Editor, than i connected them together.

In gamemode, i spawn bots at this paths, but bots just staying on the one place, they only start move when some player running at them

Link to comment
  • 4 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...