Basic Idle or Attack
local target = nearestEntity_get("minecraft:zombie")
if target ~= nil then
gol.attackAt(target)
else
gol.serial("idle")
end
Patrol Between Two Points
if var_get("point") == "A" then
gol.goTo(0, 64, 0)
var("point", "B")
else
gol.goTo(10, 64, 10)
var("point", "A")
end
Timed Jump Every Few Seconds
if delta() > 100 then
gol.jump()
delta_reset()
end
Follow Nearest Player
local p = nearestEntity_get("minecraft:player")
if p ~= nil then
gol.goTo(p.x, p.y, p.z)
end
Defensive Mode (Attack Monsters Only)
local e = nearestEntity_get()
if e ~= nil and e.is_monster then
gol.attackAt(e)
else
gol.serial("guard")
end
Look at Nearest Entity Continuously
local e = nearestEntity_get()
if e ~= nil then
gol.lookAt(e.x, e.y, e.z)
end
Wander Randomly Over Time
if delta() > 200 then
local me = self()
gol.goTo(me.x + math.random(-5, 5), me.y, me.z + math.random(-5, 5))
delta_reset()
end