• 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 Rune Target Problem

Lares

Member
Joined
Feb 8, 2010
Messages
315
Reaction score
7
Hello i have small problem because i dont know what i must use in this script to use script on target.

My simple Script:

Lua:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
    
function onCastSpell(cid, var)
    local target = variantToNumber(var)
        doCreatureSetNoMove(target, true)
        addEvent(doCreatureSetNoMove, 4000, target, false) 
    return doCombat(cid, combat, var)
end

When i use this rune on monster he dont stay.
 
Test this script:

Lua:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onCastSpell(cid, var)
    local target = variantToNumber(var)
        doCreatureSetNoMove(target, true)
        addEvent(doCreatureSetNoMove, 4000, target, false) 
    return doCombat(cid, combat, var)
end
 
PHP:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onCastSpell(cid, var)
    local target = variantToNumber(var)
        doCreatureSetNoMove(target, true)
        addEvent(doCreatureSetNoMove, 4000, target, true)
    return doCombat(cid, combat, var)
end
try this.
 
PHP:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onCastSpell(cid, var)
    local target = variantToNumber(var)
        doCreatureSetNoMove(target, true)
        addEvent(doCreatureSetNoMove, 4000, target, true)
    return doCombat(cid, combat, var)
end
try this.

Dont work because problem is "target" when i change target to cid script work but on me (I have 4s stun not my target)
 
PHP:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onCastSpell(cid, var)
-- local target = variantToNumber(var) Dont remove "--" in this line.
    local target1 = getCreaturePosition(target)
        doCreatureSetNoMove(target1, true)
        addEvent(doCreatureSetNoMove, 4000, target1, true)
    return doCombat(cid, combat, var)
end
try this code.
 
Dont work

Code:
[12/09/2010 00:50:02] [Error - Spell Interface] 
[12/09/2010 00:50:02] In a timer event called from: 
[12/09/2010 00:50:02] data/spells/scripts/stun.lua:onCastSpell
[12/09/2010 00:50:02] Description: 
[12/09/2010 00:50:02] (luaDoCreatureSetNoMove) Creature not found
 
Maybe simply test script like this:
Code:
local mid = doCreateMonster("dragon", {x = , y = , z = })
doCreatureSetNoMove(mid, true)

and check if doCreatureSetNoMove works on monsters.
 
PHP:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
    
    local condition = createConditionObject(CONDITION_PARALYZE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 50000)
    setConditionFormula(condition, -0.6, -18, -0.5, -18)
    setCombatCondition(combat, condition)
 
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

Try this code ...
 
Its paralyze code, i dont need paralyze because when player/monster is paralyzed then he move from sqm 1 to sqm 2 x second and when he is between sqm's he cant use potions and he must come to sqm 2.
 
Back
Top