03:28 PM 26/07/2021
Im trying to make a zombie bot for my "Survive on The Moon" game. Although as I know, its currently not working. I used a script I found on the forum.
function zombieSpawn(x,y,z){
const zombie = new Bot("Zombie")
const outfit = new Outfit()
.body("#0d9436")
.torso("#694813")
.rightLeg("#694813")
.leftLeg("#694813")
zombie.setOutfit(outfit)
console.log(zombie.Position)
Game.newBot(zombie)
zombie.setPosition(new Vector3(x,y,z)) // trying to set the positions
// We use bot.setinterval so that when the zombie is destroyed, the loop clears.
// It's good practice to do this to avoid memory leaks.
zombie.setInterval(() => {
let target = zombie.findClosestPlayer(20)
if (!target) return zombie.setSpeech("")
zombie.setSpeech("BRAAINNNSSS!")
zombie.moveTowardsPlayer(target, 8)
}, 10)
let touchEvent = zombie.touching((p) => {
Game.messageAll([#ff0000]${p.username} was eaten by a zombie!)
p.kill()
})
}
zombieSpawn(-20,2,-156)
function zombieSpawn(x,y,z){
const zombie = new Bot("Zombie")
const outfit = new Outfit()
.body("#0d9436")
.torso("#694813")
.rightLeg("#694813")
.leftLeg("#694813")
zombie.setOutfit(outfit)
console.log(zombie.Position)
Game.newBot(zombie)
zombie.setPosition(new Vector3(x,y,z)) // trying to set the positions
// We use bot.setinterval so that when the zombie is destroyed, the loop clears.
// It's good practice to do this to avoid memory leaks.
zombie.setInterval(() => {
let target = zombie.findClosestPlayer(20)
if (!target) return zombie.setSpeech("")
zombie.setSpeech("BRAAINNNSSS!")
zombie.moveTowardsPlayer(target, 8)
}, 10)
let touchEvent = zombie.touching((p) => {
Game.messageAll([#ff0000]${p.username} was eaten by a zombie!)
p.kill()
})
}
zombieSpawn(-20,2,-156)