PDA

View Full Version : how to add monster count to this script?



jollebollen
12-22-2015, 01:44 AM
Hi! I've got this script which is very useful, just wondering if it's possible to add ammount of monsters to trigger spell! :)


local Spells = {
{words = 'exori flam', hppc = 0, range = 3, mana = 20, list = {'necromancer', 'priestess', 'vampire', 'mummy', 'gravedigger', 'blood hand', 'stalker', 'shadow pupil', 'skeleton warrior', 'skeleton', 'skeleton warrior', 'pirate skeleton', 'pirate ghost', 'tarnished spirit', 'ghost', 'zombie', 'lich', 'death blob', 'vampire bride', 'vampire viscount', 'banshee'}
}

local PvPRadiusSafety = 3

function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end

BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end)

jollebollen
12-22-2015, 10:21 AM
where is everyone -.- 5 views during the night i had all these scripts before i know it is possible...

brindeds
12-22-2015, 10:33 AM
where is everyone -.- 5 views during the night i had all these scripts before i know it is possible...

Nobody is forced to answer you, and people do not always know the answer to your question.
I have a similar solution, but I'm not at home to publish it. When I get the afternoon (Brazil) I reply.

jollebollen
12-22-2015, 10:39 AM
Nobody is forced to answer you, and people do not always know the answer to your question.
I have a similar solution, but I'm not at home to publish it. When I get the afternoon (Brazil) I reply.

Hi, yeah I know bro but I think many people have this on the computer since everybody used these before when dove mode didn't exist on normal pvp servers.. I had all of these scripts I would share with anyone who needed them immediatly but I have nothing left on my computer :/ I'm helping others in everyway I can!

HjugO
12-22-2015, 11:38 AM
Hi! I've got this script which is very useful, just wondering if it's possible to add ammount of monsters to trigger spell! :)


local Spells = {
{words = 'exori flam', hppc = 0, range = 3, mana = 20, list = {'necromancer', 'priestess', 'vampire', 'mummy', 'gravedigger', 'blood hand', 'stalker', 'shadow pupil', 'skeleton warrior', 'skeleton', 'skeleton warrior', 'pirate skeleton', 'pirate ghost', 'tarnished spirit', 'ghost', 'zombie', 'lich', 'death blob', 'vampire bride', 'vampire viscount', 'banshee'}
}

local PvPRadiusSafety = 3

function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end

BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end)

Use shooter builded in targeting.

jollebollen
12-22-2015, 01:53 PM
Use shooter builded in targeting.

helloo sir,

the shooter built in xenobot is not safe for retro pvp servers :) it's very easy to make someone rs who is using the "pvp safe" in xenobot.


thanks!

grave18
12-22-2015, 02:24 PM
lower

jollebollen
12-22-2015, 10:30 PM
I do not play retro to check it out and do not have pacc.


local Spells = {
{words = 'exori flam', hppc = 0, range = 3, mana = 20, count = 5, list = {'necromancer', 'priestess', 'vampire', 'mummy', 'gravedigger', 'blood hand', 'stalker', 'shadow pupil', 'skeleton warrior', 'skeleton', 'skeleton warrior', 'pirate skeleton', 'pirate ghost', 'tarnished spirit', 'ghost', 'zombie', 'lich', 'death blob', 'vampire bride', 'vampire viscount', 'banshee'}
}
}

local PvPRadiusSafety = 3
local MonsterRange = 8

function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end

Module.New("Count", function()
local mob = Self.GetTargets(MonsterRange)
local mobCount = 0
for i = 1, #mob do
if table.contains(Spells[i].list, mob[i]:Name()) then
mobCount = mobCount + 1
end
end
end)

BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc and Spells[i].count >= mobCount then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range and Spells[i].count >= mobCount then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end)


THANK YOU SO F*CKING MUCH!!!!!!!!!!!!!!!!!!!!!!!!! i haven't tested it yet but you made me so happy u dont believe it.. merry christmas i love you :D

jollebollen
12-22-2015, 10:36 PM
it gave me this error :D haha



23:35 XenoScript Error:
Script: safe strike test.lua
Line #: 36
Chunk: ...?Users?xx?DOCUME?1?XenoBot?Scripts??SAFEST?2.LU A
Error: attempt to compare nil with number
This is an error with user-input and should not be reported as a bug with XenoBot.

jollebollen
12-28-2015, 06:50 PM
help pls <3

grave18
12-28-2015, 11:36 PM
Fixed and tested.

local Spells = {
{words = 'exori flam', hppc = 0, range = 3, mana = 20, count = 3, list = {'rat', 'cave rat', 'bat', 'corym charlatan'}
}
}

local PvPRadiusSafety = 3
local MonsterRange = 8

function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end

function MonstersAround(list, radius)
local k = 0
for name, creature in Creature.iMonsters({distancefromself = {lt, radius}}) do
if (list ~= nil) then
if table.contains(list, name:lower()) then
k = k + 1
end
else
k = k + 1
end
end
return k
end

BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if MonstersAround(Spells[i].list, MonsterRange) >= Spells[i].count then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end
end)

jollebollen
01-22-2016, 01:55 AM
Fixed and tested.

local Spells = {
{words = 'exori flam', hppc = 0, range = 3, mana = 20, count = 3, list = {'rat', 'cave rat', 'bat', 'corym charlatan'}
}
}

local PvPRadiusSafety = 3
local MonsterRange = 8

function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end

function MonstersAround(list, radius)
local k = 0
for name, creature in Creature.iMonsters({distancefromself = {lt, radius}}) do
if (list ~= nil) then
if table.contains(list, name:lower()) then
k = k + 1
end
else
k = k + 1
end
end
return k
end

BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if MonstersAround(Spells[i].list, MonsterRange) >= Spells[i].count then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end
end)

I will try it, thank you so much for your help you don't understand how much I appreciate it :)!!!

jollebollen
01-22-2016, 02:01 AM
it worked now thank you SOOOOOOOOOOOOO much from bottom of my heart =)

Elvang
01-22-2016, 08:10 AM
it worked now thank you SOOOOOOOOOOOOO much from bottom of my heart =)

Xenobot has been updated to prevent skulling with strike spells.

jollebollen
01-23-2016, 02:33 AM
Xenobot has been updated to prevent skulling with strike spells.

yeah i know, but try it yourself, sd a monster and side step infront of someone and they will hit you, you have to time it really good..