pathfinding in 1.12

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Efnilite

Supporter
May 12, 2018
218
15
18
your basement
no.com
is there a way to add mulitple pathfinding goals to variables AND determine the speed? I tried searching the docs and multiple things with SkStuff like
code_language.skript:
add pathfind [goal] [to {variable}] [with] speed 1
[ = things i tried removing/adding

so that the mob takes a path with multiple turns
[doublepost=1532454221,1532373971][/doublepost]bump .-.
or is it just not possible

I know how to set the speed now
[doublepost=1532982710][/doublepost]bummpppp, or is this not possible :emoji_frowning:
 
Do you want them to go to a point and when he's there he goes to another? If so, you loop the locations, make them pathfind and when they're there make them go the the next. About the speed, I think you can just give them the speed effect / changing their walking speed
 
Do you want them to go to a point and when he's there he goes to another? If so, you loop the locations, make them pathfind and when they're there make them go the the next. About the speed, I think you can just give them the speed effect / changing their walking speed
Wdym with loop locations? How would i test if they're there? (sorry for these noob questions i just don't get it)
 
Wdym with loop locations? How would i test if they're there? (sorry for these noob questions i just don't get it)
What do you mean with adding pathfinding goals to variables? The goal of pathfinding is to go to a location, so do you want to add locations to a variable? (I don't get it either :/)
 
So just add those locations to a list, loop it, use the pathfind effect with the loop-value and wait until it's done, then go to the next one
 
So just add those locations to a list, loop it, use the pathfind effect with the loop-value and wait until it's done, then go to the next one
with the loop-value and wait until it's done, then go to the next one

^ How would I test when it's done?

I have this so far
code_language.skript:
on load:
    set {l::1} to location(43.5, 83, -38.5, world("Frozen"))
    set {l::2} to location(11, 82, -39, world("Frozen"))
    set {l::3} to location(11, 82, -12, world("Frozen"))

command /sendsk:
    trigger:
        set {_c} to {l::1}
        spawn a zombie at {_c}
        set {_e} to last spawned entity
        make last spawned entity pathfind to loop-value with speed 1
 
Is your goal to make the entity patrol between those locations? I don't fully understand what you're trying to achieve
 
with the loop-value and wait until it's done, then go to the next one

^ How would I test when it's done?

I have this so far
code_language.skript:
on load:
    set {l::1} to location(43.5, 83, -38.5, world("Frozen"))
    set {l::2} to location(11, 82, -39, world("Frozen"))
    set {l::3} to location(11, 82, -12, world("Frozen"))

command /sendsk:
    trigger:
        set {_c} to {l::1}
        spawn a zombie at {_c}
        set {_e} to last spawned entity
        make last spawned entity pathfind to loop-value with speed 1
You can try something with a while loop which stops when it's no longer moving (the while loop should wait a tick / a second and then check the time between now and the last movement, if that's bigger than 1 tick / second, you stop the while loop). Also in your code you put loop-value in the pathfind effect, but you don't have a loop (probably because you wanted to limit it down to just 1 of the locations first, but just saying)
 
Is your goal to make the entity patrol between those locations? I don't fully understand what you're trying to achieve
No, I want them to follow a complicated path with corners like, for example this path:
(B = beginning, E = end)
_______ E
|
B
[doublepost=1533467876,1533467767][/doublepost]
You can try something with a while loop which stops when it's no longer moving (the while loop should wait a tick / a second and then check the time between now and the last movement, if that's bigger than 1 tick / second, you stop the while loop). Also in your code you put loop-value in the pathfind effect, but you don't have a loop (probably because you wanted to limit it down to just 1 of the locations first, but just saying)
That wont work since the mob is bound to be stopped (Freezing effects, im making a minigame)
And first i had a loop to loop the locations, but i removed it and forgot the loop-value thing
 
No, I want them to follow a complicated path with corners like, for example this path:
(B = beginning, E = end)
_______ E
|
B
[doublepost=1533467876,1533467767][/doublepost]
That wont work since the mob is bound to be stopped (Freezing effects, im making a minigame)
And first i had a loop to loop the locations, but i removed it and forgot the loop-value thing
Maybe a while loop until he's like 0.2 blocks away from the location?
 
Maybe a while loop until he's like 0.2 blocks away from the location?
This? I'm testing it in a min
code_language.skript:
        make {_e} pathfind to {l::2} parsed as location
        set {_e} to last spawned entity
        while {_e} exists:
            loop all entities in radius of 0.2 of {l::2}: where [input = {_e}]:
                    make {_e} pathfind to {l::3} parsed as location
             wait 2 tick
 
This? I'm testing it in a min
code_language.skript:
        make {_e} pathfind to {l::2} parsed as location
        set {_e} to last spawned entity
        while {_e} exists:
            loop all entities in radius of 0.2 of {l::2}: where [input = {_e}]:
                    make {_e} pathfind to {l::3} parsed as location
             wait 2 tick
I was thinking about something like this:
code_language.skript:
make {_e} pathfind to {l::2} parsed as location
set {_e} to last spawned entity
set {_loc} to {l::2} parsed as a location
while {_e} exists:
    if distance between {_e} and {_loc} < 0.2:
        exit loop
    wait 2 tick
 
Status
Not open for further replies.