Can anyone tell me why my script doesnt work?
I want to teleport player and change his outfit when he login (or when he is on x,y,z position or when he use xxxx item). On my server are 2 teams, 2 spawns, 2 outfit colors. Script must set spawn and outfit of 1 team (random). I tried to make spell, but this spell dont work
spells.xml
polymorph.lua
error:
It only change outfit, dont teleport and always set same outfit (not random 1/2). Rune dont loss charges :/
I want to teleport player and change his outfit when he login (or when he is on x,y,z position or when he use xxxx item). On my server are 2 teams, 2 spawns, 2 outfit colors. Script must set spawn and outfit of 1 team (random). I tried to make spell, but this spell dont work
spells.xml
Code:
<rune name="Polymorph" id="2270" aggressive="0" charges="1" needtarget="1" lvl="1" maglv="0" mana="0" soul="0" exhaustion="1000" prem="0" enabled="1" allowfaruse="1" script="polymorph.lua"></rune>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
local team = math.random(1, 2)
local condition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 72000000)
if team == "1" then
local pos = {x=95, y=124, z=7}
addOutfitCondition(condition, 0, 128, 0, 8, 0, 8)
else
local pos = {x=96, y=124, z=7}
addOutfitCondition(condition, 0, 131, 0, 50, 0, 50)
end
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
doCombat(cid, combat, var)
doTeleportThing(cid, pos)
return TRUE
end
Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/polymorph.lua:onCastSpell
attempt to index a number value