Agus Admin
Mensajes : 69 Fecha de inscripción : 01/07/2008
| Tema: Ver vida de Npc's Vie Ago 01, 2008 7:53 pm | |
| Código del servidor Ver status de NPCs Bien, a continuación les voy a presentar un código bastante útil. El mismo sirve para que al hacer click sobre la vida de los NPCs podramos saber su estado. Éste código en el servidor oficial de Alkon está implementado, pero de una manera que es necesario tener skill en supervivencia. En mi código (o sea, éste), no hace falta tener skill en supervivencia, y además de eso, tenemos 2 opciones para mostrar la vida: Que al hacer click sobre el NPC nos diga el estado del NPC: intacto, levemente herido, herido, etc... Que al hacer click sobre el NPC nos muestre el estado de la vida así: (Vida / Vida Máxima) Bien, ya tenemos las dos opciones. Entonces... ¡Manos a la obra! Buscamos en el sub LookAtTtile, dentro del modulo GameLogic.bas: - Citación :
-
If FoundChar = 2 Then '¿Encontro un NPC? Dim estatus As String
If UserList(UserIndex).Stats.UserSkills(Supervivencia) >= 0 And UserList(UserIndex).Stats.UserSkills(Supervivencia) <= 10 Then estatus = "(Dudoso) " ElseIf UserList(UserIndex).Stats.UserSkills(Supervivencia) > 10 And UserList(UserIndex).Stats.UserSkills(Supervivencia) <= 20 Then If Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP / 2) Then estatus = "(Herido) " Else estatus = "(Sano) " End If ElseIf UserList(UserIndex).Stats.UserSkills(Supervivencia) > 20 And UserList(UserIndex).Stats.UserSkills(Supervivencia) <= 30 Then If Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.5) Then estatus = "(Malherido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.75) Then estatus = "(Herido) " Else estatus = "(Sano) " End If ElseIf UserList(UserIndex).Stats.UserSkills(Supervivencia) > 30 And UserList(UserIndex).Stats.UserSkills(Supervivencia) <= 40 Then If Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.25) Then estatus = "(Muy malherido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.5) Then estatus = "(Herido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.75) Then estatus = "(Levemente herido) " Else estatus = "(Sano) " End If ElseIf UserList(UserIndex).Stats.UserSkills(Supervivencia) > 40 And UserList(UserIndex).Stats.UserSkills(Supervivencia) < 60 Then If Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.05) Then estatus = "(Agonizando) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.1) Then estatus = "(Casi muerto) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.25) Then estatus = "(Muy Malherido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.5) Then estatus = "(Herido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.75) Then estatus = "(Levemente herido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP) Then estatus = "(Sano) " Else estatus = "(Intacto) " End If ElseIf UserList(UserIndex).Stats.UserSkills(Supervivencia) >= 60 Then estatus = "(" & Npclist(TempCharIndex).Stats.MinHP & "/" & Npclist(TempCharIndex).Stats.MaxHP & ") " Else estatus = "!error!" End If
If UserList(UserIndex).flags.Privilegios = 1 Or UserList(UserIndex).flags.Privilegios = 2 Then estatus = "(" & Npclist(TempCharIndex).Stats.MaxHP & ")" End If
If Len(Npclist(TempCharIndex).Desc) > 1 Then Call SendData(ToIndex, UserIndex, 0, "||" & vbWhite & "°" & Npclist(TempCharIndex).Desc & "°" & Npclist(TempCharIndex).Char.charindex & FONTTYPE_INFO) Else
If Npclist(TempCharIndex).MaestroUser > 0 Then Call SendData(ToIndex, UserIndex, 0, "|| " & estatus & Npclist(TempCharIndex).Name & " es mascota de " & UserList(Npclist(TempCharIndex).MaestroUser).Name & FONTTYPE_INFO) Else Call SendData(ToIndex, UserIndex, 0, "|| " & estatus & Npclist(TempCharIndex).Name & "." & FONTTYPE_INFO) End If
End If FoundSomething = 1 UserList(UserIndex).flags.TargetNpcTipo = Npclist(TempCharIndex).NPCtype UserList(UserIndex).flags.TargetNPC = TempCharIndex UserList(UserIndex).flags.TargetUser = 0 UserList(UserIndex).flags.TargetObj = 0
End If
Si queremos que la vida se vea como la primera forma, reemplazamos TODO ese If...End If por lo siguiente: - Citación :
-
If FoundChar = 2 Then '¿Encontro un NPC? Dim estatus As String
If Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.05) Then estatus = "(Agonizando) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.1) Then estatus = "(Casi muerto) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.25) Then estatus = "(Malherido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.5) Then estatus = "(Herido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP * 0.75) Then estatus = "(Levemente herido) " ElseIf Npclist(TempCharIndex).Stats.MinHP < (Npclist(TempCharIndex).Stats.MaxHP) Then estatus = "(Sano) " Else estatus = "(Intacto) " End If
If UserList(UserIndex).flags.Privilegios = 1 Or UserList(UserIndex).flags.Privilegios = 2 Then estatus = "(" & Npclist(TempCharIndex).Stats.MaxHP & ")" End If
If Len(Npclist(TempCharIndex).Desc) > 1 Then Call SendData(ToIndex, UserIndex, 0, "||" & vbWhite & "°" & Npclist(TempCharIndex).Desc & "°" & Npclist(TempCharIndex).Char.charindex & FONTTYPE_INFO) Else
If Npclist(TempCharIndex).MaestroUser > 0 Then Call SendData(ToIndex, UserIndex, 0, "||" & estatus & Npclist(TempCharIndex).Name & " es mascota de " & UserList(Npclist(TempCharIndex).MaestroUser).Name & FONTTYPE_INFO) Else Call SendData(ToIndex, UserIndex, 0, "||" & estatus & Npclist(TempCharIndex).Name & "." & FONTTYPE_INFO) End If
End If FoundSomething = 1 UserList(UserIndex).flags.TargetNpcTipo = Npclist(TempCharIndex).NPCtype UserList(UserIndex).flags.TargetNPC = TempCharIndex UserList(UserIndex).flags.TargetUser = 0 UserList(UserIndex).flags.TargetObj = 0
End If
En cambio, si queremos que se vea de la segunda forma, reemplazamos todo ese If...End If por lo siguiente: - Citación :
-
If FoundChar = 2 Then '¿Encontro un NPC? Dim estatus As String
estatus = "(" & Npclist(TempCharIndex).Stats.MinHP & "/" & Npclist(TempCharIndex).Stats.MaxHP & ") "
If UserList(UserIndex).flags.Privilegios = 1 Or UserList(UserIndex).flags.Privilegios = 2 Then estatus = "(" & Npclist(TempCharIndex).Stats.MaxHP & ")" End If
If Len(Npclist(TempCharIndex).Desc) > 1 Then Call SendData(ToIndex, UserIndex, 0, "||" & vbWhite & "°" & Npclist(TempCharIndex).Desc & "°" & Npclist(TempCharIndex).Char.charindex & FONTTYPE_INFO) Else
If Npclist(TempCharIndex).MaestroUser > 0 Then Call SendData(ToIndex, UserIndex, 0, "||" & estatus & Npclist(TempCharIndex).Name & " es mascota de " & UserList(Npclist(TempCharIndex).MaestroUser).Name & FONTTYPE_INFO) Else Call SendData(ToIndex, UserIndex, 0, "||" & estatus & Npclist(TempCharIndex).Name & "." & FONTTYPE_INFO) End If
End If FoundSomething = 1 UserList(UserIndex).flags.TargetNpcTipo = Npclist(TempCharIndex).NPCtype UserList(UserIndex).flags.TargetNPC = TempCharIndex UserList(UserIndex).flags.TargetUser = 0 UserList(UserIndex).flags.TargetObj = 0
End If
¡Listo! Cualquiera de las 2 formas funciona correctamente. Cualquier duda / queja / sugerencia o cualquier cosa referida a este thread, posteen abajo. ¡Espero que les haya servido! Amraphen.- | |
|