IF ltrg.Trg.Active left
IF rtrg.Trg.Active right
MUL R2 DeltaTime 7.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
LABEL left
ADD grp1.Rot.Y grp1.Rot.Y -45
MUL R2 DeltaTime 7.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
LABEL right
ADD grp1.Rot.Y grp1.Rot.Y 45
MUL R2 DeltaTime 7.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop```
second code
```LABEL Label0
SET Player.SelId Player.LocalId
SET R2 0.07
LABEL Label1
SET R6 grp1.Pos.X
SET R7 grp1.Pos.Z
SET R3 Player.Pos.X
SUB R3 R3 R6
SET R4 Player.Pos.Z
SUB R4 R4 R7
ATAN2 R1 R3 R4
SET R5 R1
SUB R5 R5 grp1.Rot.Y
GREATER R6 R5 179
IF R6 Fix positive
LESS R6 R5 -179
IF R6 Fix negativr
GOTO Smooth
LABEL Smooth
MUL R5 R5 R2
ADD grp1.Rot.Y grp1.Rot.Y R5
GOTO Label0
LABEL Fix positive
SUB R5 R5 360
SUB grp1.Rot.Y grp1.Rot.Y 360
GOTO Smooth
LABEL Fix negativr
SUB R5 R5 -360
SUB grp1.Rot.Y grp1.Rot.Y -360
GOTO Smooth
``` btw change the 0.07 to 0.01-7 the lower it is the smarter it gets
#Pathfinding that acts exactly like braindeads
220 messages · Page 1 of 1 (latest)
yay
What it do
pathfind
Is grp1 the whole bot?
yes
Currently this code follows the player who's headset runs the code. This is new code that follows the nearest player instead of the active player
SET R9 999999
SET Player.SelId 0
LABEL nextplayer
ADD Player.SelId Player.SelId 1
GREATER R0 Player.SelId Player.Count
IF R0 done
SUB R0 Player.Pos.X grp1.Pos.X
SUB R1 Player.Pos.Z grp1.Pos.Z
MUL R0 R0 R0
MUL R1 R1 R1
ADD R0 R0 R1
LESS R1 R0 R9
IF R1 newclosest
GOTO nextplayer
LABEL newclosest
SET R9 R0
SET R8 Player.SelId
GOTO nextplayer
LABEL done
SET Player.SelId R8
SET R2 0.07
SET R6 grp1.Pos.X
SET R7 grp1.Pos.Z
SET R3 Player.Pos.X
SUB R3 R3 R6
SET R4 Player.Pos.Z
SUB R4 R4 R7
ATAN2 R1 R3 R4
SET R5 R1
SUB R5 R5 grp1.Rot.Y
GREATER R6 R5 179
IF R6 fixpos
LESS R6 R5 -179
IF R6 fixneg
GOTO smooth
LABEL smooth
MUL R5 R5 R2
ADD grp1.Rot.Y grp1.Rot.Y R5
GOTO loop
LABEL fixpos
SUB R5 R5 360
SUB grp1.Rot.Y grp1.Rot.Y 360
GOTO smooth
LABEL fixneg
SUB R5 R5 -360
SUB grp1.Rot.Y grp1.Rot.Y -360
GOTO smooth ```
thanks
well i mean is similar
Better than the other one you made?
yes
This is no where near braindeads
Braindead, is yours like A* or even cooler?
Then how does your pathfinder work?
-# I am SO funny for asking this
Probably dark magic
|| jk ||
is it tuff tho?
Can you give me the level file
how fix
trigger farther from bean
Pathfinding that acts exactly like braindeads
Doesn't work
Im almost home, let me check it in a bit too see if I can make the code function
It was quick wrote
I heard somewhere grab will still let R7+ work, so it uses those.
If thats the issue ima rewrite it in grab (the code was a collage of differnt code)
you home yet?
Yo, what up my friend Nelson? I didn't realize you Made a useful snippet.
is there anyway someone could make a setup guide
they did
we dont have r9 and r8
uhh
modded code block
how?
no typing
W
Grab works with them as long as you paste it in
uhh are you gonna remake the nearest player thingaling?
I will, I wasent able to today because I had a really busy day,
oh ok
help
put the triggers upper and farther from monster
i did.. Didnt qork
Yea, I haven't gotten around to fixing it yet, i have to just make it refresh and recalculate the selected player
oh kk
so
uh
is it herr
Wut do the triggers connect to
any block
WHY is he lying?
Yo what do I connect
And I need help on it because I don’t know what to connect the trigger and coding
dude he isnt my code is not even close to his but mine acts like it but a little stupid and jittery
Why do people use the bean from og Fmh so much 😭
"from og fmh"
Or dat other game I found on ps5
it goes through the walls
Fix pivot and adjust triggers in equal distance from each other and equal size.
pivot for what and do you have an example for triggers?
Pivot for monster and idk but it worked for me when I just did sum trigger stuff
it kinda works but its like this
Group all walls and name it something. Make triggers only activate when touching that group name or names. Make the trigger farther away too.
Make walls thicker too
yo
How do you set it up please someone make a video 🙏
first code LABEL loop
IF ltrg.Trg.Active left
IF rtrg.Trg.Active right
MUL R2 DeltaTime 4
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
LABEL left
ADD grp1.Rot.Y grp1.Rot.Y -12
SLEEP 0.12
GOTO loop
LABEL right
ADD grp1.Rot.Y grp1.Rot.Y 12
SLEEP 0.12
GOTO loop second code LABEL start
SET Player.SelId Player.LocalId
SET R2 0.03
LABEL follow
SET R6 grp1.Pos.X
SET R7 grp1.Pos.Z
SET R3 Player.Pos.X
SUB R3 R3 R6
SET R4 Player.Pos.Z
SUB R4 R4 R7
ATAN2 R1 R3 R4
SET R5 R1
SUB R5 R5 grp1.Rot.Y
GREATER R6 R5 180
IF R6 fixPos
LESS R6 R5 -180
IF R6 fixNeg
GOTO smooth
LABEL smooth
MUL R5 R5 R2
ADD grp1.Rot.Y grp1.Rot.Y R5
SLEEP 0
GOTO follow
LABEL fixPos
SUB R5 R5 360
GOTO smooth
LABEL fixNeg
ADD R5 R5 360
GOTO smooth optional for front trigger add in first code IF ftrg.Trg.Active back Goto Loop LABEL back
ADD grp1.Rot.Y grp1.Rot.Y 180
SLEEP 0.2
GOTO loop
can someone try this pls
can someone show me how i set it up from the start
On your tiktok, im.braindead said that it isnt rotational based AI.
bc it isnt, well i mean it does (kinda) maneuver around corners and, does what its supposed to but it acts close to braindeads
Uhhh so im too lazy to find this out so uhh is this the first or second code?
2nd, not sure if it works tho
What is the second code for?
look
how do i make it slower
change every mul r2 deltatime 1-20
wdym
ok
wait uhh is there a way i can get the missing registers before you rework the code?
It shouldn't be needed, it will appear invalid, just run the code it fills in the registers
I think it should probably fix the code
uhh Player.SelId is not an input
it reads select id as invalid BC its used as a input
Use player.id instead, just change it to it
Nope, go into player mode, it will come back, make sure to put walls around it
Your all right.
ok
If the code doesn't detect any player it just heads -180⁰ y axis
Yea, both blocks should be start active, and shared.
After player is optional for the second code block. There's as small chance that it will improve behavior in some circumstances
Try to save and reopen. Its mostlikely a grab bug
If that doesn't work still, on your first and second code block, reset up the connections for the monster
tip
It keeps running into walls and getting stuck
double check
So I got it working nicley
One issue
It likes walls alot and can occasionally go through em
But overall its working decently fine
then double check
if it can go throug hthem its often a trigger issue or a number issue
Well it is chasing me
ok then keep it if it satisfies you
It's probably because ethe triggers are touching the bot
And that's probably the walls being too thin
The walls are pretty thick, and the triggers aren't touching the bot.
It might be when it turns the triggers touch bc thats what was wrong with mine but if it doesn't work then idk
Urn what da sigma
yo now i got a problem uhh it just doesn't follow nearest it just follows a random person but if he is not there then he targets somebody else
its not supposed to go to the nearest player it goes for a random player
I'm using the other code
the one that block builder gave
I realized that the code i sent earlier sucks and doesn't work for the 1st player in the lobby, I recoded it in game and it works now
ok yay
Im not home rn but ill get it to you as soon as I can (if I remember too)
WAIT SO I RESTARTED LIKE THREE TIMES THINKING I DID SOMETHING WRONG BUT IT WAS NOT MY FAULT
😭
Oh im so sorry😭
I didn't mean to waste your time
The reason I was trying to help ya was because I thought it worked because when I tested it it actually did work, because I messed up my code and nelsons
Ty
Wait so does that mean that in a sec I will have a fire Ai bot
BOT
I MEANT BOT
Oh wait I can edit
Nvm I get it
👍
have you fixed it yet?
It works perfectly fine for me
so @sterile skiff gave me code with nearest player but uhhhh it does this
i dont think the nearest code is tbe problem
The gravity thingy kinda breaks collision
but i had the issue before i added it
Code 1:
LABEL loop
IF ltrg.Trg.Active left
IF rtrg.Trg.Active right
MUL R2 DeltaTime 12.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
LABEL left
ADD grp1.Rot.Y grp1.Rot.Y -15
MUL R2 DeltaTime 7.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
LABEL right
ADD grp1.Rot.Y grp1.Rot.Y 15
MUL R2 DeltaTime 7.5
SIN R0 grp1.Rot.Y
COS R1 grp1.Rot.Y
MUL R0 R0 R2
MUL R1 R1 R2
ADD grp1.Pos.X grp1.Pos.X R0
ADD grp1.Pos.Z grp1.Pos.Z R1
SLEEP 0
GOTO loop
Code 2:
LABEL Loop
SET grp1.Rot.X 0
SET grp1.Rot.Z -90
SET R6 999999
SET R7 0
SET R4 0
SET R5 1
LABEL PlayerCheck
LESS R0 R7 Player.Count
IF R0 SelectPlayer
GOTO FaceTarget
LABEL SelectPlayer
SET Player.SelIndex R7
SET Player.SelPart 0
IF Player.Valid CalcDist
GOTO NextPlayer
LABEL CalcDist
SUB R1 Player.Pos.X grp1.Pos.X
SUB R2 Player.Pos.Z grp1.Pos.Z
MUL R3 R1 R1
MUL R0 R2 R2
ADD R3 R3 R0
LESS R0 R3 R6
IF R0 NewClosest
GOTO NextPlayer
LABEL NewClosest
SET R6 R3
SET R4 R1
SET R5 R2
LABEL NextPlayer
ADD R7 R7 1
GOTO PlayerCheck
LABEL FaceTarget
GREATER R0 R3 200
IF R0 Label7
ATAN2 R0 R4 R5
SET grp1.Rot.Y R0
SLEEP 20
GOTO Loop
LABEL Label7
RAND R0 40
SUB R0 R0 20
ADD grp1.Rot.Y grp1.Rot.Y R0
SLEEP 20
GOTO Loop
pls tell me if you know why it goes through walls
Let me test and fix it
Go into player mode as soon as you spawn in the prefab is gave you. It wont work otherwise
It works fine when you go into player mode, it just gets confused when there is no valid player to track
Yeah but the prob is it goes through walls when it chases
It dosent lol
When it works it works just like the original code lol
Except it has roaming and nearest player
The player detection code cant find a valid player
Wait i can use the level file and retry it
Wait... Are you friends or are N0V_VR? Or nah because I seen that in his level
Nothing just connect the trigger to the code block
what should the triggred code use (Start, Stop, Restart, Toggle, Reset.)
no connections on the triggers! connect the triggers FROM the code block
Lol I found slins 5th grade pic
i made him avoid walls better, made him find the nearest player, added gravity and made him able to jump
He can also go up ramps.
Give me code NOW that's sick bruv!!!
Uh can you just join me?
NGL the jumping could look better
i know
200 messagesrrrrrr
Addition for nearest```
LABEL Get Nearest - EB
SET blk1.Pos.Y R4
SET R6 1600
SET R4 0
SET R7 0
LABEL Loop
LESS R5 R7 Player.Count
NOT R5 R5
IF R5 Done
SET Player.SelIndex R7
EQUAL R5 Player.Valid 1
NOT R5 R5
IF R5 Next
SUB R0 Player.Pos.X Obj.Pos.X
SUB R1 Player.Pos.Y Obj.Pos.Y
SUB R2 Player.Pos.Z Obj.Pos.Z
MUL R0 R0 R0
MUL R1 R1 R1
MUL R2 R2 R2
ADD R3 R0 R1
ADD R3 R3 R2
LESS R5 R3 R6
IF R5 Update
LABEL Next
ADD R7 R7 1
GOTO Loop
LABEL Update
SET R6 R3
SET R4 Player.Id
GOTO Next
LABEL Done
SET blk1.Pos.Y R4
SLEEP 0
GOTO Get Nearest - EB
```LABEL Label0
SET Player.SelId blk1.Pos.Y
SET R2 0.03
LABEL Label1
SET R6 grp1.Pos.X
SET R7 grp1.Pos.Z
SET R3 Player.Pos.X
SUB R3 R3 R6
SET R4 Player.Pos.Z
SUB R4 R4 R7
ATAN2 R1 R3 R4
SET R5 R1
SUB R5 R5 grp1.Rot.Y
GREATER R6 R5 179
IF R6 Fix positive
LESS R6 R5 -179
IF R6 Fix negativr
GOTO Smooth
LABEL Smooth
MUL R5 R5 R2
ADD grp1.Rot.Y grp1.Rot.Y R5
GOTO Label0
LABEL Fix positive
SUB R5 R5 360
SUB grp1.Rot.Y grp1.Rot.Y 360
GOTO Smooth
LABEL Fix negativr
SUB R5 R5 -360
SUB grp1.Rot.Y grp1.Rot.Y -360
GOTO Smooth
This is the peak of pathfinding
How do you connect it
Also does anyone have a prefab with a general monster that runs this?? I got all the code right i checked but he’s just spazzing about in a weird circle
That code is broken currently, like the one that I sent, if you want one that follows nearest player consistently there is one in #1480716187288731769
It works well if not slightly better in most situations
tysm
wait a bunch of people are saying that it doesn’t work??
How do i fix this jumping thing he keeps doing?
I have one
SET R11 R12
SET R12 0.01
DIV R12 R12 3
LABEL grav
SLEEP 0
SUB grp1.Pos.Y grp1.Pos.Y R11
ADD R11 R11 R12
IF trg1.Trg.Active stop
IF trg2.Trg.Active jump
GOTO grav
LABEL stop
SET R11 0
ADD grp1.Pos.Y grp1.Pos.Y 0.03
GOTO grav
LABEL jump
SET R11 0
ADD grp1.Pos.Y grp1.Pos.Y 0.5
GOTO grav
Thanks👍
w speed