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

[EO 2.0/3.0] Pet Tag


PVJsquad
 Share

Recommended Posts

**INTRO**

I could not identify which pets and npc, so I made this tutorial just to tell which npc and pets

>! ![](http://eclipseorigins.com/community/filehost/c51709f10c142456a2c25ea9cdccd046.png)

**What i Editing or adding?**

* **Client : **modGraphics, modText, modHandleData, modTypes
* **Server : **modGameLogic

**Difficulty :** Medium
**Recomended :** Start Over Fresh
**Engine :** All Version Suport Lightning's Pet System
**Require : **[http://www.eclipseorigins.com/community/index.php?/topic/116108-eo-lightnings-pet-system-completely-bug-free/?hl=](http://www.eclipseorigins.com/community/index.php?/topic/116108-eo-lightnings-pet-system-completely-bug-free/?hl=lightning)

**Client Side**
open **modGrapich **and find in **Render_Graphics()**

```

' draw npc names
            For i = 1 To Npc_HighIndex
                If MapNpc(i).num > 0 Then
                    Call DrawNpcName(i)
                End If
            Next
```
replace that code with

```

' draw npc names
            For i = 1 To Npc_HighIndex
                If MapNpc(i).num > 0 Then
                        If TempMapNpc(i).Owner = 1 Then ' pet
                            Call DrawNpcName(i, True)
                        Else
                            Call DrawNpcName(i)
End If
                End If
            Next
```

go to **modText** find in module

```

Public Sub DrawNpcName(ByVal Index As Long)
```
replace to this code

```

Public Sub DrawNpcName(ByVal Index As Long, Optional ShowPetName As Boolean = False)
```
add this in **DrawNpcName**

```

Dim PetOwner As String
```
find this code in **DrawNpcName**

```

Select Case NPC(npcNum).Behaviour
        Case NPC_BEHAVIOUR_ATTACKONSIGHT
            color = BrightRed
        Case NPC_BEHAVIOUR_ATTACKWHENATTACKED
            color = Yellow
        Case NPC_BEHAVIOUR_GUARD
            color = Grey
        Case Else
            color = BrightGreen
    End Select
```
below it add

```

If ShowPetName = True Then
        Name = "[PET]" & Trim$(NPC(npcNum).Name)
        PetOwner = Trim$(TempMapNpc(Index).PetOwner)
    Else
        Name = Trim$(NPC(npcNum).Name)
        PetOwner = vbNullString
    End If
```

Go To **modTypes **and find **Private Type TempMapNpcRec**

before **End Type** add

```

Owner As Byte ' pet name
    PetOwner As String
```
Go To **modHandledata **and find **Private Sub HandleSpawnNpc(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)**

Find this code

```

.num = buffer.ReadLong
        .X = buffer.ReadLong
        .Y = buffer.ReadLong
        .Dir = buffer.ReadLong
        .ispet = buffer.ReadByte
        .PetData.Name = buffer.ReadString
        .PetData.Owner = buffer.ReadLong
```
below it add 

```

TempMapNpc(n).PetOwner = MapNpc(n).PetData.Name
```
find **Private Sub HandleNpcMove(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)**

add in that sub

```

dim ispet as byte
```
in that sub find again

```

X = buffer.ReadLong
    Y = buffer.ReadLong
    Dir = buffer.ReadLong
    Movement = buffer.ReadLong
```
below it add

```

ispet = buffer.ReadByte
```

Well done in client side let's coding to server side

**SERVER SIDE**

Go to **modGameLogic **and find **Sub NpcMove(ByVal mapNum As Long, ByVal MapNpcNum As Long, ByVal Dir As Long, ByVal movement As Long)**

```

Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).x
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).y
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).Dir            Buffer.WriteLong movement
```
You will found the code more than one so add this code in all

below that code add this

```

Buffer.WriteByte MapNpc(mapNum).NPC(MapNpcNum).IsPet ' pet
```
fo to sub **Public Sub SpawnNpc(ByVal MapNpcNum As Long, ByVal mapNum As Long, Optional ByVal SetX As Long, Optional ByVal SetY As Long, Optional ForcedSpawn As Boolean = False)**

and find

```

' If we suceeded in spawning then send it to everyone
        If Spawned Then
            Set Buffer = New clsBuffer
            Buffer.WriteLong SSpawnNpc
            Buffer.WriteLong MapNpcNum
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).Num
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).x
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).y
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).Dir
            Buffer.WriteByte MapNpc(mapNum).NPC(MapNpcNum).IsPet
            Buffer.WriteString MapNpc(mapNum).NPC(MapNpcNum).petData.Name
            Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).petData.Owner
            SendDataToMap mapNum, Buffer.ToArray()
            Set Buffer = Nothing
            UpdateMapBlock mapNum, MapNpc(mapNum).NPC(MapNpcNum).x, MapNpc(mapNum).NPC(MapNpcNum).y, True
        End If
```

below 

```

Buffer.WriteLong MapNpc(mapNum).NPC(MapNpcNum).petData.Owner
```
add this line

```

Buffer.WriteByte MapNpc(mapNum).NPC(MapNpcNum).IsPet
```
**Well Done **if you found an errors please tell me :)
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...