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

[EO2.0] [VB6] Pet item


EisKeks
 Share

Recommended Posts

Hey ^^

Im using the lightning pet system:
http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.html
with this modify:
http://www.touchofdeathforums.com/smf/index.php/topic,69925.0.html

and my question is how can i change the pet disband button to get my petitem back that i used?

:)

mfg EisKeks
Link to comment
Share on other sites

You mean get the item back after using pet?
I don't have the source so didn't test this but try:

in Public Sub HandlePetDisband add```
dim petnum as long
```
then somwhere write```
petnum= Trim$(Player(index).Pet.SpriteNum)
```
then

find```
PetDisband Index, GetPlayerMap(Index)
```

and change it to

```
PetDisband Index, GetPlayerMap(Index), petnum
```
find```
Sub PetDisband(ByVal Index As Long, ByVal MapNum As Long)
```
change to
```
Sub PetDisband(ByVal Index As Long, ByVal MapNum As Long, npcnum As Long)
```
at the end of the sub before the end sub add :```
Call GiveInvItem(index, npcNum, 0)
```
go to sub PlayerWarp and add```
dim petnum as long
```
then```
petnum = Trim$(Player(index).Pet.SpriteNum)
```
then find```
PetDisband Index, OldMap
```
and change it to

```
PetDisband Index, OldMap, petnum
```

like i said no idea if it will work i did it right now but reading the tutorial but it should work unless i did a stupid mistake.

Btw if you haven't read below i forgot a lot of petdisbands changes so each time you get an error concerning that just do what i did above(there are a few examples in posts below too…)
Link to comment
Share on other sites

> You could fix this by removing the line which takes the item in the first place.

i don't know how you mean this :o sorry :/ can you explain this a bit for me pls ? :)

Modify:

You mean i have only to del this ?
```
Call TakeInvItem(index, itemnum, 0)
```
and musbah if i try yours i get Compile error: Argument not optimal

and this line is shown

> 'switch maps
>         PetDisband Index, OldMap

(only if i try to login with the client)
Link to comment
Share on other sites

if i del this line the item dont go away but … xD if i do 2x double klick on it it multiplys in my inventory ... xD

so and i want that the item comes back after klicking the disbaned button.

and if i try yours i get an error messege on server if i try to log in its in the modify up your post.

The line is in modPlayer sub Useitem

```
Call TakeInvItem(index, itemnum, 0)
```
Link to comment
Share on other sites

Modified my thing sorry didn't see the other PetDisband try the code now? (no idea if what i just tried will work)

oh and btw you can't del```
Call TakeInvItem(index, itemnum, 0)
```from sub Useitem because sub use item is for all the items and if it doesn't remove the item when you click on it meaning that the item will not disappear (it usually does but comes back after unequip) but since you told it not to disappear 2 will appear (no idea if you understood what i just said but don't touch sub Useitem)
Link to comment
Share on other sites

ok i got the next error :(

if my pet wants to attack this appers:

Compile error: Argument not optional

on this line :

> 'Disband the pet
>             PetDisband PetOwner, GetPlayerMap(PetOwner)
>         End If

(modcombat sub npcattacknpc)
Link to comment
Share on other sites

ok try this:
find Sub LeftGame and add```
dim petnum as long
```then add
```
petnum = Trim$(Player(index).Pet.SpriteNum)
```then before the last end if in the sub add
```
PetDisband Index, GetPlayerMap(Index), petnum
```
this should work

since there are some petdisbands that i didn't see just keep doing the same thing i'm doing or just put a comma at the end of it and add: Trim$(Player(index).Pet.SpriteNum)

for example like:
PetDisband PetOwner, GetPlayerMap(PetOwner),Trim$(Player(index).Pet.SpriteNum)

but would be better if you organize it and put Trim$(Player(index).Pet.SpriteNum)  in a variable like i did just now before, you should be able to fix all the petdisbands on your own.

if you need any help ask me but i showed you how to fix petdisbands with three examples if you find more do like i did…
Link to comment
Share on other sites

@EisKeks:

> your script is working wow O_O thankyou nice :D do you have an idea hot to auto disband the pet when a player logs out or quited the game ? :) ^^

I should have already handled that in the original tutorial, I forget. xP If I haven't, all you need to do is go to Sub LeaveGame (I think its called that, otherwise something like that) and check whether the player has a pet summoned. If they do, just call PetDisband.

@EisKeks:

> ok i got the next error :(
>
> if my pet wants to attack this appers:
>
> Compile error: Argument not optional
>
> on this line :
>
> (modcombat sub npcattacknpc)

What "PetDisband" procedure are you using? I've checked, the original one has two parameters, post your "PetDisband" sub here please, thanks.
Link to comment
Share on other sites

He's using the one in my post thing cause he wanted the item to get come back after petdisband that's all and i just forgot to give him the call for all the petdisband stuff but already wrote what he should do post above i think it should work fine, but i might be wrong i guess…
Link to comment
Share on other sites

```
Sub PetDisband(ByVal Index As Long, ByVal MapNum As Long, npcnum As Long)
    If TempPlayer(Index).TempPetSlot < 1 Then Exit Sub

    Call ClearSingleMapNpc(TempPlayer(Index).TempPetSlot, MapNum)
    Map(GetPlayerMap(Index)).Npc(TempPlayer(Index).TempPetSlot) = 0
    TempPlayer(Index).TempPetSlot = 0
    Call GiveInvItem(Index, npcnum, 0)
End Sub
```
Link to comment
Share on other sites

i have all you write up on your post but the error on npcattacknpc appers if i try to attack an npc with my pet

> ok i got the next error :(
>
> if my pet wants to attack this appers:
>
> Compile error: Argument not optional
>
> on this line :
>
>     'Disband the pet
>                 PetDisband PetOwner, GetPlayerMap(PetOwner)
>             End If
>
> (modcombat sub npcattacknpc)
Link to comment
Share on other sites

in npcattacknpc dim petnum then petnum=Trim$(Player(index).Pet.SpriteNum)  then just replace PetDisband PetOwner, GetPlayerMap(PetOwner) with PetDisband PetOwner, GetPlayerMap(PetOwner),petnum

exactly like before…

just repeat the process till you add the last parameter to all the petdibands

btw you can also just change it to 
PetDisband PetOwner, GetPlayerMap(PetOwner),Trim$(Player(index).Pet.SpriteNum) 

just don't like that way
Link to comment
Share on other sites

np if you get a problem somwhere else that's different then petdisband (you should be able to fix it by yourself) I'll help you as much as i can (I'm not really a programmer just know some vb6 and adding stuff to the engine is easy you really don't have to be a programmer to do it)
Link to comment
Share on other sites

ok there is something i done wrong i think cause at first i added

```
Dim petnum As Long
```
then

```
petnum = Trim$(Player(Index).Pet.SpriteNum)
```
and then i changed

```
PetDisband PetOwner, GetPlayerMap(PetOwner)
```this to this
```
PetDisband PetOwner, GetPlayerMap(PetOwner), petnum
```
and now i get variable not defined

(Index)
in this code

> petnum = Trim$(Player(Index).Pet.SpriteNum)

so how can i define it here?

> Sub NpcAttackNpc(ByVal MapNum As Long, ByVal attacker As Long, ByVal Victim As Long, ByVal Damage As Long)
Link to comment
Share on other sites

ok it works good ^^

but i got an other problem left.
if i restart the server all the spawned pets stay in the map properties even if they are disbaned and they spawn as npc if i restart the server.

can i clean them anyhow out when they disband?
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...