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

otclientv8 scripting cheat sheet?

hans henrik

Active Member
Joined
Jun 5, 2007
Messages
325
Reaction score
44
Location
Norway
Playing with OTClientV8 scripting, but seems most of the documentation has vanished, the client had it's own forum ( http://************ ) which is now dead...

Anyone got a OTClientV8 scripting cheat sheet?

so far I've got:
g_game APIs can be found under public: here: otcv8-dev/src/client/game.h at master · OTCv8/otcv8-dev (https://github.com/OTCv8/otcv8-dev/blob/master/src/client/game.h#L170) like void talk(const std::string& message); means g_game:talk("message");

player APIs can be found at otcv8-dev/src/client/localplayer.h at master · OTCv8/otcv8-dev (https://github.com/OTCv8/otcv8-dev/blob/master/src/client/localplayer.h#L36) , like double getHealth() { return m_health; } means player:getHealth()

Code:
function getManaPercent()
  return (player:getMana() / player:getMaxMana()) *100
end

function getHealthPercent()
  return (player:getHealth() / player:getMaxHealth()) *100
end

function hasManashield()
    return (player:getStates() & (1 << 4)) ~= 0
end

script to convert 100gp to 1 plat, 100 plat to 1 cc, 100 cc to 1 (whatever your server use beyond cc):

Code:
 for i, container in pairs(getContainers()) do
    for j, item in ipairs(container:getItems()) do
      if item:getCount() == 100 and (item:getId() == 3031 or item:getId() == 3035 or item:getId() == 3043) then
        g_game.use(item)
        delay(100)
        return "retry"
      end
    end
  end
 
... unable to edit the first post for some reason, but how to send custom packets:

Code:
local protocol = g_game.getProtocolGame()
local msg = OutputMessage.create()
msg:addU8(113)
protocol:send(msg)
(to send custom raw packets with no autoheader and no auto encryption, use protocol:send(msg,0) )
 
Back
Top