[py] PVE Bot with Zone Restrictions (Fan Dancer example)

Only working scripts
Post Reply
sibble
Neophyte
Neophyte
Posts: 48
Joined: 21.03.2015 18:12

[py] PVE Bot with Zone Restrictions (Fan Dancer example)

Post by sibble »

SOURCE:
Located under repo https://github.com/unisharpUO/StealthUO-Scripts
DancerDojo.py
helpers.py
py_stealth

DancerDojo Example:
This script will sit within given coordinates, use Honor virtue and kill Fan Dancers, alert when a player is near, use confidence when needed, use primary ability when plenty of mana is available, loot corpses for +20 splintering non-cursed non-antique weapons. It also insures the item.

Line 14 DancerDojo.py (commented)

Code: Select all

# entrance 79, 97, 326, 344 - bloodyroom 104, 115, 640, 660
These are 2 different zone examples, the "bloody room" is like 3rd floor.

There are 2 coordinate checks:

Line 101 DancerDojo.py

Code: Select all

            if 79 <= GetX(_monsters[0]) <= 97 and\
                    326 <= GetY(_monsters[0]) <= 344:
This part tells the bot to only set targets to monsters within this range. If an already set target roams without this range, the bot will continue to follow it and kill it.

Line 128 DancerDojo.py

Code: Select all

                    if 79 <= GetX(_corpse) <= 97 and\
                            326 <= GetY(_corpse) <= 344:
Unfortunatley if something roams out of the box and dies, it's not looted. I added this because someone was farming in a room near me and the bot would run over to him periodically and try and loot his corpses. This ensures that only corpses looted are those within the zone.

LOOTING:
This is rather easy to change.

Code: Select all

def LootCorpse(_corpse):
    UseObject(_corpse)
    Wait(1500)
    _lootList = NewFind([0xFFFF], [0xFFFF], [_corpse], True)
    for _loot in _lootList:
        _tooltipRec = GetTooltipRec(_loot)
        if GetParam(_tooltipRec, 1112857) >= 20 and not\
                ClilocIDExists(_tooltipRec, 1152714) and not\
                ClilocIDExists(_tooltipRec, 1049643):
            AddToSystemJournal(f'Looting Item: {_loot}')
            MoveItem(_loot, 1, LootBag, 0, 0, 0)
            InsureItem(_loot)
    return
Those ClilocID's - 1112857, 11152714, 1049643 represent splintering, antique, cursed - respectively.

You can pull codes from here: https://github.com/unisharpUO/XScript/b ... ributes.cs and here https://github.com/unisharpUO/XScript/b ... ensions.cs and here https://github.com/unisharpUO/XScript/b ... ributes.cs

With this information you should be able to easily create your own loot filters.


HEALING:
The only method I added was for confidence:

Line 115 DancerDojo.py

Code: Select all

        if GetHP(Self()) <= 90 and not Confidence:
            Cast('Confidence')
Line 28 DancerDojo.py

Code: Select all

def OnClilocSpeech(_param1, _param2, _param3, _message):
    global Confidence
    if 'exude' in _message:
        Confidence = True
    elif 'wanes' in _message:
        Confidence = False
    return
This checks for when confidence is actually up/down and will use confidence if it's not already up (and below 90 hp)

I'll add more areas upon request.
Post Reply