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

[EO] Pet system FIX Call/Disband bugs V2.0


RyokuHasu
 Share

Recommended Posts

**ONLY for fixing the "older" version of Lightning's pet system (before 6/11/11)**

Yet another pet system Upgrade By Ryoku Hasu

**Prerequired TUT - Lightning's pet system**
http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.html

**Highly suggested Pet Mods-  by RyokuHasu**
http://www.touchofdeathforums.com/smf/index.php/topic,69925.0.html
http://www.touchofdeathforums.com/smf/index.php/topic,72517.msg778251.html

fixes pet loading/ unloading

and

removes pets without fail on
-log out
-server shutdown and start up
-server crash and startup

**SERVER**

in modPlayer

in Sub LeftGame above
```
' leave party.

```add
```
PetDisband Index, GetPlayerMap(Index)

For i = 1 To Player_HighIndex   
    If IsPlaying(i) Then       
          If GetPlayerMap(i) = GetPlayerMap(Index) Then             
              Call PlayerWarp(i, GetPlayerMap(Index), GetPlayerX(i), GetPlayerY(i))       
          End If   
    End If
Next

```

AND in modGeneral

under Public Sub ClearGameData() add
```
Call SetStatus("Clearing pets...")
Call ClearPets

```
to the bottom

in modDatabase right bellow

```
' **********
' ** Maps **
' **********

```add
```

Sub ClearPets()
Dim i As Long
Dim x As Long

For i = 1 To MAX_MAPS
    For x = 1 To MAX_MAP_NPCS
          If MapNpc(i).NPC(x).IsPet Then
              Call ZeroMemory(ByVal VarPtr(MapNpc(i).NPC(x)), LenB(MapNpc(i).NPC(x)))
              Map(i).NPC(x) = 0
              MapNpc(i).NPC(x).Num = 0
              MapCache_Create (i)
          End If
    Next
Next

End Sub

```
in modGameLogic

under sub PetDisband add
```
Dim i As Integer

```at the top

and add, to the bottom of the sub
```
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
        If GetPlayerMap(i) = GetPlayerMap(Index) Then
              Call PlayerWarp(i, GetPlayerMap(Index), GetPlayerX(i), GetPlayerY(i))
        End If
    End If
Next

```

in the same mod under Sub SpawnPet, at the bottom, replace
```
're-warp the players on the map
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
        If GetPlayerMap(i) = GetPlayerMap(Index) Then
              Call PlayerWarp(Index, PlayerMap, GetPlayerX(Index), GetPlayerY(Index))
        End If
    End If
Next

```with
```
're-warp the players on the map
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
        If GetPlayerMap(i) = GetPlayerMap(Index) Then
              Call PlayerWarp(i, PlayerMap, GetPlayerX(i), GetPlayerY(i))
        End If
    End If
Next

```

in modPlayer

find
```
'switch maps
PetDisband Index, OldMap

```
and UNDER it add

```
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
        If GetPlayerMap(i) = OldMap Then
            Call PlayerWarp(i, OldMap, GetPlayerX(i), GetPlayerY(i))
        End If
    End If
Next

```

in modCombat , in Sub NpcAttackNpc

Find
```
PetDisband petowner, GetPlayerMap(petowner)

```
and add below it

```
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
          If GetPlayerMap(i) = GetPlayerMap(petowner) Then
              Call PlayerWarp(i, GetPlayerMap(petowner), GetPlayerX(i), GetPlayerY(i))
          End If
    End If
Next

```
Link to comment
Share on other sites

O.o…. did you restart the server? ... its spose to clean on server boot.

the log out part only ensure your pet is erased if its on the same map, but the sever pet cleanis on restart.

* * *

Oops I didnt clear them corectly even on restart.

**FIXED**

Ill add a correct "remove on death" too =P

Edit: Also, I found a way to test this and it works on the server load =P

Edit v2: added spawn and despawn fixes.. now you should have no problems with out of place pets.
Link to comment
Share on other sites

Don't mean to double post but mine has a bug… when i leave a map my pet stays there till i return yet when i go to the next map i have one there as well... i had 2 accounts loged on to watch it and this is what i seen... Just mine or is this a bug xD

Also when i walk into a room with my pet and someone has a pet theirs is destroyed by mine lol...
er to clarify its just destroyed not killed or attacked just POOF gone xD!

I hope im not havin problems because im using spells to summon my pets not items >.<
Link to comment
Share on other sites

@Whitepinkbun:

> Don't mean to double post but mine has a bug… when i leave a map my pet stays there till i return yet when i go to the next map i have one there as well... i had 2 accounts loged on to watch it and this is what i seen... Just mine or is this a bug xD

Found your problem the map isnt reloading every player on the map when you leave. your pet DOSE get removed, however no oter players are reloaded to see that its gone.

to fix this go in the server, in mod player

find
```
'switch maps
PetDisband Index, OldMap

```
and UNDER it add

```
For i = 1 To Player_HighIndex
    If IsPlaying(i) Then
        If GetPlayerMap(i) = OldMap Then
            Call PlayerWarp(i, OldMap, GetPlayerX(i), GetPlayerY(i))
        End If
    End If
Next

```
I added it to the Tut, also I fixed a few other things so please re-read this tut.
Link to comment
Share on other sites

@aℓνιη:

> don't work, when my pet is killed, he saved in map properties.

Ya I saw that too, but then i checked the map properties again and it was gone, just give it a min.
Link to comment
Share on other sites

Great work RyokuHasu your an inspiration that's for sure. I'll try it out see how its goes xD

EEEP Run-Time error '9' subscript out of range xD… server crashed when i went two a different room odly enough when i went to my 3rd room first transition made him... jump around the map lol xD

AHAHAH logged in on another toon and walked to each room the 2 i visited and one i crashed on all had a pet in it jumpin around the screen randomly ^^ im going to try and do the tutorial from the start no modifications on my behalf and see if its working lol.... I'll get back to you
Link to comment
Share on other sites

Followed it to the letter pet overwrites other npcs lol… jumps randomly when walking... I get bombarded with You are below level 10, you cannot attack another player with a pet yet! and none of my buttons seam to work now ... lol Progress was not made >.<...
Link to comment
Share on other sites

@Whitepinkbun:

> Followed it to the letter pet overwrites other npcs lol… jumps randomly when walking... I get bombarded with You are below level 10, you cannot attack another player with a pet yet! and none of my buttons seam to work now ... lol Progress was not made >.<...

O.o…. then you either DIDNT follow them correctly... or your version has some serious bugs.

Ive been testing these NON stop for 3 days ... Im pretty shure these have LOTS of progress behind then.

if you are realy having tooo many problems, also try deleting all your NPC files

Edit: also looking at your post count tells me you are VERY new here and that you started with an advanced edit maby just a little too early. =/
Link to comment
Share on other sites

Why are you claiming credit all of a sudden? Half of the "fixes" you have posted worked in the first place. :| I'll be posting a few urgent updates myself this afternoon.

EDIT: http://www.touchofdeathforums.com/smf/index.php/topic,69521.msg779874.html#msg779874
Link to comment
Share on other sites

@Lightning:

> Why are you claiming credit all of a sudden? Half of the "fixes" you have posted worked in the first place. :| I'll be posting a few urgent updates myself this afternoon.

I didnt take creadit from you I was taking credit for my fixes, i was saying cite credit for both. Im sorry if you think i was taking all the credit, i just wanted credit for some fixes. =P 

and alot of these fixes did not work before, you didnt rewarp the players to the map in most of the cases, wich is what most of these are, just rewarping the map.

the pet cleaner part is to help those who were complaining about the pets not getting removed thier game was spammed with "trash pets"

also if it make you feel any beter i removed the cite credit lines.
Link to comment
Share on other sites

@Xlithan:

> How much of this has been changed because I added it before you made changes to it.

Just run through my tutorial again. I fixed it up a few days ago, so all pets are cached server-side etc. Take a look at the last few posts for a more in-depth description. :P

http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.html
Link to comment
Share on other sites

  • 3 weeks later...
@Xlithan:

> I'm using Modification(S) latest.

@Fragment:

> even modifcation is bugged up, if you have a large map and you summon a pet, close the server by the x and then when you go back in, your pet is stuck on the map

Modification(s) runs off of an ancient version of my Pet System.
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...