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

Pet System script (No Longer Beign Worked On)


Dennys
 Share

Recommended Posts

  • Replies 417
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Not really, i'm trying to make it as same as the attack NPCvsHUMAN. Here's the spawn:

If MapNPC(Y, X).num = 0 Then
                    If Map(Y).NPC(X) > 0 Then
                        If TickCount > MapNPC(Y, X).SpawnWait + (NPC(Map(Y).NPC(X)).SpawnSecs * 1000) Then
                            Call SpawnNpc(X, Y)
                        End If
                    End If
                End If
            Next X
        End If
    Next Y
Link to comment
Share on other sites

Yep yep, but what you can do, is put the pet on the left and the pet just sticks there to walk. but here's the problem, we CAN set the pet to attack on SIGHT but, it's going to move away from the owner, so how do we get the pet back? - teleport is in(just a guess):

Case 1 "/getback"
*blahblah if the the pet is not within 1,1 poins from the owner, he teleports back*
Exit sub
Link to comment
Share on other sites

Its actually pretty easy to have the pet return to you instead of warping.

```
If GetTickCount > Pet.LastMove + petmovespeed Then
    If Pet.TargetX > Pet.X Then
      Pet.X = Pet.X - 1
    End If
    If Pet.TargetX < Pet.X Then
      Pet.X = Pet.X + 1
    End If
    If Pet.TargetY > Pet.Y Then
      Pet.Y = Pet.Y - 1
    End If
    If Pet.TargetY < Pet.Y Then
      Pet.Y = Pet.Y + 1
    End If
    Pet.LastMove = GetTickCount
End If

```That wont check for any blocks, so you would have to add a CanPetMove(Pet, direction)
Link to comment
Share on other sites

Here's the attack on sight so the pet can move away and attack the NPC that it can see:

```
' /////////////////////////////////////////
                ' // This is used for ATTACKING ON SIGHT //
                ' /////////////////////////////////////////
                ' Make sure theres a PET with the map
                If Map(Y).Pet(X) > 0 Then
                    If MapPET(Y, X).num > 0 Then
                        ' If the pet is a attack on sight, search for a player on the map
                        If Pet(PETnum).Behavior = PET_BEHAVIOR_ATTACKONSIGHT Or Pet(PETnum).Behavior = PET_BEHAVIOR_RELAXED Then
                            For I = 1 To MAX_PLAYERS
                                If IsPlaying(I) Then
                                    If GetPlayerMap(I) = Y Then
                                        If MapPET(Y, X).Target = 0 Then
                                            If GetPlayerAccess(I) <= ADMIN_MONITER Then
                                                n = Pet(PETnum).Range

                                                DistanceX = MapPET(Y, X).X - GetPlayerX(I)
                                                DistanceY = MapPET(Y, X).Y - GetPlayerY(I)

                                                ' Make sure we get a positive value
                                                If DistanceX < 0 Then DistanceX = DistanceX * -1
                                                If DistanceY < 0 Then DistanceY = DistanceY * -1

                                                ' Are they in range?  if so GET'M!
                                                If DistanceX <= n Then
                                                    If DistanceY <= n Then
                                                        If Pet(PETnum).Behavior = PET_BEHAVIOR_ATTACKONSIGHT Or GetPlayerPK(I) = YES Then
                                                            If Trim(Pet(PETnum).AttackSay) <> vbNullString Then
                                                                Call PlayerMsg(I, "A " & Trim(Pet(NPCnum).Name) & " : " & Trim(Pet(NPCnum).AttackSay), SayColor)
                                                            End If

                                                            MapPET(Y, X).Target = I
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            Next I
                        End If
```
Okay this is just for attack on sight and the "guard" changed to "relaxed" mode, basically what i want to make it is that pet only attacks when the other "player" or "npc" attack.
EDIT: ALSO, I do not think it is nessecary to make more than 5-7 attack on sight thing, so i might as well just make it permenant.
Link to comment
Share on other sites

Mcnugget, that's brilliant ;) think of the variable that we are going to need. like

[PET]
DMG=100
DEF=50
SPD=50
[PET_RESPAWN]
Map=1
X=1
Y=5
[PET_REGEN]
HPRegen=1
HPTimer=2000

Also put in server folder, in data.txt under the NPCREGEN=1

```
PETRegen=1
```
Link to comment
Share on other sites

You would need these variables too:

    Name As String

    Sprite As Long
    Behavior As Byte
    Range As Integer

    STR As Long
    DEF As Long
    Speed As Long
    Magi As Long
    Big As Long
    MAXHP As Long
    Exp As Long
    SpawnTime As Long

    PetItem As Integer

    Element As Long

    SPRITESIZE As Byte
Link to comment
Share on other sites

@Ridrik:

> Mcnugget, that's brilliant ;) think of the variable that we are going to need. like
>
> [PET]
> DMG=100
> DEF=50
> SPD=50
> [PET_RESPAWN]
> Map=1
> X=1
> Y=5
> [PET_REGEN]
> HPRegen=1
> HPTimer=2000
>
> Also put in server folder, in data.txt under the NPCREGEN=1
>
> ```
> PETRegen=1
> ```

That should be like basic and we set the variables higher when it levels up!
Link to comment
Share on other sites

~~MAX_PET = GetVar(App.Path & "\Data.ini", "CONFIG", "MAX_PETS")~~ - this is one of the requirements, put this in server side, modgeneral, right after MAX_PLAYERS. And also put MAX_PETS="whatever max of the pets you want on your server" in the data.txt

EDIT: Here's the fixed one: MAX_PET = GetVar(App.Path & "\Data.ini", "MAX", "MAX_PETS")
Put the MAX_PETS=*number of maxes you want, i recommend over 200 because that's for the whole game not just the map*.

Edit2: PET_REGEN = GetVar(App.path & "\Data.ini", "PET", "PETRegen") same as the max pets.
Also at the bottom make new [PET] and at the end add PETRegen=1(or 0 if you do not want to heal the pet)
Link to comment
Share on other sites

Off topic: How do you (ridrik) have four stars with 288 posts and DNA has 3 with 400 posts?

I think we should for the npcs per map have 15 plus the max amount of players available on one map at one time. so 50 pets would be allowed without fuss if each player has one pet.
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...