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

[EO] Walking through players


Guest
 Share

Recommended Posts

At the end of this tutorial your players will be able to walk through each other but ONLY on Safe maps.

First, in Function CheckDirection find this:

```
' Check to see if a npc is already on that tile
```
And move that whole chunk of code (up to 'Next) above:

```
' Check to see if a player is already on that tile
    For i = 1 To Player_HighIndex
        If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
            If GetPlayerX(i) = x Then
                If GetPlayerY(i) = Y Then
                    CheckDirection = True
                    Exit Function
                End If
            End If
        End If
    Next i
```
What this has done has allowed us to not let players walk through NPCs (you'll see why later).

Next, add this:

```
If Map.Moral = MAP_MORAL_SAFE Then Exit Function
```
Above:

```
' Check to see if a player is already on that tile
```
Now that line of code tells the game to ignore the check that checks whether another player is already on the tile IF the map is a safe map. Now you can see why we put the NPC on the same tile check above that line, so it doesn't also exit out.

And thats it, goodluck!
Link to comment
Share on other sites

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

eddie… why dont you post your code so we can make sure you have everything correct.

did you change anything else in that section of code? Try commenting out this section of code and see if you still get the error.

that error is due to one of your for loops not terminating correctly.
Link to comment
Share on other sites

@Whackeddie99:

> i did it exactly as it said. Maybe its interfering with other coding from other things added into it?

It has nothing to do with any other line of code in EO. It's simply moving a block of code above another block of code and adding a line under that.

And yeah, try what Gwen said.
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...