• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Light hack with Lua instead of Cheatengine

poorrada

New Member
Joined
Apr 24, 2024
Messages
6
Reaction score
0
Hey,

I was wondering if there is an option to use lua function to make a character shine like he use 'utevo lux' or what so ever in type of light hack.
I have access to g_game, g_map, g_window and so on, but I believe I do not have access to classes. I have never used them in my code.

I successfully used Cheat engine, but I would prefer to use (lua) something like:

player.setLight() or player.setCreatureLight()

but in my case, none of those two works (getLight, getCreatureLight do not work neither). Even tough I see the functions in x32dbg I can not use them. Other functions works though.

Those are my function examples:

function lightInfo1()
local player = g_game.getLocalPlayer()
local lightValue = player.getCreatureLight()
printConsole('Light value: ' .. lightValue)
end

function lightInfo2()
local player = g_game.getLocalPlayer()
local lightValue = player.getLight()
printConsole('Light value: ' .. lightValue)
end

What is more due to the fact I do not have access to classes I was trying to hard code some values. There was no success in using such a functions:
function setLightOn()
local player = g_game.getLocalPlayer()
local light = player:getLight()
if light then
light.intensity = math.max(light.intensity, 6)
if light.color == 0 or light.color > 215 then
light.color = 215
end
player:setLight(light)
else
printConsole('No light data to update.')
end
end




I was wondering if someone was using functions like: generateLightBubble.

PS. I am not interested in increasing AmbientLight.
 
every item / outfit has light flag its represented by 0-255 :) you can see that in object builder
1713966815120.png



so boolean true to hasLight flag and then light color will be from 0-255 pallette intensity is the radius :) thats all i leave figuring out to you but with cheat engine you can probably make .exe for your desired ot client i personally like to use water elemental outfit on the player it has small blue light enough for utevo lux like it might also guide you how to find said flags by comparing to outfits with these elements disabled ( fire elemental has red light or yellow "fire like" )
 
Following function still does not work. I do not why. I must admit that a lot of other function works like this, but I believe hardcoding intensity and color is faulty. On the other hand setLight might be wrong.


Aparently there is third element in Light Class:
struct Light {
Point pos;
uint8_t color = 215;
uint8_t intensity = 0;
};

Is position just a x,y,z of character?

function setLightOn1()
printConsole('Start.')
local light = {
intensity = 255,
color = 215
}

if g_map and g_map.setLight then
g_map.setLight(light)
printConsole('Light set with intensity ' .. light.intensity .. ' and color ' .. light.color)
else
printConsole('Failed to set light: g_map not available or setLight method missing.')
end
printConsole('End.')
end


function setLightOn2()
printConsole('Start.')

local light = {
intensity = 255,
color = 215
}

local playerL = g_game.getLocalPlayer()
local lightValue = playerL:setLight(light)
printConsole('End.')
end


Following functions failed as well:

function setLightOn1()
printConsole('Start.')

local player = g_game.getLocalPlayer()
local playerPosition = player:getPosition()

local light = {
pos = playerPosition, -- Use player's current position
color = 215, -- Example color value, typically a yellowish light
intensity = 255 -- Maximum intensity
}
if g_map and g_map.setLight then
g_map.setLight(light)
printConsole('Light set at player\'s position with intensity ' .. light.intensity .. ' and color ' .. light.color)
else
printConsole('Failed to set light: g_map not available or setLight method missing.')
end

printConsole('End.')
end



function setLightOn2()
printConsole('Start.')

local player = g_game.getLocalPlayer()
local playerPosition = player:getPosition()

local light = {
pos = playerPosition, -- Use player's current position
color = 215, -- Example color value, typically a yellowish light
intensity = 255 -- Maximum intensity
}

local playerL = g_game.getLocalPlayer()
local lightValue = playerL.setLight(light)
printConsole('End.')
end
 
Last edited:
yes position will refer probably to creature or player:getposition or something alike? u have to check sources of otcv8 for said functions this is just idea maybe the game window itself can have it set to 255 or so or just check how bots do it. or even reference the function that is probably disabled in otcv8 which is the ambient light


1713971944082.png
 
I would like something more than ambient light 100. Nothing seems to work. I have tried nearly anything. I believe its not achivable without cheatengine or modifing server files.
 
Last edited:
by default OTCv8 does not have this method for creatures
You will have to modify the source code to add this method and you can use it in Lua

If you add it, you should add a repetitive event that establishes the character's light from time to time since the server will be changing the creature's light with each update of the creature.

If the server you are playing allows you to use OTCv8 without encryption or any type of security so that you avoid playing with another modified client, you can use this trick to modify your own client
 
Its strange for me that I am able to modify a lot. By a lot I mean, when I am not a server owner and just a player, I am able to change tree into bush (just on my screen), I can use like a lot of lua functions, but I can not change any light settings ( I am able to change light with Cheat Engine, but I would like to use lua only). I had 3 days of try and error behind me and nothing worked. I was trying to decrease/increase ambient light without success. I am able to change this variable, but in game there is no effect. I believe I am lacking some g_graphics, or g_game functions which would change the light settings and I believe I have to use some kind of refresh/update function to make it work. Though in a case converting tree into bush with lua I didnt need anything like that. I am very confused and sad, because of those miss tries. Those functions are changing the variable, but it has no effect on game at all:

function setLightOn2()
printConsole('Start.')
local value = modules.client_options.getOption('ambientLight')
printConsole('Light = intensity:' .. value)
end


function setLightOn3()
printConsole('Start.')
-- Assuming there's a setter function to adjust ambient light, similar to the getter
modules.client_options.setOption('ambientLight', 15) -- Example of setting light intensity
local value = modules.client_options.getOption('ambientLight')
printConsole('Light = intensity:' .. value)
-- g_map.refresh(true)
printConsole('End.')
end


function setLightOn4()
printConsole('Start.')
-- Assuming there's a setter function to adjust ambient light, similar to the getter
modules.client_options.setOption('ambientLight', 90) -- Example of setting light intensity
local value = modules.client_options.getOption('ambientLight')
-- g_map.refresh(true)
printConsole('Light = intensity:' .. value)
printConsole('End.')
end
 
Last edited:
Its strange for me that I am able to modify a lot. By a lot I mean, when I am not a server owner and just a player, I am able to change tree into bush (just on my screen), I can use like a lot of lua functions, but I can not change any light settings ( I am able to change light with Cheat Engine, but I would like to use lua only). I had 3 days of try and error behind me and nothing worked. I was trying to decrease/increase ambient light without success. I am able to change this variable, but in game there is no effect. I believe I am lacking some g_graphics, or g_game functions which would change the light settings and I believe I have to use some kind of refresh/update function to make it work. Though in a case converting tree into bush with lua I didnt need anything like that. I am very confused and sad, because of those miss tries. Those functions are changing the variable, but it has no effect on game at all:

function setLightOn2()
printConsole('Start.')
local value = modules.client_options.getOption('ambientLight')
printConsole('Light = intensity:' .. value)
end


function setLightOn3()
printConsole('Start.')
-- Assuming there's a setter function to adjust ambient light, similar to the getter
modules.client_options.setOption('ambientLight', 15) -- Example of setting light intensity
local value = modules.client_options.getOption('ambientLight')
printConsole('Light = intensity:' .. value)
-- g_map.refresh(true)
printConsole('End.')
end


function setLightOn4()
printConsole('Start.')
-- Assuming there's a setter function to adjust ambient light, similar to the getter
modules.client_options.setOption('ambientLight', 90) -- Example of setting light intensity
local value = modules.client_options.getOption('ambientLight')
-- g_map.refresh(true)
printConsole('Light = intensity:' .. value)
printConsole('End.')
end
well ambient light can be disabled so it probably is so that is that
 
modules.game_interface.getMapPanel():setDrawLights(false) or just disable lights in options.
 
I have checked that. In the OTS I am testing my functions, the mabient light is blocked on 100% in options and you can not change it. Additionaly functons with setDrawLights(false/true) does not work, nothing is happening on screen. Is it possible to simulate utevo lux on character with lua? The idea is to make light hack with lua functions.
 
I am able to even remove tiles for my window even though I am not the owner of the OTS and I do not have acceess to server files. I am just using Lua custom scripts. If I am able to remove tiles, cant I put a light effect on one of the tiles??? Its strange for me.

This is the code:
"""
function setLightOn1()
printConsole('Start setLightOn1.')
local tileObject = modules.game_interface.gameMapPanel:getTile(modules.game_interface.gameMapPanel.mousePos)
printConsole('middle1')

local player = g_game.getLocalPlayer()


local item = player:getInventoryItem(6)

local tileEffect = tileObject:addThing(item, 0)
printConsole('Value:' .. tileEffect)
printConsole('middle2')
printConsole('End')
end
"""

1714079996393.png


I just dont know how to create a lightview on Tile from function. What is more I do not know how to get from TilePtr to Point.
"""
void drawTop(const Point& dest, LightView* lightView = nullptr);
"""

What is more I can change myself into any creature, but I am not able to generate "artifical light hack" still with following code:

Code:
"""

function setLightOn2()
printConsole('Start setLightOn2.')

local player = g_game.getLocalPlayer()
local outfit = player:getOutfit()
printConsole('Outfit ' .. tostring(outfit))
printConsole('Type of Outfit: ' .. type(outfit))

if type(outfit) == 'table' then
-- Set the random seed for the random number generator (optional, can be called once elsewhere if preferred)
math.randomseed(os.time())

-- Generate a random digit between 0 and 255, adjust the range as needed
local randomAura = math.random(0, 255)
outfit.type = randomAura -- Set the random digit to aura

printConsole('Aura changed to: ' .. outfit.aura)

-- Hypothetical method to save changes
player:setOutfit(outfit)
else
printConsole('Outfit is not a table or is empty')
end

printConsole('middle2')
printConsole('End')
end
"""


Output:
"[unknown source]: topWidgets table: 0x11d48058[unknown source]: Type of topWidgets: table[unknown source]: Key: aura, Value: 0[unknown source]: Key: legs, Value: 97[unknown source]: Key: head, Value: 78[unknown source]: Key: wings, Value: 0[unknown source]: Key: feet, Value: 95[unknown source]: Key: type, Value: 350[unknown source]: Key: auxType, Value: 0[unknown source]: Key: shader, Value:[unknown source]: Key: body, Value: 69"


I have found a workaround to change with function my outfit with the outfit with light (or monster like HFF or Fire elemental) with following function:

function setLightOn3()
local player = g_game.getLocalPlayer()
local outfit = player:getOutfit()
if type(outfit) == 'table' then
outfit.type = 320 -- Set the random digit to aura
player:setOutfit(outfit)
else
printConsole('Outfit is not a table or is empty')
end
end

and this is the effect:
1714158725555.png
 
Last edited:
Back
Top