Adissonboy11 Posted July 11, 2015 Posted July 11, 2015 I need my bots are more hardcore, please. Any solution? Client-side function banditGetDamageDayZ ( attacker, weapon, bodypart, loss ) cancelEvent() if attacker and attacker == getLocalPlayer() and getElementData(source,"trorist") then damage = 100 if weapon == 37 then return end if weapon == 63 or weapon == 51 or weapon == 19 then setElementData(source,"blood",0) if getElementData(source,"blood") <= 0 then triggerServerEvent("onBanditGetsKilled",source,attacker) end elseif weapon and weapon > 0 and attacker and getElementType(attacker) == "player" then damage = getWeaponDamage(weapon) if bodypart == 9 then damage = damage*4 headshot = true end setElementData(source,"blood",getElementData(source,"blood")-math.random(damage*0.75,damage*1.25)) if getElementData(source,"blood") <= 0 then triggerServerEvent("onBanditGetsKilled",source,attacker,headshot) end end end if attacker and getElementData(attacker,"trorist") and getElementData(source,"zombie") then damage = getElementData(attacker,"damage") setElementData(source,"blood",getElementData(source,"blood")-math.random(damage*0.75,damage*1.25)) if getElementData(source,"blood") <= 0 then triggerServerEvent("onZombieGetsKilled",source,attacker,headshot) end end end addEventHandler ( "onClientPedDamage", getRootElement(), banditGetDamageDayZ ) function playerGetDamageDayZFromBandit ( attacker, weapon, bodypart, loss ) cancelEvent() damage = 100 headshot = false if isElement(attacker) and getElementData(attacker,"trorist") then damage = getElementData(attacker,"damage") setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-damage) end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer (), playerGetDamageDayZFromBandit ) function checkBandit1() local x,y,z = getElementPosition(getLocalPlayer()) for i,ped in ipairs(getElementsByType("ped")) do if getElementData(ped,"trorist") then local sound = getElementData(getLocalPlayer(),"volume")/5 local visibly = getElementData(getLocalPlayer(),"visibly")/5 local xZ,yZ,zZ = getElementPosition(ped) if getElementData(ped,"type") == "sniper" then if getDistanceBetweenPoints3D (x,y,z,xZ,yZ,zZ) < sound+visibly-300 then else triggerServerEvent("banditStopFollow",getLocalPlayer(),ped) end else if getDistanceBetweenPoints3D (x,y,z,xZ,yZ,zZ) < sound+visibly then else triggerServerEvent("banditStopFollow",getLocalPlayer(),ped) end end end end end setTimer(checkBandit1,5000,0) server.lua createTeam("Бандиты") local stats = { [ 69 ] = 999, [ 70 ] = 999, [ 71 ] = 999, [ 72 ] = 999, [ 73 ] = 999, [ 74 ] = 999, [ 75 ] = 999, [ 76 ] = 999, [ 77 ] = 999, [ 78 ] = 999, [ 79 ] = 999, [ 160 ] = 999, [ 229 ] = 999, [ 230 ] = 999 } function applyStats(player) for stat,value in pairs(stats) do setPedStat(player, stat, value) end end function getTypeConfig(bottype) for i,v in ipairs(typeSettings) do if bottype == v[1] then local skin,weapon,damage,health = v[3],v[2],v[4],v[5] return skin,weapon,damage,health end end end function createBots() for i,value in ipairs(pedCords) do local x,y,z,bottype = value[1],value[2],value[3],value[4] local skin,weapon,damage,health = getTypeConfig(bottype) ped = call (getResourceFromName("slothbot"),"spawnBot",x,y,z,math.random(0,360),skin,0,0,getTeamFromName("Бандиты"),weapon) call ( getResourceFromName ( "slothbot" ), "setBotGuard", ped, x,y,z, false) applyStats(ped) setElementData(ped,"spawn",{x,y,z}) setElementData(ped,"trorist",true) setElementData(ped,"type",bottype) setElementData(ped,"damage",damage) setElementData(ped,"blood",health) end end createBots() function removeBots() for i,value in ipairs(getElementsByType("ped")) do local bandit = getElementData(value,"trorist") if bandit then destroyElement(value) end end end addEventHandler("onResourceStop",getRootElement(getThisResource()),removeBots) function banditStopFollow(ped) local spawn = getElementData(ped,"spawn") local x,y,z = spawn[1],spawn[2],spawn[3] call ( getResourceFromName ( "slothbot" ), "setBotGuard", ped, x, y, z, false) end addEvent("banditStopFollow",true) addEventHandler("banditStopFollow",getRootElement(),banditStopFollow) function removeDeadBanditAndRespawn(ped,pedCol,spawn,bottype) setTimer(respawnBandit,pedRespawnTime,1,spawn,bottype) destroyElement(ped) destroyElement(pedCol) end function respawnBandit(spawn,bottype) local x,y,z = spawn[1],spawn[2],spawn[3] local skin,weapon,damage,health = getTypeConfig(bottype) ped = call (getResourceFromName("slothbot"),"spawnBot",x,y,z,math.random(0,360),skin,0,0,getTeamFromName("Бандиты"),weapon) call ( getResourceFromName ( "slothbot" ), "setBotGuard", ped, x,y,z, false) applyStats(ped) setElementData(ped,"spawn",{x,y,z}) setElementData(ped,"trorist",true) setElementData(ped,"type",bottype) setElementData(ped,"damage",damage) setElementData(ped,"blood",health) end function banditKilled (killer,headshot) --outputChatBox("Server: destroyed zombie (reason: zombie died)") local skin = getElementModel(source) local x,y,z = getElementPosition(source) local ped = createPed(skin,x,y,z) local pedCol = createColSphere(x,y,z,1.5) local spawnpoint = getElementData(source,"spawn") local bottype = getElementData(source,"type") killPed(ped) setTimer(removeDeadBanditAndRespawn,pedRemoveBody,1,ped,pedCol,spawnpoint,bottype) attachElements (pedCol,ped,0,0,0) setElementData(pedCol,"parent",ped) setElementData(pedCol,"playername","Бандит") setElementData(pedCol,"deadman",true) setElementData(ped,"deadbandit",true) setElementData(pedCol,"deadman",true) local time = getRealTime() local hours = time.hour local minutes = time.minute setElementData(pedCol,"deadreason","Похоже он мёртв. Время смерти: "..hours..":"..minutes..".") for i, item in ipairs(itemTableBandits) do local value = math.percentChance (item[5]/2.5,1) setElementData(pedCol,item[1],value) end destroyElement(source) if headshot == true then setElementData(killer,"headshots",getElementData(killer,"headshots")+1) end end addEvent("onBanditGetsKilled",true) addEventHandler("onBanditGetsKilled",getRootElement(),banditKilled) function math.percentChance (percent,repeatTime) local hits = 0 for i = 1, repeatTime do local number = math.random(0,200)/2 if number <= percent then hits = hits+1 end end return hits end config.lua pedRemoveBody = 50000 -- Время после которого труп бандита ищезнит pedRespawnTime = 50000 -- Время после токго как труп ищезнет до того как он заспавниться pedCords = { {-1938.6,2398.2,50,"guard"}, {-1922.7,-1930.8,50,"guard"}, {-1930.8,2390,50,"guard"}, {-1927.2,2381.3999,50,"guard"}, } ----Типы ботов --guard Бот охранник носит с собой М4 Урон 4500крови typeSettings = { --{Тип,Оружие,Скин,Урон,Кровь} {"guard",31,287,4500,12000}, } itemTableBandits = { {"Спички",328,0.4,90,5}, {"Assault Pack (ACU)",3026,0.5,0,6}, {"Револьвер",348,1,90,0.3}, {"MP5A5",353,1,90,0.1}, {"Часы",2710,1,0,3}, {"Карта",1277,0.8,90,4}, {"GPS",2976,0.15,0,1}, {"Банка макарон",2770,0.1,0,5}, {"Банка бобов",2601,1,0,5}, {"Рация",2966,0.5,0,3}, {"Бейсбольная бита",336,1,90,0.5}, } My GameMode is DayZ.
GTX Posted July 11, 2015 Posted July 11, 2015 Assign more health & damage to them. typeSettings = { --{Name,Weapon,Skin,Damage,Health} {"guard",31,287,9000,24000}, } I doubled damage & health
Adissonboy11 Posted July 12, 2015 Author Posted July 12, 2015 I need them to be smarter, shoot in the head, and shoot fast.
GTX Posted July 12, 2015 Posted July 12, 2015 I doubt slothbot resource has that feature. I also doubt someone will do that advanced AI for you.
Adissonboy11 Posted July 12, 2015 Author Posted July 12, 2015 I need urgent. Can anyone help me with some kind of tutorial or a slothbot already have this configured function?
Adissonboy11 Posted July 20, 2015 Author Posted July 20, 2015 Up. My intention is not to cause flood, but receive help. : c
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