EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 Hey ^^Im using the lightning pet system:http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.htmlwith this modify:http://www.touchofdeathforums.com/smf/index.php/topic,69925.0.htmland 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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 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) ```thenfind```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 More sharing options...
Yxxe Posted April 14, 2011 Share Posted April 14, 2011 You could fix this by removing the line which takes the item in the first place. Link to comment Share on other sites More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 That's what i wanted to do first then i was like if he puts the pet on the item would stay there and all oh well Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 > 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 optimaland 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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 if that's in the right place then yea you can just delete it. (is probably be in summon pet thing right?)btw did my thing not work? Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 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 ... xDso 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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 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 More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 ya i understood xD ok i dont touch it again oO hehe ^^ Link to comment Share on other sites More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 You should have tested the code i wrote by now did it work or? Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 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 ? :) ^^ Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 ok i got the next error :(if my pet wants to attack this appers:Compile error: Argument not optionalon this line :> 'Disband the pet> Â Â Â Â Â Â PetDisband PetOwner, GetPlayerMap(PetOwner)> Â Â Â Â End If(modcombat sub npcattacknpc) Link to comment Share on other sites More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 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 worksince 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 More sharing options...
Yxxe Posted April 14, 2011 Share Posted April 14, 2011 @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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 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 More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 ```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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 the thing i just gave you didn't work?? Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 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 More sharing options...
Yxxe Posted April 14, 2011 Share Posted April 14, 2011 @EisKeks:> i have all you write up on your post but the error on npcattacknpc appers if i try to attack an npc with my petLike Musbah said, you need to call PetDisband with the petnum parameter as well. Link to comment Share on other sites More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 in npcattacknpc dim petnum then petnum=Trim$(Player(index).Pet.SpriteNum) then just replace PetDisband PetOwner, GetPlayerMap(PetOwner) with PetDisband PetOwner, GetPlayerMap(PetOwner),petnumexactly like before…just repeat the process till you add the last parameter to all the petdibandsbtw 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 More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 ya ok ^^ thankyou now it works ^^ Link to comment Share on other sites More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 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 More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 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 More sharing options...
goku1993 Posted April 14, 2011 Share Posted April 14, 2011 Tottaly forgot there was no index for that sorry, ok just checked the sub try replacing index with PetOwnerI think that should work Link to comment Share on other sites More sharing options...
EisKeks Posted April 14, 2011 Author Share Posted April 14, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now