Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change weapon
#1
Hi,

Is there any script available that will switch weapon on certain monster?

For example switch between War Hammer and Bow if x monster appears and then switch back to War Hammer when x monster isnt there.

Thanks,

Spons
Reply

#2
Hello.


local MELEE_WEAPON = 'war hammer' -- IT MUST BE ON LEFT HAND (<<<)
local DISTANCE_WEAPON = 'bow' -- IT MUST BE ON LEFT HAND (<<<)
local BACKPACK_WEAPONS = 'red backpack' -- Backpack that will save the weapon.

local Monsters = { 'Demon', 'Dragon Lord' } -- Monsters to equip distance weapon.
local MonstersCount = 1 -- If monsters count equal or higher than this then equip distance weapon.



local MELEE_WEAPON_ID = itemid(MELEE_WEAPON) -- DONT CHANGE THIS LINE
local DISTANCE_WEAPON_ID = itemid(DISTANCE_WEAPON) -- DONT CHANGE THIS LINE


if maround(table.unpack(Monsters)) >= MonstersCount then
    local left_hand = lhand()
    if left_hand.id == 0 and itemcount(DISTANCE_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(DISTANCE_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    elseif left_hand.id ~= DISTANCE_WEAPON_ID and itemcount(DISTANCE_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(left_hand.id, BACKPACK_WEAPONS, 'lhand')
        wait(800, 1200)
        moveitems(DISTANCE_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    end
else
    local left_hand = lhand()
    if left_hand.id == 0 and itemcount(MELEE_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(MELEE_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    elseif left_hand.id ~= MELEE_WEAPON_ID  and itemcount(MELEE_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(left_hand.id, BACKPACK_WEAPONS, 'lhand')
        wait(800, 1200)
        moveitems(MELEE_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    end
end
Reply

#3
Could you change this script to make it switch weapon from X to Y if there is a player on the screen and change it back when the player leaves?
I tried changing line 14 to 'if paround() > 0' but it obviously doesnt work.
Reply

#4
|Only Registered members can see download links. | Click here to buy subscription or here to register.

local MELEE_WEAPON = 'war hammer' -- IT MUST BE ON LEFT HAND (<<<)
local STRONG_WEAPON = 'dragon hammer' -- IT MUST BE ON LEFT HAND (<<<)
local BACKPACK_WEAPONS = 'red backpack' -- Backpack that will save the weapon.


local MELEE_WEAPON_ID = itemid(MELEE_WEAPON) -- DONT CHANGE THIS LINE
local STRONG_WEAPON_ID = itemid(STRONG_WEAPON) -- DONT CHANGE THIS LINE

local left_hand = lhand()
if paround() > 0 then
    if left_hand.id ~= STRONG_WEAPON_ID and itemcount(STRONG_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(left_hand.id, BACKPACK_WEAPONS, 'lhand')
        wait(800, 1200)
        moveitems(STRONG_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    end
else
    if left_hand.id ~= MELEE_WEAPON_ID  and itemcount(MELEE_WEAPON_ID, BACKPACK_WEAPONS) > 0 then
        moveitems(left_hand.id, BACKPACK_WEAPONS, 'lhand')
        wait(800, 1200)
        moveitems(MELEE_WEAPON_ID, 'lhand', BACKPACK_WEAPONS)
        wait(500, 800)
    end
end
Reply

#5
Thank you once again!
Reply

#6
@Arkilys

I don;'t want to create new thread. But i aloso need simple weapon changer as "action", without any monsteres etc...

1 action : take off ratana, equip wand of inferno
2 action: take off wand of inferno, equip ratana


Thx in advance.
Reply

#7
Hello.

Replace RATANA_ID with the ratana's id.
Replace WOI_ID with the wand of inferno's id.


1st action
if lhand().id == RATANA_ID then
    moveitems(RATANA_ID, 0, 'lhand')
    wait(300,500)
end
if lhand().id == 0 then
    moveitems(WOI_ID, 'lhand')
    wait(300,500)
end


2nd action
if lhand().id == WOI_ID then
    moveitems(WOI_ID, 0, 'lhand')
    wait(300,500)
end
if lhand().id == 0 then
    moveitems(RATANA_ID, 'lhand')
    wait(300,500)
end
Reply

#8
|Only Registered members can see download links. | Click here to buy subscription or here to register.
Great!
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Wink" title="Wink" class="smilie smilie_2" />

@Arkilys


Can i ask you for one more version?

If Monster a,b,c on screen then equip wand of inferno
if monster x,y,z on screen then equip ratana?
Thx in advance
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Wink" title="Wink" class="smilie smilie_2" />
Reply

#9
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Weapon can be weapon name or id. I always recommend using ID, because not all weapons are "mapped" in bots database.
-- WEAPONS MUST BE ON LEFT HAND (<<<)
local BACKPACK_WEAPONS = 'red backpack'
local WEAPONS_CONFIG = {
    { Weapon = 'ratana', Monsters = { 'Monster A', 'Monster B', 'Monster C' } },
    { Weapon = 'wand of inferno', Monsters = { 'Monster X', 'Monster Y', 'Monster Z' } },
}

for _, config in ipairs(WEAPONS_CONFIG) do
    if maround(table.unpack(config.Monsters)) > 0 then
        local leftHand = lhand()
        local weaponId = itemid(config.Weapon)
        if weaponId > 0 and leftHand.id ~= weaponId then
            moveitems(weaponId, 'lhand', BACKPACK_WEAPONS)
            wait(800, 1200)
            break
        end
    end
end
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016