• 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 Function [TFS 1.2] creature:setNoMove(bool) & creature:canMove()

So whats exactly the problem? The function does only prevent you from moving, not freezing your attacks. Also are you using OTClient?
 
So whats exactly the problem? The function does only prevent you from moving, not freezing your attacks. Also are you using OTClient?

Yes it does. It also executes that other function when character is freezed. I will try to fix it by myself later. Bug: its gonna unselect the target once you try moving 17 steps in any direction

I did some testing and I couldn't stop the player from deselecting the target no matter what. Even after removing network message sendCancelTarget() in protocolgame.cpp. I think it's more client-related issue than with the source and I don't think we can do anything here

Oh well, at least I tried :p
 
Last edited by a moderator:
Sorry to revive the topic.

I would like to know where should I add the verification canMove() so that the creature can't change direction too...
 
leftovers already added and complied it worked ok but this line I put and gave error.. does anyone know how to adapt to tfs 1.2 downgrage?


Lua:
int LuaScriptInterface::luaCreatureSetNoMove(lua_State* L)
{
   // creature:setNoMove(canMove)
   Player* player = getUserdata<Player>(L, 1);
   if (!player) {
      lua_pushnil(L);
      return 1;
   }

   bool noMove = getBoolean(L, 2);
   if (player->canMove() == noMove) {
      player->setNoMove(noMove);
   }

   pushBoolean(L, true);
   return 1;
}

int LuaScriptInterface::luaCreatureCanMove(lua_State* L)
{
   // creature:canMove()
   Player* player = getUserdata<Player>(L, 1);
    if (player) {
      pushBoolean(L, player->canMove());
   } else {
      lua_pushnil(L);
   }
   return 1;
}
 
Back
Top