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

Stun yourself when cast spell (spells)

adamox223

New Member
Joined
Oct 21, 2017
Messages
99
Reaction score
4
Hello, i need add to this script: When we use spell, then we cant move for 2sec, can you help me? i cant use nomove :/


Code:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 39)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -1.4, 1, -2.5, 1)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 39)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -2.1, 1, -1.6, 1)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 39)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -1.4, 1, -2.5, 1)
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_DISTANCEEFFECT, 39)
setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -2.3, 1, -1.5, 1)
arr1 = {
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}
}
arr2 = {
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}
}
arr3 = {
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}
}
arr4 = {
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1}
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
setCombatArea(combat4, area4)
local function onCastSpell1(parameters)
return isPlayer(parameters.cid) and doCombat(parameters.cid, combat1, parameters.var)
end
local function onCastSpell2(parameters)
return isPlayer(parameters.cid) and doCombat(parameters.cid, combat2, parameters.var)
end
local function onCastSpell3(parameters)
return isPlayer(parameters.cid) and doCombat(parameters.cid, combat3, parameters.var)
end
local function onCastSpell4(parameters)
return isPlayer(parameters.cid) and doCombat(parameters.cid, combat4, parameters.var)
end
local function actionMove(cid, outfit, time)
if not isCreature(cid) then
return true
end
local action = {lookType = outfit, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
doSetCreatureOutfit(cid, action, time)
end
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
actionMove(cid, 385, 500)
addEvent(onCastSpell1, 200, parameters)
addEvent(onCastSpell2, 600, parameters)
addEvent(onCastSpell2, 1000, parameters)
addEvent(onCastSpell2, 1400, parameters)
return TRUE
end
 
doesnt work :/

That attitude towards the solving of this problem isn't helping.
You need to post which TFS version you're using, console logs and show the changes you've made to your script which produced the errors.

If used correctly, doCreatureSetNoMove(cid, true/false) should work, given that it exists in your distro. It exists in most of them, it may just be called differently in newer versions (probably creature:setNoMove for 1.2 or something like that).

You can check your server's documentation or luafunctions.cpp to confirm whether it's there.
 
140zqzm.png

TFS 1.0

i search luafunctions.cpp in my source and this file doesnt exist
 
140zqzm.png

TFS 1.0

i search luafunctions.cpp in my source and this file doesnt exist

Check if you can use mayNotMove(cid, true) instead?
If that doesn't exist, search luafunctions.cpp for both "nomove" and "notmove" keywords and see if it produces any results.
 
Ok i solved this:

Code:
function onCastSpell(cid, var)
mayNotMove(cid, true)
addEvent(mayNotMove, 5000, cid, false)
return true
end
Thanks @Shadowsong !

Yep, that's the way. I didn't want to give you the full solution so you can learn on your own how to make it work. Gj :D
 
Solution
Back
Top