Hi I'm making a new server with all custon classes and Skill and I have a class that uses only throwing weapons. while making a spell to it I got a problem, my getplayeritemslot isent returning the weapon id or at lest not the right one. here is the code:
the Spell is checking the item slot 10 (ammunition slot) just to test then it would be changed to 5 and 6 to check weapon, and it always return the error msg saying I dont have the right weapon.
I'm using 8.7 TSF 0.2.1
Code:
local scom1 = createCombatObject()
local scom2 = createCombatObject()
local scom3 = createCombatObject()
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 255)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 8)
setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 1.5, -40, 0.5, -25)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 0)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 8)
setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 1.5, -80, 0.5, -50)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 0)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 8)
setCombatFormula(combat3, COMBAT_FORMULA_SKILL, 1.5, -160, 0.5, -150)
local area1 = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)
local area2 = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)
local area3 = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)
setCombatArea(scom1, area1)
setCombatArea(scom2, area2)
setCombatArea(scom3, area3)
function onTargetTile(cid, pos)
doCombat(cid,combat1,positionToVariant(pos))
end
function onTargetTile2(cid, pos)
doCombat(cid,combat2,positionToVariant(pos))
end
function onTargetTile3(cid, pos)
doCombat(cid,combat2,positionToVariant(pos))
end
setCombatCallback(scom1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
setCombatCallback(scom2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
setCombatCallback(scom3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")
local function onCastSpell1(parameters)
doCombat(parameters.cid, scom1, parameters.var)
end
local function onCastSpell2(parameters)
doCombat(parameters.cid, scom2, parameters.var)
end
local function onCastSpell3(parameters)
doCombat(parameters.cid, scom3, parameters.var)
end
function onCastSpell(cid, var)
if getPlayerSlotItem(cid, 10) == 2410 then
slvl = getPlayerStorageValue(cid,9001)
local parameters = { cid = cid, var = var}
if (slvl) <= 2 then
addEvent(onCastSpell1, 100, parameters)
setPlayerStorageValue(cid,9001,slvl+1)
elseif (slvl) <= 5 then
addEvent(onCastSpell2, 200, parameters)
setPlayerStorageValue(cid,9001,slvl+1)
elseif (slvl) >= 6 then
addEvent(onCastSpell3, 300, parameters)
end
else
doPlayerSendCancel(cid, "You need a Throwing weapon.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return LUA_ERROR
end
end
the Spell is checking the item slot 10 (ammunition slot) just to test then it would be changed to 5 and 6 to check weapon, and it always return the error msg saying I dont have the right weapon.
I'm using 8.7 TSF 0.2.1