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

for this to work:
If Map(Y).Pet(X) > 0 Then
                    If MapPet(Y, X).num > 0 Then
                        Target = MapPet(Y, X).Target

Dont you need to Add this:
Pet(1 To 20) As Integer

to Type MapRec

Well Depends on the MAX_MAP_PETS

Public Const MAX_MAP_NPCS = 51
Public Const MAX_MAP_PETS = 20
???

Also in the client you need this in GLobalS:
Public MapPet(1 To MAX_MAP_PETS) As MapPetRec

AND THIS IN ModTypes:
Type MapPetRec
    num As Long

    Target As Long

    HP As Long
    MaxHp As Long
    MP As Long
    SP As Long

    Map As Long
    X As Byte
    y As Byte
    Dir As Byte
    Big As Byte

    ' Client use only
    xOffset As Integer
    yOffset As Integer
    Moving As Byte
    Attacking As Byte
    AttackTimer As Long
End Type

And this in constants:
Public Const MAX_MAP_PETS = 20

I know you added a MAX_PETS earlier but thats for the world right? This should be Per Map
Link to comment
Share on other sites

  • Replies 417
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

@Bloodmyst:

> Well it started out as pure script then it turned to the SOurce code

Yea, which defeats the purpose of a "pet script" (actually, I already said a number of times, and even told you guys, it's better to source a pet system because it simply cannot be easily scripted).

Either way, I'll get this topic out of the Scripting Boards.
Link to comment
Share on other sites

OK? thats why we are sourcing it lol…. I know source is better than Script and i never said this was a Pet Script i said it was a pet System... Which requires both SOurce and Script, i just dint think it would need so much source so i put it in Scripts
Link to comment
Share on other sites

Well, the scripting boards are designed for pure sadscript; the reason we even have sadscript, and the main.txt, is because not everyone can edit the source code, but everyone can edit the Main.txt

@Bloodmyst:

> i never said this was a Pet Script i said it was a pet System…

If I may refer to the title of your post,
_Pet System **script**_, or moreso:
@Bloodmyst:

> Hey guys im **scripting** a pet system

A System does not necessarily mean "script and code"; I made a Leveling Spells system entirely scripted, as well as a Gun System (no, not using arrows) that's entirely scripted; according to the [Dictonary](http://dictionary.reference.com/browse/System), a system is defined as "_an assemblage or combination of things or parts forming a complex or unitary whole_"; this could range from scripts and source, to multiple scripted subs working together, etc.
Link to comment
Share on other sites

Well isint the source code also made up of scripts? therefore Scripting dosent necessarily reefer to Sadscripting…. Anyways as i said In the beginning this was a Pure SadScript System, but now its gotten more complicated. it dosent matter it was moved to source Code.
Link to comment
Share on other sites

In one post you said it started as "pure script", then in the next post you said "i never said this was a Pet Script", which got me confused.

Also, technically scripting is an interpreted language (vbscript, javascript, php, etc), while in VB, the codes are compiled (yes, the syntax to vbscript and vb is similar, and the sadscript commands are the same, but it's still compiled in the end).

Either way, yea, it's in the correct board now.  Hope this works out, would still be a benefit to the community.
Link to comment
Share on other sites

This goes in database under SetPlayerName:
```
Sub SetPetName(ByVal Index As Long, ByVal Name As String)
    pet(Index).Name = Name
End Sub
Sub GetPetName(ByVal Index As Long, ByVal Name As String)
    pet(Index).Name = Name
End Sub
```
This goes in the constants, under NPC constants.

```
' PET constants
Public Const PET_BEHAVIOR_ATTACKONSIGHT = 0
Public Const PET_BEHAVIOR_ATTACKWHENATTACKED = 1
Public Const PET_BEHAVIOR_FRIENDLY = 2
Public Const PET_BEHAVIOR_SHOPKEEPER = 3
Public Const PET_BEHAVIOR_GUARD = 4
Public Const PET_BEHAVIOR_SCRIPTED = 5
Public Const PET_BEHAVIOR_RELAXED = 6
```
Both to client side.
Link to comment
Share on other sites

Oh wow i wrote Publix instead of Public and it gave me an error lol

Anyways inorder for Those subs to work you need this Right above MapPetRec in ModTypes:
Type PetRec
    Name As String * NAME_LENGTH
    AttackSay As String * 100

    Sprite As Long
    SpawnSecs As Long
    Behavior As Byte
    Range As Byte
    SpriteSize As Long

    STR  As Long
    DEF As Long
    speed As Long
    MAGI As Long
    Big As Long
    MaxHp As Long
    Exp As Long
    SpawnTime As Long
    Spell As Long

    Element As Long
End Type

And Also you need:
Public Pet() As PetRec

RIght under
Public Item() As ItemRec
Public Npc() As NpcRec

In ModGLobals
Link to comment
Share on other sites

ANyways I need the Scripts on Spawning the Pets, YOU got them? or is someone else doing that.

Woops sorry for double post.

Anyways im Missing SOme Subs Like The SpawnPet in server side i think

EDIT3:It coudl be im missing some codes
Link to comment
Share on other sites

frmServer.tmrPet.Enabled = True - gives me an error on this, this command is to start the Public Sub Pet()

EDIT: in in server, general, search for```
frmServer.tmrGameAI.Enabled = True
```And right under that put
```
frmServer.tmrPet.Enabled = True
```
Also add this after CheckMapNpc

```
Call ClearMapPets
    Call SetStatus("Clearing pets...")
```
Add this in database:

```
Sub ClearMapPets()
    Dim X As Long
    Dim Y As Long

    For Y = 1 To MAX_MAPS
        For X = 1 To MAX_MAP_PETS
            Call ClearMapPet(X, Y)
        Next X
    Next Y
End Sub
```
Link to comment
Share on other sites

Most likely, but fix the error about the pet sub.

EDIT: At very bottom, database add this :

```
Function GetPlayerTargetPet(ByVal index As Long) As Long
    GetPlayerTargetPet = Player(index).TargetPET
End Function
```
Also we can make a new folder in server and add this:

```
Sub LoadPets()
    Dim FileName As String
    Dim I As Integer
    Dim f As Long

    Call CheckNpcs

    For I = 1 To MAX_PETS
        temp = I / MAX_PETS * 100
        Call SetStatus("Loading pets... " & temp & "%")
        FileName = App.path & "\Pets\pet" & I & ".dat"
        f = FreeFile
        Open FileName For Binary As #f
        Get #f, , PET(I)
        Close #f

    Next I
End Sub
```
Link to comment
Share on other sites

Ridrik you need to fully tell Everythign not just add this but also everythign that comes with it…. LIke for exaple @Ridrik:

> Most likely, but fix the error about the pet sub.
>
> EDIT: At very bottom, database add this :
>
> ```
> Function GetPlayerTargetPet(ByVal index As Long) As Long
>     GetPlayerTargetPet = Player(index).TargetPET
> End Function
> ```

YOu also need "TargetPET As Long" At ModTYpes ifnot the Player(Inded).TargetPET wont work
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...