command /ai [<text>]:
trigger:
if argument 1 is "spawn":
set {ai.spawn} to location of player
send "Spawn AI set" to player
if argument 1 is "end":
set {ai.end} to location of player
send "End AI set" to player
if argument 1 is "start":
set {ai.learning} to true
set block at {ai.spawn} to green wool
set {ai.coordinates.checked} to {ai.spawn}
delete {ai.path::*}
add {ai.spawn} to {ai.path::*}
set {ai.steps} to 0
brain({ai.spawn})
if argument 1 is "stop":
set {ai.learning} to false
function check():
if {ai.learning} is true:
set {_t1} to distance between {ai.end} and {ai.coordinates.unchecked}
set {_t2} to distance between {ai.end} and {ai.coordinates.checked}
if block at {ai.coordinates.unchecked} is air:
if {_t1} is smaller than 0.99:
broadcast "Generations %{ai.steps}%"
broadcast "&a&lDONE &fAi learned new path."
set {ai.learning} to false
stop
if {_t1} is smaller than {_t2}:
add 1 to {ai.steps}
set {ai.coordinates.checked} to {ai.coordinates.unchecked}
add {ai.coordinates.checked} to {ai.path::*}
goto()
broadcast "Generations %{ai.steps}%"
broadcast "Generation Succes Evolved. Loc %{ai.coordinates.checked}% Distance %{_t1}%"
else:
goto()
else:
goto()
function goto():
if {ai.learning} is true:
loop {ai.path::*}:
set block at loop-value to green wool
wait 5 ticks
set block at loop-value to air
set {_v} to ({ai.steps} * 0.5 + 1)
wait 5 seconds
brain({ai.coordinates.checked})
function brain(l: location):
if {ai.learning} is true:
set {_r} to random integer between 0 and 1
set {ai.coordinates.unchecked} to {_l}
set {_d} to {ai.coordinates.unchecked}
if {_r} is 0:
set {_r} to random integer between 0 and 1
if {_r} is 0:
#set block at {_d} to air
add 1 to x-coordinates of {ai.coordinates.unchecked}
#set block at {ai.coordinates.unchecked} to green wool
check()
if {_r} is 1:
#set block at {_d} to air
remove 1 from x-coordinates of {ai.coordinates.unchecked}
#set block at {ai.coordinates.unchecked} to green wool
check()
if {_r} is 1:
set {_r} to random integer between 0 and 1
if {_r} is 0:
#set block at {_d} to air
add 1 to z-coordinates of {ai.coordinates.unchecked}
#set block at {ai.coordinates.unchecked} to green wool
check()
if {_r} is 1:
#set block at {_d} to air
remove 1 from z-coordinates of {ai.coordinates.unchecked}
#set block at {ai.coordinates.unchecked} to green wool
check()
Hi because today i have lot of free time. I decided to try to create an AI that would learn how to go from point A to point B. And I did it. Although I know it could be written better but it's just a test. If someone wants to use this skript and edit it, they can. This skript is for all.
Hello readers, i need help with making a boss bar. I tried so many of addons (skRayFall, Skellet, SkLib…), but no-one worked. Server version is 1.14.4
Please, Mamut