Posts: 1
Threads: 1
Joined: Aug 2021
Reputation:
0
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
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
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
Posts: 13
Threads: 4
Joined: Oct 2023
Reputation:
0
09-30-2024, 01:28 PM
(This post was last modified: 09-30-2024, 01:35 PM by mufacx.)
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.
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
|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
Posts: 13
Threads: 4
Joined: Oct 2023
Reputation:
0
Posts: 58
Threads: 28
Joined: Nov 2021
Reputation:
0
@ 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.
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
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
Posts: 58
Threads: 28
Joined: Nov 2021
Reputation:
0
|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" />
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
|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
|