3B00DG4MER Posted March 10, 2015 Share Posted March 10, 2015 Hi guys, i'm making a bot follows player and I don't know if problem was from Slothbot resource or My Code Server : local bot = call ( getResourceFromName ( "slothbot" ), "spawnBot", x,y,z,0,0,0,false,0,"following",p) Slothbot : https://wiki.multitheftauto.com/wiki/Slothman/Slothbot Link to comment
3B00DG4MER Posted March 10, 2015 Author Share Posted March 10, 2015 Oh I forgot, this is code of Slothman, It's should return the ped but when I call it won't function spawnBot(x, y, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) --checks the function commands to see if all neccesary parts are filled, sets defaults if not or returns false. if not x then return false end if not y then return false end if not z then return false end if not rot then return false end if not skin then skin = 0 end if not interior then interior = 0 end if not dimension then dimension = 0 end if isElement(team) == false then team = nil end if not weapon then weapon = 0 end if not mode then mode = "following" end if not modesubject then modesubject = client end if mode == "following" then if not modesubject then return false end end if mode == "chasing" then if not modesubject then return false end end local slothbot = createPed (tonumber(skin),tonumber(x),tonumber(y),tonumber(z))--spawns the ped if (slothbot ~= false) then triggerEvent ( "onBotSpawned", slothbot ) setTimer ( setElementData, 200, 1, slothbot, "slothbot", true ) -- makes it a bot setTimer ( setElementData, 200, 1, slothbot, "AllowFire", true ) -- makes it able to shoot when it wants setTimer ( assigncontroller, 300, 1, slothbot ) --sets the bots controller setTimer ( giveWeapon, 800, 1, slothbot, tonumber(weapon), 99999, true ) --gives the weapon setElementData(slothbot, "BotWeapon", tonumber(weapon)) if team ~= nil then setElementData(slothbot, "BotTeam", team) end setTimer ( setElementInterior, 100, 1, slothbot, tonumber(interior)) --sets interior setTimer ( setElementDimension, 100, 1, slothbot, tonumber(dimension)) --sets dimension --sets the mode if mode == "waiting" then setTimer ( setElementData, 600, 1, slothbot, "status", "waiting") elseif mode == "following" then setTimer ( setElementData, 400, 1, slothbot, "leader", modesubject ) setTimer ( setElementData, 600, 1, slothbot, "status", "following") elseif mode == "chasing" then setTimer ( setElementData, 400, 1, slothbot, "target", modesubject ) setTimer ( setElementData, 600, 1, slothbot, "status", "chasing") elseif mode == "guarding" then setTimer ( setBotGuard, 400, 1, slothbot, x, y, z) else setTimer ( setElementData, 600, 1, slothbot, "status", "hunting") end return slothbot end end Link to comment
xXMADEXx Posted March 10, 2015 Share Posted March 10, 2015 Looks like you forgot the "dimension" parameter. Try this local bot = call ( getResourceFromName ( "slothbot" ), "spawnBot", x,y,z,0,0,0,0,false,0,"following",p) Link to comment
3B00DG4MER Posted March 10, 2015 Author Share Posted March 10, 2015 I've set the mode "following" but he keep chase anyone and try to kill him Link to comment
Moderators IIYAMA Posted March 11, 2015 Moderators Share Posted March 11, 2015 I think, the bot is thinking for himself. So he has it's own priority. Setting him to following, will only have result when there is nothing to shoot at. But it is just a guess, since I took a peek in the resource a while ago. Link to comment
3B00DG4MER Posted March 11, 2015 Author Share Posted March 11, 2015 I've set him follow me but he still chase me Link to comment
Moderators IIYAMA Posted March 11, 2015 Moderators Share Posted March 11, 2015 Why don't you set him in your team? Link to comment
3B00DG4MER Posted March 11, 2015 Author Share Posted March 11, 2015 cuz there's many players and he can't be in all teams Link to comment
Moderators IIYAMA Posted March 11, 2015 Moderators Share Posted March 11, 2015 Then you have to edit the slothbot and base teams on elementdata instead of teams. Link to comment
3B00DG4MER Posted March 11, 2015 Author Share Posted March 11, 2015 I think it's, setTimer ( setElementData, 600, 1, slothbot, "status", "following") -- I found that on script Link to comment
Moderators IIYAMA Posted March 11, 2015 Moderators Share Posted March 11, 2015 I don't think so, it probably would be interrupting the system. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now