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

Ridrik

Members
  • Posts

    331
  • Joined

  • Last visited

    Never

Everything posted by Ridrik

  1. DONE!!! YES!!! Now all we need is a script to spawn. Edit: Hm… I don't know, i think i fixed it in my server/client but i forgot how
  2. Ohhhh… thanks, i'll do that right now.
  3. Can you just write the code here please? Oh here's in game logic to restore pet's hp: ``` Function GetPetHPRegen(ByVal PETnum As Long) As Integer Dim Total As Integer If PETREGEN = 1 Then If PETnum < 1 Or PETnum > MAX_PETS Then Exit Function End If Total = Int(Pet(PETnum).DEF / 3) If Total < 1 Then Total = 1 End If GetPetHPRegen = Total End If End Function ``` Put it under any function. Also add this in game logic under any sub: ``` Sub ProcessPetMovement(ByVal MapPetNum As Long) ' Check if et is walking, and if so process moving them over If MapNpc(MaPetNum).Moving = MOVING_WALKING Then Select Case MapPet(MapPetNum).Dir Case DIR_UP MapPet(MapPetNum).yOffset = MapPet(MapPetNum).yOffset - WALK_SPEED Case DIR_DOWN MapPet(MapPetNum).yOffset = MapPet(MapPetNum).yOffset + WALK_SPEED Case DIR_LEFT MapPet(MapPetNum).xOffset = MapPet(MapPetNum).xOffset - WALK_SPEED Case DIR_RIGHT MapPet(MapPetNum).xOffset = MapPet(MapPetNum).xOffset + WALK_SPEED End Select ' Check if completed walking over to the next tile If (MapPet(MapNpcNum).xOffset = 0) And (MapPet(MapPetNum).yOffset = 0) Then MapPet(MapNpcNum).Moving = 0 End If End If End Sub ``` p.s the last code goes in the client.
  4. here's the pet sub: ``` Public Sub Pet() Dim I As Long, X As Long, Y As Long, n As Long, x1 As Long, y1 As Long, TickCount As Long Dim Damage As Long, DistanceX As Long, DistanceY As Long, PETnum As Long, Target As Long Dim DidWalk As Boolean, Pet(1 To 20) As Integer Dim index On Error Resume Next ' ///////////////////////////////////////// ' // This is used for ATTACKING ON SIGHT // ' ///////////////////////////////////////// ' Make sure theres a PET with the map If Map(Y).Pet(X) > 0 Then If MapPETS(Y, X).num > 0 Then ' If the pet is a attack on sight, search for a player on the map If Pet(PETnum).Behavior = PET_BEHAVIOR_ATTACKONSIGHT Or Pet(PETnum).Behavior = PET_BEHAVIOR_RELAXED Then For I = 1 To MAX_PLAYERS If IsPlaying(I) Then If GetPlayerMap(I) = Y Then If MapPET(Y, X).Target = 0 Then If GetPlayerAccess(I) GetPlayerX(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_LEFT) Then Call PETMove(Y, X, DIR_LEFT, MOVING_WALKING) DidWalk = True End If End If End If ' Down If MapPET(Y, X).Y < GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_DOWN) Then Call PETMove(Y, X, DIR_DOWN, MOVING_WALKING) DidWalk = True End If End If End If ' Up If MapPET(Y, X).Y > GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_UP) Then Call PETMove(Y, X, DIR_UP, MOVING_WALKING) DidWalk = True End If End If End If Case 2 ' Down If MapPET(Y, X).Y < GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_DOWN) Then Call PETMove(Y, X, DIR_DOWN, MOVING_WALKING) DidWalk = True End If End If End If ' Up If MapPET(Y, X).Y > GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_UP) Then Call PETMove(Y, X, DIR_UP, MOVING_WALKING) DidWalk = True End If End If End If ' Right If MapPET(Y, X).X < GetPlayerX(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_RIGHT) Then Call PETMove(Y, X, DIR_RIGHT, MOVING_WALKING) DidWalk = True End If End If End If ' Left If MapPET(Y, X).X > GetPlayerX(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_LEFT) Then Call PETMove(Y, X, DIR_LEFT, MOVING_WALKING) DidWalk = True End If End If End If Case 3 ' Left If MapPET(Y, X).X > GetPlayerX(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_LEFT) Then Call PETMove(Y, X, DIR_LEFT, MOVING_WALKING) DidWalk = True End If End If End If ' Right If MapPET(Y, X).X < GetPlayerX(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_RIGHT) Then Call PETMove(Y, X, DIR_RIGHT, MOVING_WALKING) DidWalk = True End If End If End If ' Up If MapPET(Y, X).Y > GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_UP) Then Call PETMove(Y, X, DIR_UP, MOVING_WALKING) DidWalk = True End If End If End If ' Down If MapPET(Y, X).Y < GetPlayerY(index) Then If DidWalk = False Then If CanPETMove(Y, X, DIR_DOWN) Then Call PETMove(Y, X, DIR_DOWN, MOVING_WALKING) DidWalk = True End If End If End If End Select ' Check if we can't move and if player is behind something and if we can just switch dirs If Not DidWalk Then If MapPET(Y, X).X - 1 = GetPlayerX(index) Then If MapPET(Y, X).Y = GetPlayerY(index) Then If MapPET(Y, X).Dir DIR_LEFT Then Call PETDir(Y, X, DIR_LEFT) End If End If DidWalk = True End If If MapPET(Y, X).X + 1 = GetPlayerX(index) Then If MapPET(Y, X).Y = GetPlayerY(index) Then If MapPET(Y, X).Dir DIR_RIGHT Then Call PETDir(Y, X, DIR_RIGHT) End If End If DidWalk = True End If If MapPET(Y, X).X = GetPlayerX(index) Then If MapPET(Y, X).Y - 1 = GetPlayerY(index) Then If MapNPET(Y, X).Dir DIR_UP Then Call PETDir(Y, X, DIR_UP) End If End If DidWalk = True End If If MapPET(Y, X).X = GetPlayerX(index) Then If MapPET(Y, X).Y + 1 = GetPlayerY(index) Then If MapPET(Y, X).Dir DIR_DOWN Then Call PETDir(Y, X, DIR_DOWN) End If End If DidWalk = True End If ' We could not move so player must be behind something, walk randomly. If Not DidWalk Then I = Int(Rnd * 2) If I = 1 Then I = Int(Rnd * 4) If CanPETMove(Y, X, I) Then Call PETMove(Y, X, I, MOVING_WALKING) End If End If End If End If Else MapPET(Y, X).index = 0 End If End If Else I = Int(Rnd * 4) If I = 1 Then I = Int(Rnd * 4) If CanPETMove(Y, X, I) Then Call PETMove(Y, X, I, MOVING_WALKING) End If End If End If End If End If End If ' ///////////////////////////////////////////// ' // This is used for pet to attack players // ' ///////////////////////////////////////////// ' Make sure theres a PET with the map If Map(Y).Pet(X) > 0 Then If MapPET(Y, X).num > 0 Then Target = MapPET(Y, X).Target ' Check if the PET can attack the targeted player player If Target > 0 Then ' Is the target playing and on the same map? If IsPlaying(Target) And GetPlayerMap(Target) = Y Then ' Can the pet attack the player? If CanPETAttackPlayer(X, Target) Then If Not CanPlayerBlockHit(Target) Then Damage = Pet(PETnum).STR - GetPlayerProtection(Target) If Damage > 0 Then If SCRIPTING = 1 Then MyScript.ExecuteStatement "Scripts\Main.txt", "PlayerHitPet " & Target & "," & X & "," & Damage Else Call PETAttackPlayer(X, Target, Damage) End If Else Call BattleMsg(Target, "The " & Trim(Pet(PETnum).Name) & " couldn't hurt you!", BRIGHTBLUE, 1) 'Call PlayerMsg(Target, "The " & Trim(PET(PETNum).Name) & "'s hit didn't even phase you!", BrightBlue) End If Else Call BattleMsg(Target, "You blocked the " & Trim(Pet(PETnum).Name) & "'s hit!", BRIGHTCYAN, 1) 'Call PlayerMsg(Target, "Your " & Trim(Item(GetPlayerInvItemNum(Target, GetPlayerShieldSlot(Target))).Name) & " blocks the " & Trim(PET(PETNum).Name) & "'s hit!", BrightCyan) End If End If Else ' Player left map or game, set target to 0 MapPET(Y, X).Target = 0 End If End If End If End If ' //////////////////////////////////////////// ' // This is used for regenerating PET's HP // ' //////////////////////////////////////////// ' Check to see if we want to regen some of the PET's hp If MapPET(Y, X).num > 0 Then If TickCount > GivePETHPTimer + 10000 Then If MapPET(Y, X).HP > 0 Then MapPET(Y, X).HP = MapPET(Y, X).HP + GetPETHPRegen(PETnum) ' Check if they have more then they should and if so just set it to max If MapPET(Y, X).HP > GetPETMaxHP(PETnum) Then MapPET(Y, X).HP = GetPETMaxHP(PETnum) End If End If End If End If ' ////////////////////////////////////// ' // This is used for spawning an PET // ' ////////////////////////////////////// ' Check if we are supposed to spawn an PET or not If MapPET(Y, X).num = 0 Then If Map(Y).Pet(X) > 0 Then If TickCount > MapPET(Y, X).SpawnWait + (Pet(Map(Y).Pet(X)).SpawnSecs * 1000) Then Call SpawnPET(X, Y) End If End If End If Next X End If Next Y ' Make sure we reset the timer for PET hp regeneration If GetTickCount > GivePETHPTimer + 10000 Then GivePETHPTimer = GetTickCount End If ' Make sure we reset the timer for door closing If GetTickCount > KeyTimer + 15000 Then KeyTimer = GetTickCount End If ```
  5. Actually we are on both. You need to add thing to the client and server, almost all of them. I have both opened, so that i edit client and server.
  6. Didn't you already posted that? I think if you did than i added that already. Edit: yes i got it, please fix frmServer.tmrPet.Enabled = True because i do not know how.
  7. Well then, let's just keep working. okay? EDIT: In modtypes, search for 'Vitals, and replace it with this: ``` ' Vitals HP As Long MP As Long SP As Long PETHP As Long ```
  8. Okay we are kinda working together so help out, tnx.
  9. 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 ```
  10. 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 ```
  11. Found lots of errors, fixed almost all of them.
  12. 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.
  13. hideequipitem(index), i don't know but something simular to this.
  14. Yes just added, still there's lots of errors when trying to start up the client, because the client doesn't know what "Pet" is.
  15. Ridrik

    Pets possible in VB

    Just like goku said, it does takes lots of time in source edit which i am trying to do.
  16. No not everything have worked out, still working on it right now.
  17. Ridrik

    Grapple hook

    What is that for anyway? the grapphlebook
  18. Check in your server folder for Stats.ini.
  19. 2\. You can change the level to pvp in data.txt also.
  20. It's hard to do it in source, needs lots of editing and getting it to work.
  21. Try putting it on a scripted item or a spell.
  22. CLIENT SIDE EDIT: ``` ' ::::::::::::::::::::::::: ' :: Npc movement packet :: ' ::::::::::::::::::::::::: If (casestring = "npcmove") Then i = Val(parse(1)) X = Val(parse(2)) y = Val(parse(3)) Dir = Val(parse(4)) n = Val(parse(5)) MapNpc(i).X = X MapNpc(i).y = y MapNpc(i).Dir = Dir MapNpc(i).xOffset = 0 MapNpc(i).yOffset = 0 MapNpc(i).Moving = 1 If n 1 Then Select Case MapNpc(i).Dir Case DIR_UP MapNpc(i).yOffset = PIC_Y * Val(n - 1) Case DIR_DOWN MapNpc(i).yOffset = PIC_Y * -n Case DIR_LEFT MapNpc(i).xOffset = PIC_X * Val(n - 1) Case DIR_RIGHT MapNpc(i).xOffset = PIC_X * -n End Select Else Select Case MapNpc(i).Dir Case DIR_UP MapNpc(i).yOffset = PIC_Y Case DIR_DOWN MapNpc(i).yOffset = PIC_Y * -1 Case DIR_LEFT MapNpc(i).xOffset = PIC_X Case DIR_RIGHT MapNpc(i).xOffset = PIC_X * -1 End Select End If Exit Sub End If ``` This is in client side, need to make a new one just like this, but for pet. EDIT: Ugh there's so much to do. Well imma start in a few hours, at the end of the day i'll post a READY client side, if i actually finish. but lots of work needs to be done. ALOT. It's easy but alot :(
  23. Mcnugget do you read posts or just simply post? i already posted a source for the pet level up and it's Petstats.ini EDIT: Also there's lots of client side changes, like i'm working on a complete window for pet creation just like npc creation.
  24. okay, well anyways good luck and see you tomorrow. don't forget to post what you have or pm
  25. Lol okay but i know admiral has better chances, so go ahead edit mine, i think mine works though. it should follow the owner, and walk freely if it
×
×
  • Create New...