• 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 Could someone help me with this spell?

Daniel Braga

New Member
Joined
Mar 17, 2018
Messages
53
Reaction score
1
I would like a spell that leaves the enemy locked for 3 seconds, during those seconds there is 1 animation on the target.
 
I developed this system to create an aura of immortality and it was used to balance the fighting mode.

luascript.cpp

C++:
int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_Sta te * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv ( ) ; Player * player = env -> getPlayerByUID ( ( uint32_t ) popNumber ( L ) ) ; if ( ! player ) { errorEx ( getError ( LUA_ERROR_PLAYER_NOT_FOUND ) ) ; lua_pushboolean ( L , false ) ; } else lua_pushnumber ( L , player -> getSecureMode ( ) ) ; return 1 ; }

luascript.cpp

getPlayerSecureMode (CID) Lets Create That Function
Código C++:

Código C++:
C++:
int32_t LuaScriptInterface::luaGetPlayerSecureMode(lua_Sta  te* L)

{

    //getPlayerSecureMode(cid)

    ScriptEnviroment* env = getEnv();

    Player* player = env->getPlayerByUID((uint32_t)popNumber(L));

    if(!player)

    {

        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));

        lua_pushboolean(L, false);

    }

    else

        lua_pushnumber(L, player->getSecureMode());

 

    return 1;

}

Simple and easy I'll leave an example.
Lua:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker)==true and isPlayer(cid)==true then   
        if getPlayerSecureMode(cid) and combat ~= COMBAT_HEALING then   
            return false
        end   
    end
return true
end
Explanation
when the player is with getPlayerSecureMode, is protected against anything, like an aura something like that use your imagination, the other command is to return to normal.
 
Versão Tfs
OTX 8.60
Post automatically merged:

Desenvolvi este sistema para criar uma aura de imortalidade e foi usado para equilibrar o modo de luta.

luascript.cpp

C++:
int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }
 
 int32_t LuaScriptInterface :: luaGetPlayerSecureMode ( lua_State * L ) { //getPlayerSecureMode(cid) ScriptEnviroment * env = getEnv() ; Player * player = env -> getPlayerByUID((uint32_t) popNumber(L)); if (! player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } else lua_pushnumber(L, player -> getSecureMode()); retorno 1; }[/CÓDIGO]

luascript.cpp

getPlayerSecureMode (CID)  [B]permite essa função[/B]
Código C++:

Código C++:
[CODE=cpp]int32_t LuaScriptInterface::luaGetPlayerSecureMode(lua_State* L)

{

    //getPlayerSecureMode(cid)

    ScriptAmbiente* env = getEnv();

    Player* player = env->getPlayerByUID((uint32_t)popNumber(L));

    if(!jogador)

    {

        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));

        lua_pushboolean(L, false);

    }

    senão

        lua_pushnumber(L, jogador->getSecureMode());

 

    retorno 1;

}[/CÓDIGO]

Simples e fácil vou deixar um exemplo.
Lua:
[CODE=lua]função onStatsChange(cid, atacante, tipo, combate, valor)
    if isPlayer(attacker)==true e isPlayer(cid)==true então 
        se getPlayerSecureMode(cid) e combat ~= COMBAT_HEALING então 
            retorna falso
        fim 
    fim
retornar verdadeiro
fim
Explicação
quando o player está com getPlayerSecureMode, está protegido contra coisa, uma aura algo assim usa sua imaginação, ou outro comando é voltar ao normal.
I'll be looking at what I can do with it, but what I would like was 1 spell that left the target locked for 3 seconds, and during those 3 seconds there was 1 animation (effect) on top of that locked target.

similar to paralyze, but it is travalyze, which leaves the enemy immobile.
 
I would like a spell that leaves the enemy locked for 3 seconds, during those seconds there is 1 animation on the target.
Maybe you could use this and make it into a spell?
 

video time >>1:12 a 1:20s <<
Please watch the video so you can understand better.


and almost the same as the video, I would like the target to be stunned for 2s, and while it is stunned change its outfic to another one, or to an animation. After the spells time expired, he returned to normal.
 

video time >>1:12 a 1:20s <<
Please watch the video so you can understand better.


and almost the same as the video, I would like the target to be stunned for 2s, and while it is stunned change its outfic to another one, or to an animation. After the spells time expired, he returned to normal.
No way, polimorf.
 
Locked from movement or from casting spells/dealing damage?
Blocking spells/damage can be achieved using condition CONDITION_PACIFIED.

About locking walking, I would not recommend it. Tibia client is not prepared to handle lock of walking, as it was never used on real Tibia.
Some TFS versions have function setNoMove(cid, true), which blocks player moving, but after using it and pressing arrow, there appeared weird animations in client.
 
Bloqueado por movimento ou por lançar feitiços/causar dano?
Bloquear feitiços/danos pode ser obtido usando a condição CONDITION_PACIFIED.

Sobre travar andando, não recomendo. O cliente do Tibia não está preparado para lidar com o bloqueio de caminhada, pois nunca foi usado no Tibia real.
Algumas versões do TFS possuem a função setNoMove(cid, true), que bloqueia a movimentação do jogador, mas depois de usá-la e pressionar a seta, apareceram animações estranhas no cliente.
this, I would like the enemy to stay without casting spells, but keep taking damage

since locking the target can cause problems, how about we remove the speed of the target, thus leaving it so slow that it would give its effect stunned

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
setConditionFormula(condition, -0.90, 0, -0.96, 0)

as long as he has this "paralyzed" debuff to the point where it appears blocked, the target would have an ObjectBuilder "effect" on him, until the paralysis wears off.
 
Last edited:
Try this if that's what you want and you can control paralysis
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, 512)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 43)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4.0, -0, -3.1, -0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 43)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
--setConditionParam(condition, CONDITION_PARAM_SPEED, -40)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setCombatCondition(combat, condition)

arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
doSendAnimatedText(getPlayerPosition(cid), "Elmantist ..", 208)
return doCombat(cid, combat, var)
end
----------------------------------------
 
Back
Top