Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85
Need tips regarding Cavebot/Targeting logic Tibia 7.7~
Results 1 to 5 of 5

Thread: Need tips regarding Cavebot/Targeting logic Tibia 7.7~

  1. #1

    Question Need tips regarding Cavebot/Targeting logic Tibia 7.7~

    Hello friends!
    I'm thinking about making my own bot for client 7.7~ in C# and I've got some questions regarding Cavebot, targeting and how it's done (logically).

    What I've thought so far regarding the cavebot is to run it on an own thread that starts when activating the cavebot.

    Walking:
    Have a list of waypoints with X Y Z and iterate through them.
    So when it's gonna walk to a specific I gotta set gotoX, Y and Z respectively and then set isWalking to true, right?
    Checking if it's arrived or not, should that be checked like this?
    Psuedocode:
    Code:
    bool pauseForTargeting = false //used later for pausing the walker when targeting?
    if !Walking //the client has stopped walking (possible reasons, path blocked/arrived/disconnected/dead or whatever
        if(myX, myY, myZ) != goToX, goToY, goToZ) //check if its not walking and if thats true, retry walking
           retryWalking()
        else if (myX, myY, myZ) == goToX, goToY, goToZ) //check if the the characters position is the same as the goto position (hence it has arrived)
           startWalkNextWaypoint() //Start going towards the next waypoint
    In my head, that logic seems fine and should work alright for walking!

    So to the targeting part. This I'm not that sure on how to do it. First of all, I'm not sure how to attack something by writing memory so I'd like some info about that (please =))
    I guess it's about looping the battlelist and check if the names of targets is in that list, and if they are, write the creatureID somewhere in the client and set Attacking to true somewhere. I've head about isVisible in battlelist, but Im not sure when it sets to visible or not. (maybe when its on screen and is alive? Used for autologout?)
    I'm also not sure how to check if the target creature has died or not.

    The targeting part (modified into the walker code) something like this?
    Code:
    bool pauseForTargeting = false //used later for pausing the walker when targeting?
    if !Walking && !pauseForTargeting //the client is not walking and its not paused for attacking (possible reasons, path blocked/arrived/disconnected/dead or whatever
        if(myX, myY, myZ) != goToX, goToY, goToZ) //if my pos != gotoPos and if thats true, retry walking
           retryWalking()
        else if (myX, myY, myZ) == goToX, goToY, goToZ) //check if the the characters position is the same as the goto position (hence it has arrived)
           startWalkNextWaypoint() //Start going towards the next waypoint
    else //its walking and its not attacking
    if(!isAttacking) //check if the bot is already attacking something
        target = FindTarget() //a method to loop through battlelist and look for a creature to attack, returns creature ID
        StartAttack(target) // attacks the target using creature ID
        isAttacking = true //sets isAttacking bool to true
        pauseForTargeting = true //pauses the walker
    That's what I can come up with regarding Cavebot logic. I wan't to make all this work first before I get to looting.
    What do you guys think? Is the logic good for a simple follow and attack cavebot for Tibia? It's my first time developing a cavebot so im not so sure how it works in Tibia. Any tips is much appreciated!

  2. #2

  3. #3
    Super Moderator klusbert's Avatar
    Join Date
    Dec 2007
    Posts
    1,201
    Walker
    http://pastebin.com/8m7DiLtm

    Attacker
    http://pastebin.com/xsRcWYxV

    Hope you can use of my logic.

    Building a cavebot that syncs with walker looter and attacker is not as easy as it seems. Things can go wrong and couse things to stop working. For example if you start attack a monster and set redsquare to it, but the attackpacket did not go throgh. You will be stuck.

    I am not a big fan of bool values to check the state of cavebot, becouse if you set you looter to islooting = true, and someone move the corpse you will get stuck.

    http://pastebin.com/mDmDzySJ
    I use this. I set the "islooting" to true, it will stay true for only 3 secs. Thats enough time to loot a corpse. If the looter finish faster than 3 secs, it will set the "islooting" to false.
    Btw I recomend you to use pastebin.com. It is so hard reading your code
    Last edited by klusbert; 11-24-2015 at 03:23 PM.
    How to find battlelist address --> http://tpforums.org/forum/thread-8146.html
    Updating addresses --> http://tpforums.org/forum/thread-8625.html
    DataReader --> http://tpforums.org/forum/thread-10387.html

  4. #4
    Ahh I see! Sorry about that!
    Thanks a lot, will take a look again when I got time! Took a sneek peak and it looked good

  5. #5
    Super Moderator klusbert's Avatar
    Join Date
    Dec 2007
    Posts
    1,201
    Great, pm me if you need more help. I am a retired nobody who like to feel important somtime
    How to find battlelist address --> http://tpforums.org/forum/thread-8146.html
    Updating addresses --> http://tpforums.org/forum/thread-8625.html
    DataReader --> http://tpforums.org/forum/thread-10387.html

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •