XenoBot Forums - Powered by vBulletin

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Need Help with a couple of LUA scripts

  1. #11

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just want to give you a quick background on the purpose: What I am doing is pushing my character out of the 2 square "safe zone" where only 2 mobs can hit you - to simulate someone coming up and moving me around if I was afk. So what happens is the mother will summon 3 slimes, and I will get surrounded and hit down to death.

    The purpose of the script is to switch targets to the mother slime if I'm below 80% to kill it and log me off - to avoid death and the possibility of being messed with by people seeking out botters.

    The script did not kill the mother slime - as soon as I hit 80% health, I got the error and my character just stood there getting hit by all 4 slimes and didn't kill the mother.

    p.s - forgot to metion - I'm going to try your edit in a sec here when the slime respawns
    Last edited by mjbz68; 01-12-2013 at 05:29 PM. Reason: additional info

  2. #12

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by soul4soul View Post
    did it kill the mother when you had less then 80% health? Im not positive what spec meant to do with Pause() I think he meant Stop().
    Code:
    function getMother()
        for i = CREATURES_LOW, CREATURES_HIGH do
            local c = Creature.New(i)
            if c:Name() == "Slime" and c:HealthPercent() <= 75 then
                return c
            end
        end
    end
    
    local mother = getMother()
    local me = Creature.GetByID(Self.ID())
    
    Module.New('slime-trainer', function(module)
        if mother:isAlive() and me:HealthPercent() <= 80 then
            mother:Attack()
            module:Stop()
        end
    end)
    The new one you posted works!!!! This is literally perfect!!!

    I ran one of my other characters over and tested it a few different ways - everytime the mother slime got killed when I dropped below 80% health!!!

    Thank you SOOOO much @soul4soul for getting it perfect - and @Spectrus for all of your help today, you guys are amazing

    now 1 final question.... does the bot have a built in log out feature? or do I need to add a small bit of Lua code at the end of this script to log me out after killing the slime.

  3. #13
    Administrator
    Join Date
    Dec 2010
    Posts
    2,565
    Mentioned
    228 Post(s)
    Tagged
    1 Thread(s)
    No logout feature, you need to wait 15 min for kick .

    @soul4soul I didn't check documentation on Modules. No idea what I'm doing. thanks for the fix.

  4. #14

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did something change with the functions in my script?? Died afk training on my paladin yesterday So I did a little research and found out that when I get to below 80% the character is not switching targets to the mother slime like it should (and once was) - thus the death.

    Any ideas?

  5. #15
    Lifetime Subscriber
    Join Date
    Dec 2011
    Posts
    994
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    that not that i am aware of. remember the mother slime needs to have under 75% hp.

  6. #16

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by soul4soul View Post
    that not that i am aware of. remember the mother slime needs to have under 75% hp.
    Interesting.... I guess I will need to run some more tests - every time I go to pull the slime to my training spot I always hit it down to 10-25% health on the way there, so I am confident that was not the problem in this case.

    I did some quick tests this morning and it didn't work - but I'll mess around with it tonight when I return from work and update everyone on the status.

    Thanks @soul4soul!!!

    Also: this is an odd request.... but I've come across something that may have been the reason I died.... I noticed that when I died - I was out of small stones.... so possibly what happened was I had no stones in my hand and could not kill the mother slime fast enough (even though my fisting skill is 33 from training FOREVER in the past too ) and so I died as a result...

    Therefore - would there be any potential for a script that would: if no small stones (item #1781) in hand - kill mother slime?...... and while I'm at it: if player on screen - kill mother slime?

    These would be monumentally helpful for me to avoid reports/bans/death.

    Furthermore.... I don't want to keep bothering you expert scriptwriters. Is there some sort of a general Lua command guide you can refer me to? I used to make my own scripts pieced together from the Neobot community - but the scripting commands are totally different for Xenobot and I'm lost!

    Thanks in advance for any help/direction!

  7. #17
    Lifetime Subscriber
    Join Date
    Dec 2011
    Posts
    994
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function getMother()
        for i = CREATURES_LOW, CREATURES_HIGH do
            local c = Creature.New(i)
            if c:Name() == "Slime" and c:HealthPercent() <= 75 then
                return c
            end
        end
    end
    
    local mother = getMother()
    local me = Creature.GetByID(Self.ID())
    
    Module.New('slime-trainer', function(module)
        if mother:isAlive() and (me:HealthPercent() <= 80 or Self.ItemCount("small stone") < 1 or not Self.isAreaPvPSafe(8, false, true)) then
            mother:Attack()
            module:Stop()
        end
    end)
    I havent test isAreaPvPSafe Im not 100% sure I used it correctly. Its suppose to detect players on the screen.
    you might been to change "small stone" to the itemid. Im not sure if it will pick it up I believe tibia has more then 1 item called "small stone"
    look in C:\Program Files (x86)\XenoBot\Data\XenoLuaLib.lua for scripting functions(or what your calling commands).

  8. #18

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @soul4soul - once again you've outdone yourself. This script works PERFECTLY The play on screen function you added works beautifully!

    Also, as an aside... my death was caused by something completely non-script related. Let me explain so some other poor sap doesn't die to something this silly....I wasn't aware that after the function completed and the mother slime was killed - it will not do it again without killing the script and re-executing it.... Extremely dumb, I know - but at least I realized it before I learned that hard lesson twice!

    Anyhow, thanks so much for the script help ONCE again! This one is fabulous - and to all you readers out there, USE THIS!!! Modify it to your toon and have fun training for hours on end without the possibility of death! I just went 23hr full on my knight (96/95, SAME SLIME! Paladin (96/85) is limited to 6 because of capacity... small stones are heavy!

    Have fun, kids!

  9. #19
    Lifetime Subscriber
    Join Date
    Dec 2011
    Posts
    994
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    your welcome =]. thank Spectrus for starting off the script too I would of been preoccupied with other scripts.

  10. #20

    Join Date
    Dec 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Ohh of course! @Spectrus - you were also critical in this script creation/initial thought, and have also outdone yourself!

    Thank you both Hopefully other readers enjoy this one too in combination with CrazySwe's slime training script/settings!

    Attached are both files with 100% props/credit to a combination of @CrazySwe @Spectrus and @soul4soul -- Thanks guys and enjoy

    Paladin Slime Trainer (FINAL).xbst
    Paladin Mother-Killer.lua

    Don't forget to edit the settings & script for your character's stats! Alarms/auto logoff are enabled by default for ultimate protection.
    Last edited by mjbz68; 01-20-2013 at 03:01 AM.

Posting Permissions

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