PDA

View Full Version : [REQUEST] If ghost on screen change weapon (for ek)



Storm70
12-01-2015, 06:01 AM
As topic says I'm really in the need of a weapon changer lua. I had it before I deleted xenobot to download binary and didn't save script in notepad, wondering if someone still has a script to share with me, or has free time to make one and share!
If ghost on screen change current weapon (mystic blade, ID=7384), to weapon in 1st backpack which is (fire sword, ID=3281), and if no ghost on screen re-equip mystic blade. I already have spent some time trying to create it but I don't think I'm making any progress.

Storm70
12-04-2015, 08:45 AM
bump
>short<

shadowart
12-04-2015, 11:10 AM
This will switch to a Fire Sword if you're targeting a Ghost and then switch back again whenever you're not targeting a Ghost.


local specialMonsters = {"Ghost"}
local defaultWeapon = "Mystic Blade"
local specialWeapon = "Fire Sword"

-----------------------------------------------
-----------------------------------------------
-----------------------------------------------

defaultWeapon = Item.GetID(defaultWeapon)
specialWeapon = Item.GetID(specialWeapon)

Module("Weapon changer", function(self)
local c = Creature(Self.TargetID())
local useSpecial = c and table.find(specialMonsters, c:Name())
if useSpecial and Self.Weapon().id ~= specialWeapon then
Self.Equip(specialWeapon, "weapon")
self:Delay(5000)
elseif not useSpecial and Self.Weapon().id ~= defaultWeapon then
Self.Equip(defaultWeapon, "weapon")
self:Delay(5000)
end
end)

Storm70
12-06-2015, 05:21 AM
This will switch to a Fire Sword if you're targeting a Ghost and then switch back again whenever you're not targeting a Ghost.


local specialMonsters = {"Ghost"}
local defaultWeapon = "Mystic Blade"
local specialWeapon = "Fire Sword"

-----------------------------------------------
-----------------------------------------------
-----------------------------------------------

defaultWeapon = Item.GetID(defaultWeapon)
specialWeapon = Item.GetID(specialWeapon)

Module("Weapon changer", function(self)
local c = Creature(Self.TargetID())
local useSpecial = c and table.find(specialMonsters, c:Name())
if useSpecial and Self.Weapon().id ~= specialWeapon then
Self.Equip(specialWeapon, "weapon")
elseif not useSpecial and Self.Weapon().id ~= defaultWeapon then
Self.Equip(defaultWeapon, "weapon")
end
self:Delay(1000)
end)

Download link in-case you get the copy problem again:
https://www.dropbox.com/s/6wxz2m05673dguk/GhostWeaponSwitcher.lua?dl=1

Thank you mate.
Cheers, appreciate the download link! Sorry late reply!

jollebollen
12-07-2015, 12:47 AM
This will switch to a Fire Sword if you're targeting a Ghost and then switch back again whenever you're not targeting a Ghost.


local specialMonsters = {"Ghost"}
local defaultWeapon = "Mystic Blade"
local specialWeapon = "Fire Sword"

-----------------------------------------------
-----------------------------------------------
-----------------------------------------------

defaultWeapon = Item.GetID(defaultWeapon)
specialWeapon = Item.GetID(specialWeapon)

Module("Weapon changer", function(self)
local c = Creature(Self.TargetID())
local useSpecial = c and table.find(specialMonsters, c:Name())
if useSpecial and Self.Weapon().id ~= specialWeapon then
Self.Equip(specialWeapon, "weapon")
elseif not useSpecial and Self.Weapon().id ~= defaultWeapon then
Self.Equip(defaultWeapon, "weapon")
end
self:Delay(1000)
end)

Download link in-case you get the copy problem again:
https://www.dropbox.com/s/6wxz2m05673dguk/GhostWeaponSwitcher.lua?dl=1


My bot died because of the script hehe :) The bot when he gets stuck by ghost, he stop and start attack all the time so he dont have time to kill the monster becasue he spam change weapon = death after a while :)

shadowart
12-07-2015, 01:17 AM
My bot died because of the script hehe :) The bot when he gets stuck by ghost, he stop and start attack all the time so he dont have time to kill the monster becasue he spam change weapon = death after a while :)
Runs fine on my end. You have some issue on your end. The onyl time it will switch is if you stop targeting the ghost, and unless you have wierd as fuck settings it will only stop attacking the ghost if it dies (or moves out of the way for some reason - but then you don't need to kill it anyways).

jollebollen
12-07-2015, 01:31 AM
Runs fine on my end. You have some issue on your end. The onyl time it will switch is if you stop targeting the ghost, and unless you have wierd as fuck settings it will only stop attacking the ghost if it dies (or moves out of the way for some reason - but then you don't need to kill it anyways).

No I have just attack if stuck. The bot sets alarm walker stuck walker stuck, and he is surrounded by 8 ghosts. So he attack and stop attack the ghost all the time so he doesn't have time to take up the fire sword. Btw is it possible to add more than one monster to the script?

shadowart
12-07-2015, 01:32 AM
Why teh fuck would he stop attacking a ghost? That's not how if-stuck targeting works. Is something summoning new ghosts? And yeah, just add another name to the specialMonsters list.

jollebollen
12-07-2015, 01:37 AM
Why teh fuck would he stop attacking a ghost? That's not how if-stuck targeting works. Is something summoning new ghosts? And yeah, just add another name to the specialMonsters list.

No he is hunting in drefia. He stop and start attack only when he is in a full trap. What exactly do you mean? Where do I put it in the lua script and how, with puncuation etc

jollebollen
12-07-2015, 01:43 AM
I noticed the attack and unattack only happends if you are in a full trap and cant move a single SQM at any direction. If something is just blocking your path it's no problem :P

shadowart
12-07-2015, 02:32 PM
I changed the delays so that it always waits at least 5 seconds after equipping a weapon before performing the next check. That should work around your issues, even though it sounds like the core problem is the bot's if-stuck behaviour (I haven't verified whether what you say is true though).