• 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!

Lua Spell Idea Error

Aleada

Unknown Member
Joined
Mar 14, 2013
Messages
231
Reaction score
7
Well, I finally figured it out after hours of searching :o Thank you so very much tetra20!

-- Close please --
 
Last edited:
Second Error

LUA:
doSendMagicEffect(cid, 2)

Should be

LUA:
doSendMagicEffect(getPlayerPosition(cid), 2)

because send magic effect need x,y,z


First Error:
i have no idea
 
Thank you very much :D That fixed the second error :)

I still can't figure this one out though :/

Code:
[29/7/2013 11:48:45] >>> Loading spells... 
[29/7/2013 11:48:45] [Error - Test Interface] 
[29/7/2013 11:48:45] data/spells/scripts/Archer/Attack/Quick Shot.lua
[29/7/2013 11:48:45] Description: 
[29/7/2013 11:48:45] (LuaInterface::luaGetPlayerSlotItem) Player not found

[29/7/2013 11:48:45] [Error - Test Interface] 
[29/7/2013 11:48:45] data/spells/scripts/Archer/Attack/Quick Shot.lua
[29/7/2013 11:48:45] Description: 
[29/7/2013 11:48:45] (LuaInterface::luaGetPlayerSlotItem) Player not found

[29/7/2013 11:48:45] [Error - Spell Interface] 
[29/7/2013 11:48:45] data/spells/scripts/Archer/Attack/Quick Shot.lua
[29/7/2013 11:48:45] Description: 
[29/7/2013 11:48:45] (LuaInterface::luaGetPlayerSlotItem) Player not found

[29/7/2013 11:48:45] [Error - Spell Interface] 
[29/7/2013 11:48:45] data/spells/scripts/Archer/Attack/Quick Shot.lua
[29/7/2013 11:48:45] Description: 
[29/7/2013 11:48:45] (LuaInterface::luaGetPlayerSlotItem) Player not found
[29/7/2013 11:48:46] (done).


-- EDIT --

I changed the script to this and I don't get anymore errors, but the distanceeffect doesn't work still:

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
function check(cid)
	if (getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2544) then
		setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)
	elseif (getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2543) then
		setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BOLT)
	end
end
 
function onGetFormulaValues(cid, level, skill)
	return -(((skill + 30) / 3) + (level / 4)), -((skill + 30) + (level / 4)), 0
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") 
local config = { ammu = {2543, 2544} }
function onCastSpell(cid, var)
	local removed = false
	for _, itemid in pairs(config.ammu) do
		if(getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2544) or (getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2543) then
			doPlayerRemoveItem(cid, itemid, 1)
			removed = true
			break
		end
	end
	if removed == false then
	return doPlayerSendCancel(cid, "You need ammunition for this spell.") and doSendMagicEffect(getPlayerPosition(cid), 2) and false end	
	return doCombat(cid, combat, var)
end
 
Last edited:
Back
Top