xstojakes
03-26-2016, 16:43
Hello i maked a simple, little bit bugged Keep Distance function in VB6 code. Char goin ~3 sqms before target.
ModCavebot after
Public setFollowTarget() As Boolean
put this:
Public setDistance() As Boolean
after
Case "setnofollow"
setFollowTarget(Sid) = False
'exeLine(Sid) = exeLine(Sid) + 1
updateExeLine Sid, 1, True
fastM = True
put this:
Case "setdistance"
setDistance(Sid) = True
'exeLine(Sid) = exeLine(Sid) + 1
updateExeLine Sid, 1, True
fastM = True
ModCavebot after End if:
If bestMelee = True Then
aRes = MeleeAttack(idConnection, bestID)
End If
If setFollowTarget(idConnection) = True Then
PerformMove idConnection, myX(idConnection) + bestX, myY(idConnection) + bestY, myZ(idConnection)
End If
paste this:
If setDistance(idConnection) = True Then
If myX(idConnection) < bestX & myY(idConnection) < bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX - 4, myY(idConnection) + bestY - 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) > bestX & myY(idConnection) > bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) > bestX & myY(idConnection) < bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY - 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) < bestX & myY(idConnection) > bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX - 4, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) <> bestX & myY(idConnection) = bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) = bestX & myY(idConnection) <> bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY, myZ(idConnection)
End Select
End If
End If
frmMain after
setFollowTarget(i) = False
paste this:
setDistance(i) = True
after:
setFollowTarget(index) = False
paste this
setDistance(index) = True
after
ReDim setFollowTarget(1 To MAXCLIENTS)
paste it
ReDim setDistance(1 To MAXCLIENTS)
frmCavebot after
setFollowTarget(idConnection) = True
put this:
setDistance(idConnection) = False
Now when you type line SetDistance in cavebot your character will be run from target.
ModCavebot after
Public setFollowTarget() As Boolean
put this:
Public setDistance() As Boolean
after
Case "setnofollow"
setFollowTarget(Sid) = False
'exeLine(Sid) = exeLine(Sid) + 1
updateExeLine Sid, 1, True
fastM = True
put this:
Case "setdistance"
setDistance(Sid) = True
'exeLine(Sid) = exeLine(Sid) + 1
updateExeLine Sid, 1, True
fastM = True
ModCavebot after End if:
If bestMelee = True Then
aRes = MeleeAttack(idConnection, bestID)
End If
If setFollowTarget(idConnection) = True Then
PerformMove idConnection, myX(idConnection) + bestX, myY(idConnection) + bestY, myZ(idConnection)
End If
paste this:
If setDistance(idConnection) = True Then
If myX(idConnection) < bestX & myY(idConnection) < bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX - 4, myY(idConnection) + bestY - 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) > bestX & myY(idConnection) > bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) > bestX & myY(idConnection) < bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY - 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) < bestX & myY(idConnection) > bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX - 4, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) <> bestX & myY(idConnection) = bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX, myY(idConnection) + bestY + 4, myZ(idConnection)
End Select
ElseIf myX(idConnection) = bestX & myY(idConnection) <> bestY Then
Select Case CInt(Int((1 * Rnd()) + 1))
Case 1
PerformMove idConnection, myX(idConnection) + bestX + 4, myY(idConnection) + bestY, myZ(idConnection)
End Select
End If
End If
frmMain after
setFollowTarget(i) = False
paste this:
setDistance(i) = True
after:
setFollowTarget(index) = False
paste this
setDistance(index) = True
after
ReDim setFollowTarget(1 To MAXCLIENTS)
paste it
ReDim setDistance(1 To MAXCLIENTS)
frmCavebot after
setFollowTarget(idConnection) = True
put this:
setDistance(idConnection) = False
Now when you type line SetDistance in cavebot your character will be run from target.