• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Spell] Request

Dyker

New Member
Joined
Sep 12, 2008
Messages
97
Reaction score
1
People I need some spells, I hope someone could help me :d

First

I need a rune which when a player use it hits with 5 bolts (damage depending the distance of the player), remove 5 bolts from your slot

Second

I need an spell which summons 5 monsters and removes 50 soul

Third

How can I put on this spell:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.1 + levelTotal), -(skillTotal * 3 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

I would like that formula damage depends of the Ml 60% and the skills 40%
 
Last edited:
Not Tested

1) (without the option - "damage is depending on range of player")
Lua:
    -- Create a combat object with params
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE,           COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_USECHARGES,     false)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 34)
    
    -- Create a formula for early created combat object
    function onGetFormulaValues(cid, level, skill, attack, factor)
        local skillTotal, levelTotal = skill + attack, level / 2
        return -(skillTotal * 1.5 + levelTotal + 100), -(skillTotal + levelTotal + 300)
    end
    setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
    
    -- Main Spell
    local shoots = 5 -- configuration shots here
	function onCastSpell(cid, var)
		local ammo = getPlayerSlotItem(cid, CONST_SLOT_AMMO)
		if (ammo.uid and getPlayerItemCount(cid, ammo.itemid) >= shoots) then
			for i = (0, shoots) do
				addEvent(doCombat, 300 * i, cid, combat, var)
			end
			return true
		end
		doPlayerSendCancel(cid, "You must have 5 ammunition, to use that spell.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return false
    end

2)
Lua:
local max = 5
local soul = -50
 
function onCastSpell(cid, var)
	local count, pos = #getCreatureSummons(cid), getThingPos(cid)
	if count == max then
		doPlayerSendCancel(cid, 'You cannot summon more.')
		doSendMagicEffect(pos, 2)
		return false
	end
	if getPlayerSoul(cid) < 50 then
		doPlayerSendCancel(cid, 'First you need to have 50 soul.')
		doSendMagicEffect(pos, 2)
		return false
	end	
 	for i = 1, max - count do
		local v = doSummonMonster(cid, 'Nameofmonster')
		if v ~= 1 then
			doPlayerSendDefaultCancel(cid, v)
			doSendMagicEffect(pos, 7)
			return i ~= 1
		end
		doSendMagicEffect(getThingPos(getCreatureSummons(cid)[count+i]), 7)
		doPlayerAddSoul(cid, soul)
	end
	doSendMagicEffect(pos, 7)
	return true
end
 
Bow's Fury (not tested):
Lua:
function onCastSpell(cid, var)

function sendArrow()
config = {[2544] = {eff = CONST_ME_HITAREA, type = COMBAT_PHYSICALDAMAGE, deff = CONST_ANI_ARROW, bdmg = 2},
[2545] = {eff = CONST_ME_HITBYPOISON, type = COMBAT_EARTHDAMAGE, deff = CONST_ANI_POISONARROW, bdmg = 2.2},
[2546] = {eff = CONST_ME_EXPLOSIONAREA, type = COMBAT_FIREDAMAGE, deff = CONST_ANI_BURSTARROW, bdmg = 2.1},
[7364] = {eff = CONST_ME_HITAREA, type = COMBAT_PHYSICALDAMAGE, deff = CONST_ANI_SNIPERARROW, bdmg = 2.4},
[7365] = {eff = CONST_ME_HITAREA, type = COMBAT_PHYSICALDAMAGE, deff = CONST_ANI_ONYXARROW, bdmg = 2.6},
[7838] = {eff = CONST_ME_ENERGYHIT, type = COMBAT_ENERGYDAMAGE, deff = CONST_ANI_FLASHARROW, bdmg = 2.5},
[7839] = {eff = CONST_ME_ICEAREA, type = COMBAT_ICEDAMAGE, deff = CONST_ANI_SHIVERARROW, bdmg = 2.5},
[7840] = {eff = CONST_ME_FIREAREA, type = COMBAT_FIREDAMAGE, deff = CONST_ANI_FLAMMINGARROW, bdmg = 2.5},
[7850] = {eff = CONST_ME_SMALLPLANTS, type = COMBAT_EARTHDAMAGE, deff = CONST_ANI_EARTHARROW, bdmg = 2.5}
}

fmin, fmax = getPlayerLevel(cid)*0.2, getPlayerLevel(cid)*0.25
if getCreatureTarget(cid) > 0 then
doTargetCombatHealth(getCreatureTarget(cid), cid, config[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid].type, fmin * config[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid].bdmg, fmax * config[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid].bdmg, config[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid].eff)
doSendDistanceShoot(getThingPos(cid), getThingPos(getCreatureTarget(cid)), config[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid].deff)
end
end

arrows = {2544, 2545, 2546, 7364, 7365, 7838, 7839, 7840, 7850}

if not isInArray(getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid, arrows) then
doPlayerSendCancel(cid, "You need to have arrows equiped to use this spell.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end

if getPlayerSlotItem(cid, CONST_SLOT_AMMO).count < 5 then
doPlayerSendCancel(cid, "You need at least five arrows to use this spell.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end

addEvent(sendArrow, 500, cid)
addEvent(sendArrow, 1000, cid)
addEvent(sendArrow, 1500, cid)
addEvent(sendArrow, 2000, cid)
addEvent(sendArrow, 2500, cid)
end
 
What the hell o_O you must type all of IDs to script.
why you dont use ammo.id ?

# Edit
I see.. the only different is the shoottype and magic effect >.>
 
The first works fine So very TY xD but the secondone appears that on console when I make /reload spells

Code:
[20/09/2011 22:10:04] [Error - LuaScriptInterface::loadFile] data/spells/scripts/attack/fast bolt.lua:19: ')' expected near ','
[20/09/2011 22:10:04] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/fast bolt.lua)
[20/09/2011 22:10:04] data/spells/scripts/attack/fast bolt.lua:19: ')' expected near ','

I tried to solve it but i can't find the error :S and bepokemon, your spell is for a rune? I don't understand what it do xd
 
The first works fine So very TY xD but the secondone appears that on console when I make /reload spells

Code:
[20/09/2011 22:10:04] [Error - LuaScriptInterface::loadFile] data/spells/scripts/attack/fast bolt.lua:19: ')' expected near ','
[20/09/2011 22:10:04] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/fast bolt.lua)
[20/09/2011 22:10:04] data/spells/scripts/attack/fast bolt.lua:19: ')' expected near ','

I tried to solve it but i can't find the error :S and bepokemon, your spell is for a rune? I don't understand what it do xd

Its a spell, a spell doesn't need to nescessary "doCombat" .. I'll test it here and post if it's 100% .. You can add it like any spell. Just put needtarget="1", selftarget="0" .. And I think thats all ..
 
Well I could solve the error to loding the script but now appears another error when I say the words :S

Code:
[23/09/2011 22:05:49] [Error - Spell Interface] 
[23/09/2011 22:05:49] data/spells/scripts/attack/fast bolt.lua:onCastSpell
[23/09/2011 22:05:50] Description: 
[23/09/2011 22:05:50] (luaAddEvent) Callback parameter should be a function.

Could somebodie help me?

I'm talking about this script

Code:
-- Create a combat object with params
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE,           COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_USECHARGES,     false)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 34)
 
    -- Create a formula for early created combat object
    function onGetFormulaValues(cid, level, skill, attack, factor)
        local skillTotal, levelTotal = skill + attack, level / 2
        return -(skillTotal * 1.5 + levelTotal + 100), -(skillTotal + levelTotal + 300)
    end
    setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
    -- Main Spell
    local shoots = 5 -- configuration shots here
	function onCastSpell(cid, var)
		local ammo = getPlayerSlotItem(cid, CONST_SLOT_AMMO)
		if (ammo.uid and getPlayerItemCount(cid, ammo.itemid) >= shoots) then
			for i = 0, shoots do
				addEvent(300 * i, cid, combat, var)
			end
			return true
		end
		doPlayerSendCancel(cid, "You must have 5 ammunition, to use that spell.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return false
    end
 
Back
Top