• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Lua Could someone help me with this spell?

Daniel Braga

New Member
Joined
Mar 17, 2018
Messages
51
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.
 

underewar

Active Member
Joined
Feb 9, 2013
Messages
41
Reaction score
37
Location
Brazil
GitHub
Underewarrr
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.
 
OP
OP
D

Daniel Braga

New Member
Joined
Mar 17, 2018
Messages
51
Reaction score
1
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.
 

venius

New Member
Joined
Dec 27, 2010
Messages
61
Reaction score
3
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?
 
OP
OP
D

Daniel Braga

New Member
Joined
Mar 17, 2018
Messages
51
Reaction score
1

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.
 

mano368

Well-Known Member
Joined
Sep 2, 2011
Messages
223
Solutions
27
Reaction score
91
Location
Brazil

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.
 

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,508
Solutions
260
Reaction score
4,441
the name of the spell you want is "polymorph", btw Lulu's spell doesn't lock the target, it just makes it move very slowly while changing its appearance.
 

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,696
Solutions
84
Reaction score
2,650
Location
Poland
GitHub
gesior
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.
 

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,508
Solutions
260
Reaction score
4,441
OP
OP
D

Daniel Braga

New Member
Joined
Mar 17, 2018
Messages
51
Reaction score
1
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:

abdala ragab

Banned User
Joined
Aug 18, 2018
Messages
306
Solutions
10
Reaction score
271
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
----------------------------------------
 
Top