RyokuHasu Posted June 6, 2011 Author Share Posted June 6, 2011 ** This Is my 2nd Mod to Lightning's pet system, enjoy.This tut Is to help fill in the blanks of the pet system combat. It adds all the basic checks of PVP combat.it adds these to fighting with pets-owner level 10 check (cant fight with players under level 10)-cant fight aginst admins using a pet-cant attack an admin's pet-cant attack an admin's pet with a pet-admins cant attack players with a pet-admins cant attack a player's pet-admins can attack a player's pet using a pet-pets follow map moral when fighting players and other pets-can not accidently attack your own pet**Prerequired TUT - Lightning's pet system**http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.html**Highly suggested Pet Mod, Summoning with items**http://www.touchofdeathforums.com/smf/index.php/topic,69925.0.html**SERVER**in modCombat Find "Public Function CanPlayerAttackNpc"above```CanPlayerAttackNpc = True```add```Dim petowner As Long```above```' attack speed from weapon```add``` If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If attacker = petowner Then Call PlayerMsg(attacker, "You can not attack your own pet.", BrightRed) Exit Function End If End IfIf MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then If Not Map(GetPlayerMap(attacker)).Moral = MAP_MORAL_NONE Then Call PlayerMsg(attacker, "This is a safe zone! You can not attack another player's pet.", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerAccess(petowner) > ADMIN_MONITOR Then Call PlayerMsg(attacker, "You cannot attack " & GetPlayerName(petowner) & "'s pet!", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then If GetPlayerAccess(attacker) > ADMIN_MONITOR Then Call PlayerMsg(attacker, "Admins cannot attack another player's pet.", BrightBlue) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerLevel(petowner) < 10 Then Call PlayerMsg(attacker, GetPlayerName(petowner) & " is below level 10, you cannot attack this player's pet yet!", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then If GetPlayerLevel(attacker) < 10 Then Call PlayerMsg(attacker, "You are below level 10, you cannot attack another player with a pet yet!", BrightRed) Exit Function End If End If```Find "Function CanNpcAttackPlayer"Under```Dim npcNum As Long```add```Dim petowner As Long```above```' Make sure they are on the same map```add```If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If Not Map(GetPlayerMap(petowner)).Moral = MAP_MORAL_NONE Then Call PlayerMsg(petowner, "This is a safe zone! You can not attack players with a pet.", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerAccess(petowner) > ADMIN_MONITOR Then Call PlayerMsg(petowner, "Admins cannot use pet to attack other players.", BrightBlue) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerAccess(Index) > ADMIN_MONITOR Then Call PlayerMsg(petowner, "You cannot attack " & GetPlayerName(Index) & " with a pet!", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerLevel(petowner) < 10 Then Call PlayerMsg(petowner, "You are below level 10, you cannot attack another player with a pet yet!", BrightRed) Exit Function End If End If If MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.Owner If GetPlayerLevel(Index) < 10 Then Call PlayerMsg(petowner, GetPlayerName(petowner) & " is below level 10, you can not attack this player with a pet yet!", BrightRed) Exit Function End If End If```find "Function CanNpcAttackNpc"under```Dim AttackerY As Long```add```Dim petowner As Long```above```' Make sure the npcs arent already dead```add```If MapNpc(MapNum).NPC(attacker).IsPet = YES Then If MapNpc(MapNum).NPC(Victim).IsPet = YES Then petowner = MapNpc(MapNum).NPC(attacker).PetData.Owner If Not Map(GetPlayerMap(petowner)).Moral = MAP_MORAL_NONE Then Call PlayerMsg(petowner, "This is a safe zone! You can not attack another player's pet with a pet.", BrightRed) Exit Function End If End If End If If MapNpc(MapNum).NPC(attacker).IsPet = YES Then If MapNpc(MapNum).NPC(Victim).IsPet = YES Then petowner = MapNpc(MapNum).NPC(attacker).PetData.Owner If GetPlayerAccess(petowner) > ADMIN_MONITOR Then Call PlayerMsg(petowner, "Admins cannot use a pet to attack another player's pet.", BrightBlue) Exit Function End If End If End If If MapNpc(MapNum).NPC(attacker).IsPet = YES Then If MapNpc(MapNum).NPC(Victim).IsPet = YES Then petowner = MapNpc(MapNum).NPC(Victim).PetData.Owner If GetPlayerAccess(petowner) > ADMIN_MONITOR Then Call PlayerMsg(petowner, "You cannot use a pet to attack " & GetPlayerName(petowner) & "'s pet.", BrightBlue) Exit Function End If End If End If If MapNpc(MapNum).NPC(attacker).IsPet = YES Then If MapNpc(MapNum).NPC(Victim).IsPet = YES Then petowner = MapNpc(MapNum).NPC(attacker).PetData.Owner If GetPlayerLevel(petowner) < 10 Then Call PlayerMsg(petowner, "You are below level 10, you cannot attack another player's pet with a pet yet!", BrightRed) Exit Function End If End If End If If MapNpc(MapNum).NPC(attacker).IsPet = YES Then If MapNpc(MapNum).NPC(Victim).IsPet = YES Then petowner = MapNpc(MapNum).NPC(Victim).PetData.Owner If GetPlayerLevel(petowner) < 10 Then Call PlayerMsg(petowner, GetPlayerName(petowner) & " is below level 10, you cannot attack this player's pet with a pet yet!", BrightRed) Exit Function End If End If End If```**DONE** Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 6, 2011 Author Share Posted June 6, 2011 ADDED you can not attack your own pet.PS did you know You can add the pet summon item to your hot bar ad summon it? =D Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 6, 2011 Author Share Posted June 6, 2011 Sorry for tripple post butFIXED NPC attack NPCNow it checks if both are pets Link to comment Share on other sites More sharing options...
Suppositoire Posted June 6, 2011 Share Posted June 6, 2011 Very good ^^ Just damage that I can not use him as I do not use the prerequisite "Highly suggested Mod- Sommoming the pets with items" Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 6, 2011 Author Share Posted June 6, 2011 thats why it is suggested, its not required. Link to comment Share on other sites More sharing options...
Suppositoire Posted June 7, 2011 Share Posted June 7, 2011 @RyokuHasu:> thats why it is suggested, its not required.Yes, ^^' I badly read Link to comment Share on other sites More sharing options...
Link Posted June 7, 2011 Share Posted June 7, 2011 ```[quote]-derp derp let me quote the whole post derp derp-[color][b]DONE[/b][/color][/quote]Did it once again, keep these nice releases coming they're working great.``` Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 7, 2011 Author Share Posted June 7, 2011 Thanks glad you like it. ^_^ and be sure you check out the one that is for server crashes and better cleaning up of pets. Its a WAY more important mod. Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 9, 2011 Author Share Posted June 9, 2011 Small Bug found, will update soon.* * *FIXEDthe first large chunk of code was moved to above```' attack speed from weapon```in the same function Link to comment Share on other sites More sharing options...
EclipseCommunity Posted June 10, 2011 Share Posted June 10, 2011 @RyokuHasu:> Small Bug found, will update soon.> > * * *> > FIXED> > the first large chunk of code was moved to above> > ```> CanPlayerAttackNpc = True> > ```in the same functionDont understand this bit. Why would you put **Dim petowner As Long** just above **CanPlayerAttackNpc = True**? Link to comment Share on other sites More sharing options...
RyokuHasu Posted June 10, 2011 Author Share Posted June 10, 2011 well in your qoute i miss pasted an edit, ill filx that single postButDim Petowner is obviously for knowing who owns the pet and that location is the corret area, just a funny way of saying it. Link to comment Share on other sites More sharing options...
Ariel Posted June 17, 2012 Share Posted June 17, 2012 Am i the only one who get that:if i hit ctrl with out any target or not even near the pet i get a massage that i cant attack my pet 0.0 why?Thank you :) Link to comment Share on other sites More sharing options...
Justn Posted June 17, 2012 Share Posted June 17, 2012 Well I never experienced that and I was using this for awhile(since first day it was posted) are you sure you put the code in the right spot? Link to comment Share on other sites More sharing options...
Ariel Posted June 17, 2012 Share Posted June 17, 2012 I double checked now :Z I cant go back to the map i was also maybe its connected to that somehow (when i try the client just freeze) Link to comment Share on other sites More sharing options...
Snoozey Posted June 21, 2012 Share Posted June 21, 2012 Hm Pets can still attacks non pet npcs? Did I mess something up? If not how would I add a check to see if the target of the pet is a friendly,guard, or shopkeeper?My fix, it seems to work, but not really sure how well. Most likely you will need to fix this. I am using it as a temp until I figure out how to properly do it. The text does not display at all.``` 'pet stuffIf MapNpc(MapNum).NPC(Attacker).IsPet = YES ThenIf NPC(vNpcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Or NPC(vNpcNum).Behaviour = NPC_BEHAVIOUR_SHOPKEEPER Or NPC(vNpcNum).Behaviour = NPC_BEHAVIOUR_GUARD ThenCall PlayerMsg(petowner, "Can't attack friendly allies.", BrightRed)Exit Function``` Link to comment Share on other sites More sharing options...
Joost Posted June 21, 2012 Share Posted June 21, 2012 Some of the If statements seem a bit pointless, like checking MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES every time. As an example of what I mean, here's how I would do it (pretty much the exact same code except i deleted things :P)```petowner = MapNpc(MapNum).NPC(mapNpcNum).PetData.OwnerIf MapNpc(MapNum).NPC(mapNpcNum).IsPet = YES Then If attacker = petowner Then Call PlayerMsg(attacker, "You can not attack your own pet.", BrightRed) Exit Function End If If Not Map(GetPlayerMap(attacker)).Moral = MAP_MORAL_NONE Then Call PlayerMsg(attacker, "This is a safe zone! You can not attack another player's pet.", BrightRed) Exit Function End If If GetPlayerAccess(petowner) > ADMIN_MONITOR Then Call PlayerMsg(attacker, "You cannot attack " & GetPlayerName(petowner) & "'s pet!", BrightRed) Exit Function End If If GetPlayerAccess(attacker) > ADMIN_MONITOR Then Call PlayerMsg(attacker, "Admins cannot attack another player's pet.", BrightBlue) Exit Function End If If GetPlayerLevel(petowner) < 10 Then Call PlayerMsg(attacker, GetPlayerName(petowner) & " is below level 10, you cannot attack this player's pet yet!", BrightRed) Exit Function End If If GetPlayerLevel(attacker) < 10 Then Call PlayerMsg(attacker, "You are below level 10, you cannot attack another player with a pet yet!", BrightRed) Exit Function End IfEnd If``` Link to comment Share on other sites More sharing options...
jokerman Posted December 28, 2012 Share Posted December 28, 2012 Thank ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) 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