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

I need help with my start of a pet-script…


Sealbreaker
 Share

Recommended Posts

yeah…the name says everything... pls dont say things like: dont try it man or somethin like this <.<

so, here is my script and i dont know why it doesnt work....

```
    Case "/summonpet"
        DIM playerx
        DIM playery
        DIM playermap
        DIM npconmap+1
        DIM npconmap
        DIM playertarget
        DIM playermp
        DIM petnumber
        DIM petsnumber+1
        DIM petsnumber
        DIM petdef
        DIM petstr
        DIM petmaxhp
        DIM pethp
        DIM petmapnumber

        playerx = GetPlayerX(index)
        playery = GetPlayerY(index)
        playermap = GetPlayerMap(index)
        npconmap+1 = GetMapNpcNumber(GetPlayerMap(index), index) + 1)
        npconmap = GetMapNpcNumber(GetPlayerMap(index), index)
        playertarget = GetPlayerTargetNpc(index)
        playermp = GetPlayerMP(index) - 20)
        petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")
        petsnumber+1 = GetVar("Data.ini", "PETS", "petsnumber") + 1)
        petsnumber = GetVar("Data.ini", "PETS", "petsnumber")
        petdef = GetNpcDefense(petnumber)
        petstr = GetNpcStrength(petnumber)
        petmaxhp = GetNpcMaxHP(index)
        pethp = GetNpcHP(petnumber)
        petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")

                    If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
                    If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", petsnumber+1)
                                  Call PutVar("Data.ini", "PETS", "petsnumbers", petsnumber+1)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", 40)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", 35)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", 10)
                                  Call ScriptSpawnNpc(npconmap+1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", npconmap+1)
                                  Call SetPlayerMP(index, playermp) 
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call SendNPC(playermap, npconmap)
                    ElseIf GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 1) Then
                    If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call ScriptSpawnNpc(npconmap+1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call SetPlayerMP(index, playermp)
                                  Call SendNPC(playermap, npconmap) 
        End If
Exit Sub
```
here is the .ini:

```
[PET]
activatedbefore=0
petactivated=0
petattacking=0
petdead=0
petnumber=0
petmapnumber=0
petstr=0
petdef=0
pethp=0
petexp=0

```
i created a .ini file by myself for testing the script….called it sealbreaker and called my char sealbreaker.... but thecommand doesnt do anything... help pls.. =P
Link to comment
Share on other sites

the ifs are really bugged.Theres 3 ifs and you only put 1 end if =X
You can try this way
```
      Case "/summonpet"
        DIM playerx
        DIM playery
        DIM playermap
        DIM npconmap+1
        DIM npconmap
        DIM playertarget
        DIM playermp
        DIM petnumber
        DIM petsnumber+1
        DIM petsnumber
        DIM petdef
        DIM petstr
        DIM petmaxhp
        DIM pethp
        DIM petmapnumber

        playerx = GetPlayerX(index)
        playery = GetPlayerY(index)
        playermap = GetPlayerMap(index)
        npconmap+1 = GetMapNpcNumber(GetPlayerMap(index), index) + 1)
        npconmap = GetMapNpcNumber(GetPlayerMap(index), index)
        playertarget = GetPlayerTargetNpc(index)
        playermp = GetPlayerMP(index) - 20)
        petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")
        petsnumber+1 = GetVar("Data.ini", "PETS", "petsnumber") + 1)
        petsnumber = GetVar("Data.ini", "PETS", "petsnumber")
        petdef = GetNpcDefense(petnumber)
        petstr = GetNpcStrength(petnumber)
        petmaxhp = GetNpcMaxHP(index)
        pethp = GetNpcHP(petnumber)
        petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")

                    If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
                      If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", petsnumber+1)
                                  Call PutVar("Data.ini", "PETS", "petsnumbers", petsnumber+1)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", 40)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", 35)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", 10)
                                  Call ScriptSpawnNpc(npconmap+1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", npconmap+1)
                                  Call SetPlayerMP(index, playermp)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                      End If          Call SendNPC(playermap, npconmap)
                    ElseIf GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 1) Then
                        If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call ScriptSpawnNpc(npconmap+1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call SetPlayerMP(index, playermp)
                                  Call SendNPC(playermap, npconmap)
                    End If
                        End If
Exit Sub

```
Link to comment
Share on other sites

then it says:

TYPE: anweisungsende erwartet ( i'm german btw ;D )
LINE: 72
COLUMN: 12
CODE:
DIM npconmap+1

when i type: /summonpet

it says:

TYPE: typen unverträglich ( i think it means types dont match or somethin ) 'Commands'
LINE: 1
COLUMN: 0
CODE: ( there is no code… )

EDIT:sorry expected you saying i have to write every error i get before i post..so its doublepost - sorry
Link to comment
Share on other sites

i want to have the vars for later on…like to have the options....
anyways, i deleted any + that wasnt needed.... only error i get is ( at starting) :

LINE: 87
COLUMN: 59
CODE:
npconmap1 = GetMapNpcNumber(GetPlayerMap(index), index) + 1)

this is the code I'm using atm:

```
      Case "/summonpet"
        DIM playerx
        DIM playery
        DIM playermap
        DIM npconmap1
        DIM npconmap
        DIM playertarget
        DIM playermp
        DIM petnumber
        DIM petsnumber1
        DIM petsnumber
        DIM petdef
        DIM petstr
        DIM petmaxhp
        DIM pethp
        DIM petmapnumber

        playerx = GetPlayerX(index)
        playery = GetPlayerY(index)
        playermap = GetPlayerMap(index)
        npconmap1 = GetMapNpcNumber(GetPlayerMap(index), index) + 1)
        npconmap = GetMapNpcNumber(GetPlayerMap(index), index)
        playertarget = GetPlayerTargetNpc(index)
        playermp = GetPlayerMP(index) - 20)
        petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")
        petsnumber1 = GetVar("Data.ini", "PETS", "petsnumber") + 1)
        petsnumber = GetVar("Data.ini", "PETS", "petsnumber")
        petdef = GetNpcDefense(petnumber)
        petstr = GetNpcStrength(petnumber)
        petmaxhp = GetNpcMaxHP(index)
        pethp = GetNpcHP(petnumber)
        petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")

                    If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
                      If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", petsnumber1)
                                  Call PutVar("Data.ini", "PETS", "petsnumbers", petsnumber1)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", 40)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", 35)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", 10)
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", npconmap+1)
                                  Call SetPlayerMP(index, playermp)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                    End If
                    ElseIf GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 1) Then
                        If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call SetPlayerMP(index, playermp)
                    End If
                        End If
Exit Sub
```
Link to comment
Share on other sites

gives me the same error… =/

code:

```
      Case "/summonpet"
        DIM playerx
        DIM playery
        DIM playermap
        DIM npconmap1
        DIM npconmap
        DIM playertarget
        DIM playermp
        DIM petnumber
        DIM petsnumber1
        DIM petsnumber
        DIM petdef
        DIM petstr
        DIM petmaxhp
        DIM pethp
        DIM petmapnumber

        playerx = GetPlayerX(index)
        playery = GetPlayerY(index)
        playermap = GetPlayerMap(index)
        npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index) + 1)
        npconmap = GetMapNpcNumber(GetPlayerMap(index), index)
        playertarget = GetPlayerTargetNpc(index)
        playermp = Int(GetPlayerMP(index) - 20)
        petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")
        petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber") + 1)
        petsnumber = GetVar("Data.ini", "PETS", "petsnumber")
        petdef = GetNpcDefense(petnumber)
        petstr = GetNpcStrength(petnumber)
        petmaxhp = GetNpcMaxHP(index)
        pethp = GetNpcHP(petnumber)
        petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")

                    If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
                      If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", petsnumber1)
                                  Call PutVar("Data.ini", "PETS", "petsnumbers", petsnumber1)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", 40)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", 35)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", 10)
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", npconmap+1)
                                  Call SetPlayerMP(index, playermp)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                    End If
                    ElseIf GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 1) Then
                        If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call SetPlayerMP(index, playermp)
                    End If
                        End If
Exit Sub
```
Link to comment
Share on other sites

```
      Case "/summonpet"
        DIM playerx
        DIM playery
        DIM playermap
        DIM npconmap1
        DIM npconmap
        DIM playertarget
        DIM playermp
        DIM petnumber
        DIM petsnumber1
        DIM petsnumber
        DIM petdef
        DIM petstr
        DIM petmaxhp
        DIM pethp
        DIM petmapnumber

        playerx = GetPlayerX(index)
        playery = GetPlayerY(index)
        playermap = GetPlayerMap(index)
        npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1
        npconmap = GetMapNpcNumber(GetPlayerMap(index), index)
        playertarget = GetPlayerTargetNpc(index)
        playermp = Int(GetPlayerMP(index) - 20)
        petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")
        petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1
        petsnumber = GetVar("Data.ini", "PETS", "petsnumber")
        petdef = GetNpcDefense(petnumber)
        petstr = GetNpcStrength(petnumber)
        petmaxhp = GetNpcMaxHP(index)
        pethp = GetNpcHP(petnumber)
        petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")

                    If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
                      If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", petsnumber1)
                                  Call PutVar("Data.ini", "PETS", "petsnumbers", petsnumber1)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", 40)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", 35)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", 10)
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", npconmap+1)
                                  Call SetPlayerMP(index, playermp)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                    End If
                    ElseIf GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 1) Then
                        If GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 0) Then
                                  Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber)
                                  Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
                                  Call PlayerMsg(index, "You summoned your pet", GREEN)
                                  Call SetPlayerMP(index, playermp)
                    End If
                        End If
Exit Sub

```

so like this? ( oh btw, read your answer after posting…sorry... ;D )
Link to comment
Share on other sites

```
If GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore", 0) Then
```Should be:
```
If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 0 Then
```
```
Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", 1)
```Should be:
```
Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1")
```or:
```
Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", CStr(1))
```
To give just a few examples.

Regards,
  Godlord.
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...