- Joined
- Sep 7, 2015
- Messages
- 2,684
- Solutions
- 127
- Reaction score
- 2,129
Hello, I have 3 spell requests as you did a good job with the Summon Explosion Spell.
Bounce
Description: Bounce between targets
Features/Settings:
Max distance between targets,
damage on hit,
delay between each bounce,
animation,
Pull
Description: Pull everyone in a 5SQM area towards you.
Code:
-- Bounce spell script made by Nekiro#5727
-- little messy, but im a noob :((
local bounces = 5 -- number of bounces if targets are in distance
local maxRadius = 5 -- if 5 then radius is 5x5
local onlyPlayers = false
local delay = 2 -- seconds
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
function onGetFormulaValues(player, skill, attack, factor)
local min = (player:getLevel() / 2) + 30 -- completely random
local max = (player:getLevel() / 5) + 100
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local currentBounce, caster, lastBounceTarget = 1
local function checkBounces(currentTargetUid)
if not caster then
return true
end
local currTarget = Creature(currentTargetUid)
if not currTarget then
return true
end
local creatures = Game.getSpectators(currTarget:getPosition(), false, onlyPlayers, maxRadius, maxRadius, maxRadius, maxRadius)
if #creatures == 0 then
return true
end
local randomTarget
repeat
randomTarget = creatures[math.random(#creatures)]
until randomTarget and randomTarget:isMonster() and randomTarget ~= currTarget and randomTarget ~= lastBounceTarget
currTarget:getPosition():sendDistanceEffect(randomTarget:getPosition(), CONST_ANI_FIRE)
combat:execute(caster, Variant(randomTarget.uid))
lastBounceTarget = randomTarget
currentBounce = currentBounce + 1
if currentBounce >= bounces then
return true
end
if lastBounceTarget then
addEvent(checkBounces, delay * 1000, lastBounceTarget.uid)
end
return true
end
function onCastSpell(creature, variant)
addEvent(checkBounces, delay * 1000, variant:getNumber())
caster = creature
creature:getPosition():sendDistanceEffect(Creature(variant:getNumber()):getPosition(), CONST_ANI_FIRE)
return combat:execute(creature, variant)
end
Code:
-- Pull spell script made by Nekiro#5727
-- unfortunately it has to be done with Game.getSpectators(), there is no "getTargetList() for players :("
local radius = 5 -- 5x5
local onlyPlayers = false
function onCastSpell(creature, variant)
local targets = Game.getSpectators(creature:getPosition(), false, onlyPlayers, radius, radius, radius, radius)
if #targets == 0 then
return true
end
for _, target in pairs(targets) do
if target ~= creature then
target:teleportTo(target:getClosestFreePosition(creature:getPosition()))
end
end
return true
end
These two scripts seem interesting to me, so there you are. If anyone have any advice on how to improve this code, feel free to tell me!
do you make any scripts for websites? i want top bank balance and frags (daily and monthly for frags) in highscroes i use myaac.
Also need
!bless (got one script that dosent work for me)
!spells (use spellbook)
!commands (show all avaible commands for youre acces)
You can find every of them on forums. Also third is not possible, until you make config with all commands with corresponding access or you can parse shits from talkactions.xml, but thats stupid.