#Moving npcs is slow

47 messages · Page 1 of 1 (latest)

lime shuttle
#

I'm trying to move 3 npcs to 3 random locations. Currently though, the npcs only walk when they feel like it. Which isn't very often. I think the video shows it pretty well
https://paste.denizenscript.com/View/123453

#

I also feel like theres a better way of rotating them but I couldnt find it

#

also huh

#

is the bot dead?

#

It seems to mess up because of the water

#

Is it possible to get a new location if they cant reach the current one?

lilac crescent
#

maybe? i think

#

you can try just giving them a new walk location when they're stuck?

#

!e npc stuck

frank widgetBOT
# lilac crescent !e npc stuck
Group

NPC

Event Lines

npc stuck

Switches

npc:<npc> to only process the event if the spawned NPC matches.

Triggers

when an NPC's navigator is stuck.

Has NPC

Always.

Context

<context.action> returns 'teleport' or 'none'

Determine

"NONE" to do nothing.
"TELEPORT" to teleport.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

lime shuttle
#

hmm that fires for every npc though

#

and Im pretty sure we'll have a couple hundred npcs in our server

lilac crescent
#

Switches npc:<npc> to only process the event if the spawned NPC matches.

lime shuttle
#

right but then Id need 1 specific npc right

lilac crescent
#

no you can just flag the ones you crate with a generic flag

#

and then on npc stuck npc:npc_flagged:generic_flag:

lime shuttle
#

since when is that possible

lilac crescent
#

define "that"

lime shuttle
#

couldve known that before lol

lime shuttle
#

Ill give that a try, thansk!

lilac crescent
#

npc_flagged is a matcher just like item_flagged entity_flagged etc

#

i havent seen it in the docs though

lime shuttle
#

me neither

#

yup the event fires properly

#

Should I just keep giving them new locations till theyre not stuck?

#

would be nice if I could just cancel the stuck

#

Right so the event is cool and all but it doesnt have a context.npc

#

so that's kinda useless

#

Cant I just force them to swim?

lime shuttle
#

...

#

can they make it more confusing

lilac crescent
#

so basically

#

yk how with player events there's a linked player (<player>)?

#

it's the same for npcs

lime shuttle
#

I just do <context.player>

lilac crescent
#

i gotta dip but i can play around w it later if i find the time

lime shuttle
#
npc_handler:
    type: world
    events:
        on npc stuck npc:npc_flagged:illusion_npc:
            - announce stuck!!
            - teleport <npc> <npc.location.with_yaw[<util.random.decimal[-180].to[180]>].with_pitch[1]>
            - walk <npc> <npc.location.forward[15]> speed:1.5```
https://paste.denizenscript.com/View/123457
#

the event fires but it doesnt seem to teleport them nor make them walk unless Im wrong

#

ah

#

after seems to work

#

Well in that case swimming wont be necessary. Doubt I'll need it any time soon too. Thanks for the help as always!