Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
09-17-2021, 04:34 PM
(This post was last modified: 09-17-2021, 11:57 PM by Arkilys.)
Shoot runes on creature (directly) according creature's health
local MIN_HEALTH = 80 -- Min. health pc to shoot runes. Only shoot runes if your characters hp% is higher than this value.
local Monsters = {
{ Name = 'Demon', HpMin = 0, HpMax = 100, Rune = 'heavy magic missile rune' }, -- Monster name, Hp min and max to shoot runes and which rune.
{ Name = 'Orc', HpMin = 20, HpMax = 100, Rune = 'heavy magic missile rune' }, -- On this case, it will only shoot runes when orc has hp% between 20 and 100%.
}
local attacked_creature = attacked()
if attacked_creature.id > 0 and hppc() >= MIN_HEALTH and cancast() then
for _, monster in ipairs(Monsters) do
if monster.Name:lower() == attacked_creature.name:lower() and attacked_creature.hppc >= monster.HpMin and attacked_creature.hppc <= monster.HpMax then
useitemoncreature(monster.Rune, attacked_creature.id)
wait(1000, 1300)
break
end
end
end
keywords: use rune creature, shoot rune creature, check health and use rune, use rune monster, shoot rune monster
Posts: 37
Threads: 18
Joined: Aug 2021
Reputation:
0
09-17-2021, 11:14 PM
(This post was last modified: 09-17-2021, 11:57 PM by Arkilys.)
return this error "20:13:30 - LUA Script -> HMM: 7: attempt to index global 'target' (a userdata value)"
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Hello.
Try again, i just fixed it.
Posts: 83
Threads: 12
Joined: Jan 2021
Reputation:
0
good night, I play 'dura' server and there the same creature can be normal, or it can come like a boss, I can configure it to shoot rune, only if the monster is stronger like a boss, for example if it takes time to die use it rune if it is an elite monster
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
05-31-2022, 01:47 PM
(This post was last modified: 06-06-2022, 01:33 PM by Arkilys.)
There is no such option, because there is no way to detect that it is a boss, unless there is some change such as speed difference, name, etc.
But it is possible to change the script to shoot runes only after attacking the same creature for some time.
I think this will work.
MinTimeAttacking = minimum time attacking the same creature to shoot runes in milliseconds. 0 = doesn't cares, shoot anyway.
local MIN_HEALTH = 80 -- Min. health pc to shoot runes. Only shoot runes if your characters hp% is higher than this value.
local Monsters = {
{ Name = 'Demon', HpMin = 0, HpMax = 100, Rune = 'heavy magic missile rune', MinTimeAttacking = 0 }, -- Monster name, Hp min and max to shoot runes and which rune.
{ Name = 'Orc', HpMin = 20, HpMax = 100, Rune = 'heavy magic missile rune', MinTimeAttacking = 6000 }, -- On this case, it will only shoot runes when orc has hp% between 20 and 100% and if you are already attacking that specific creature for at least 6000 ms (6 seconds).
{ Name = 'Rotworm', HpMin = 20, HpMax = 100, Rune = 'heavy magic missile rune', MinTimeAttacking = 0 }, -- On this case, it will only shoot runes when orc has hp% between 80 and 100%.
}
local attacked_creature = attacked()
if attacked_creature.id > 0 and (LAST_ATTACKED == nil or LAST_ATTACKED.id ~= attacked_creature.id) then
LAST_ATTACKED = { id = attacked_creature.id, time = runningtimems() }
end
if attacked_creature.id > 0 and hppc() >= MIN_HEALTH and cancast() then
for _, monster in ipairs(Monsters) do
if monster.Name:lower() == attacked_creature.name:lower() and (monster.MinTimeAttacking == 0 or (LAST_ATTACKED ~= nil and ((runningtimems() - LAST_ATTACKED.time) >= monster.MinTimeAttacking))) and attacked_creature.hppc >= monster.HpMin and attacked_creature.hppc <= monster.HpMax then
useitemoncreature(monster.Rune, attacked_creature.id)
wait(1000, 1300)
break
end
end
end
Posts: 83
Threads: 12
Joined: Jan 2021
Reputation:
0
06-03-2022, 03:19 PM
(This post was last modified: 06-03-2022, 03:22 PM by juniorcrms.)
thank you very much I will test
do i have to put the name of each creature?
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
Ofc, that's how the main script works. As you posted here, i just adapted the main script.
Posts: 83
Threads: 12
Joined: Jan 2021
Reputation:
0
thank you again, what is "ofc" ?
Posts: 2,948
Threads: 492
Joined: Jul 2018
Reputation:
84
No problem... ofc = of course xD
Posts: 83
Threads: 12
Joined: Jan 2021
Reputation:
0
it only plays the rune if it configures itself without the time in the case like this MinTimeAttacking = 0
if I put 1000 he doesn't play I wanted to leave it for 12 seconds attacking the same creature then he started playing hmm, in this case 12000
|