Scripting Resources & Utilities > Stealth scripts

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

(1/5) > >>

unisharp:
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: ---# entrance 79, 97, 326, 344 - bloodyroom 104, 115, 640, 660
--- End code ---
These are 2 different zone examples, the "bloody room" is like 3rd floor. 

There are 2 coordinate checks:

Line 101 DancerDojo.py

--- Code: ---            if 79 <= GetX(_monsters[0]) <= 97 and\
                    326 <= GetY(_monsters[0]) <= 344:
--- End code ---
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: ---                    if 79 <= GetX(_corpse) <= 97 and\
                            326 <= GetY(_corpse) <= 344:
--- End code ---
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: ---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
--- End code ---

Those ClilocID's - 1112857, 11152714, 1049643 represent splintering, antique, cursed - respectively.

You can pull codes from here: https://github.com/unisharpUO/XScript/blob/6e885f0bb4b763d599b10ed0ca71e9b3e3da8aa1/XScript/Core/Attributes/WeaponAttributes.cs and here https://github.com/unisharpUO/XScript/blob/6e885f0bb4b763d599b10ed0ca71e9b3e3da8aa1/XScript/Core/Extensions/Extensions.cs and here https://github.com/unisharpUO/XScript/blob/6e885f0bb4b763d599b10ed0ca71e9b3e3da8aa1/XScript/Core/Attributes/MagicalAttributes.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: ---        if GetHP(Self()) <= 90 and not Confidence:
            Cast('Confidence')
--- End code ---

Line 28 DancerDojo.py

--- Code: ---def OnClilocSpeech(_param1, _param2, _param3, _message):
    global Confidence
    if 'exude' in _message:
        Confidence = True
    elif 'wanes' in _message:
        Confidence = False
    return
--- End code ---

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.

daymorn:
This is great. I've been hoping for a current, python based script and this has tons of different examples that could be used for different use cases in it. Thank you.

unisharp:

unisharp:
commit pushed 10/13 - updated monster search

dawids212:
is possible to add section for loot jewelery with ssi or other atributes?

Navigation

[0] Message Index

[#] Next page

Go to full version