tp spell

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
why this spell don't work ?
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 onCastSpell(cid, var)
if(isPlayer(player)) then
local player = variantToNumber(var)
doTeleportThing(player, {x=620, y=936, z=7}, false)
end
    return doCombat(cid, combat, var)
end
xml
Code:
<instant name="kickers" words="kickers" enabled="0" event="script" value="monster/tp.lua"/>
this spell work like if player get hit from monster tp to {x=620, y=936, z=7}

in monster.xml
Code:
  <attacks>
<attack name="kickers" interval="1000" chance="100" range="7" radius="3" target="0"/>
   </attacks>
0.4
 
Last edited:

Leesne

Member
Joined
Dec 4, 2017
Messages
89
Reaction score
36
function onCastSpell(cid, var)
if(isPlayer(player)) then

player isn't defined.
player = Player(cid)
 

Leesne

Member
Joined
Dec 4, 2017
Messages
89
Reaction score
36
ok, either way, you still are asking if player is a player.. yet there is no declaration of player.
 
OP
ConAn Edujawa

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
ok, either way, you still are asking if player is a player.. yet there is no declaration of player.
Code:
local cid= variantToNumber(var)
if(isPlayer(cid)) then
doTeleportThing(cid,{x=620, y=936, z=7}, false)
end
when do this server get crash
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
396
Reaction score
213
Location
London
Code:
function onCastSpell(cid, var)
   if isPlayer(var.number) then
      doTeleportThing(var.number, { x = 620, y = 936, z = 7 })
   end
   return doCombat(cid, combat, var)
end
 

Crypter

New Member
Joined
Aug 21, 2017
Messages
9
Reaction score
2
Lua:
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 onCastSpell(cid, var)
    local target = var.number
    if isPlayer(target) then
        doTeleportThing(target, {x=620, y=936, z=7}, false)
    end
    return doCombat(cid, combat, var)
end
 
Last edited:
OP
ConAn Edujawa

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
Code:
function onCastSpell(cid, var)
   if isPlayer(var.number) then
      doTeleportThing(var.number, { x = 620, y = 936, z = 7 })
   end
   return doCombat(cid, combat, var)
end
Lua:
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 onCastSpell(cid, var)
    local target = variantToNumber(var)
    if isPlayer(target) then
        doTeleportThing(target, {x=620, y=936, z=7}, false)
    end
    return doCombat(cid, combat, var)
end
not work player don't get tp and no error :S
 

Crypter

New Member
Joined
Aug 21, 2017
Messages
9
Reaction score
2
Editted

do not forget the target from xml of monster

XML:
<attacks>
<attack name="kickers" interval="1000" chance="100" range="7" radius="3" target="1"/>
</attacks>
 
OP
ConAn Edujawa

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
Editted

do not forget the target from xml of monster

XML:
<attacks>
<attack name="kickers" interval="1000" chance="100" range="7" radius="3" target="1"/>
</attacks>
i did but not work :S
 

Crypter

New Member
Joined
Aug 21, 2017
Messages
9
Reaction score
2
Lua:
function onCastSpell(cid, var)
    local target = var.number
    if isPlayer(target) then
        doTeleportThing(target, {x=620, y=936, z=7}, false)
        return true
    end
    return false
end
add needtarget="1" on spell xml
 
OP
ConAn Edujawa

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
Lua:
function onCastSpell(cid, var)
    local target = var.number
    if isPlayer(target) then
        doTeleportThing(target, {x=620, y=936, z=7}, false)
        return true
    end
    return false
end
add needtarget="1" on spell xml
if i use needtarget is work like dis spell {exori con} exori flam not like exori
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
396
Reaction score
213
Location
London
mmm expansive spells:
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 onTileCombat(cid, pos)
   pos.stackpos = 255
   local playerId = getThingFromPos(pos, false).uid
   if not (cid == playerId) and isPlayer(playerId) then
      doTeleportThing(playerId, { x = 620, y = 936, z = 7 })
   end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTileCombat")

function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end
 
OP
ConAn Edujawa

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
286
Reaction score
3
mmm expansive spells:
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 onTileCombat(cid, pos)
   pos.stackpos = 255
   local playerId = getThingFromPos(pos, false).uid
   if not (cid == playerId) and isPlayer(playerId) then
      doTeleportThing(playerId, { x = 620, y = 936, z = 7 })
   end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTileCombat")

function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end
kiss for you :D
 
Top