Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Auto follow how possible/complex just need a few tips where to start is all


madyotto
 Share

Recommended Posts

how possible/complex would it be to script in an auto follow system for party's

IE. im in a party and i want another player to just stick by me automatically let says a tile or two behind

my project partner is quite good with vb and if i had a few tip of places the bits of code need to be scripted in and how to read the other players LOC im sure we would be able to manage the rest

DAM HIM BEING ON NIGHT'S HOW VERY INCONSIDERATE LOL.

and thanks
will also start a new thread so we can easily share the code when we are done
Link to comment
Share on other sites

@madyotto:

> my project partner is quite good with vb and if i had a few tip of places the bits of code need to be scripted in and how to read the other players LOC im sure we would be able to manage the rest

Please don't say scripted. Reading the other player's location is easy (GetPlayerX(i) and GetPlayerY(i) where i is the index). I don't think you want the location though, instead you want to see where they've been. Store the index of the person the player is following in TempPlayerRec. Then send an update whenever they've moved (or ask the server for an update/what prefer you). You could then do one of two things: one, use a combination of coordinates and direction to get where they were last tile), or two, add a basic pathfinding system so you can find the shortest path to their location.
Link to comment
Share on other sites

> Store the index of the person the player is following in TempPlayerRec. Then send an update whenever they've moved (or ask the server for an update/what prefer you). You could then do one of two things: one, use a combination of coordinates and direction to get where they were last tile), or two, add a basic pathfinding system so you can find the shortest path to their location.

which would be easiest to program ?
Link to comment
Share on other sites

i have been thinking and i am wondering but tbh IDK if i am right but here's my thought

instead of using loc to actually follow a party member would it make the programming any easier if:

you have a range of one tile before follow can be done 
so if more than a tile away the follow option is not given/allowed
this way it is a given that the player doing the following is only 1 tile away when the follow cmd starts

and then program the following player to copy the movements of the player being followed

so if x player moves up so does the following player 

would this be an easier mod to make
Link to comment
Share on other sites

Lightning did that in the pet system, so your pet follows you, he actually copied the code that makes the npc follow you when he is going to attack you when you get in his range. So what did he do? remove the attack, keep the following and make a button.
Be creative, find the following-code of the npc, and do the same code but for player now.

It's not as hard as you think, actually I think it don't need a lot of code.

About the maximum range to follow a player, I don't know if there is a function like that in Eclipse, but you can make it using the select case statement. Like,

```
Private Function checkRange(ByVal target As Long, ByVal myIndex As Long) As Boolean
Dim rangeX As Long
Dim rangeY As Long
rangeX = getplayerx(target) - getplayerx(myIndex) ''Calculate the x difference between the players
rangeY = getplayery(target) - getplayery(myIndex) ''Calculate the y difference between the players

Select Case rangeX
    Case 1, 0, -1 '' When the difference on x equals to "1", "0"(wich must be impossible expect an epic lagg, or a no-block system in your game) or "-1"
        Select Case rangeY
            Case 1, 0, -1 '' Check if the difference on y also equals to 1, 0 or - 1.
                If GetPlayerMap(Target) = GetPlayerMap(myIndex) Then ''Check the player map is the same, or, you know what will happen if the maps are not the same.
                    checkRange = True '' Make the value of checkRange "True" when x and y are in range, so you can start the following system with an if statement on the other side of the code.
                End If
            Case Else
                checkRange = False '' Make the value of checkRange "False" when x and y are not in range.
        End Select
    Case Else
        checkRange = False '' Make the value of checkRange "False" when x is not in range.
End Select

End Function

```

This is the maximum help you can get, specially on this forum.
I hope this helped you.

EDIT: forgot to check if the maps are the same in the code.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...