Lua Графика SkyBox на MonetLoader! (arizona + gtasa)

JSkiptyMods

Новичок
5
6
Mobile SkyBox
for MonetLoader

Самый простой SkyBox на Lua и текстурах, который работает на Arizona Mobile + GTA SA! (MonetLoader)

Думаю многие мобильные игроки видели скайбокс на CLEO, но из-за фикса CLEO библиотеки на Arizona Mobile и благодаря MonetLoader, я взяв текстуры используемые в CLEO скрипте написал отображение на LUA

Всего 4 вида текстур (ранее утро, день, вечер, ночь)

Видео с работой скрипта:

Активация скрипта автоматическая!

Установка скрипта текстур (для Arizona Mobile):
SkyBox.lua перекинуть по пути - com.arizona.game/monetloader/
Из архива SkyBoxTexture.zip (download from drive.google.com)
Import texture -> Uncompressed 32bpp -> all pngs - нужно заменить в Android/data/com.arizona.game/files/texdb/gta/gta3.txt с режимом Uncompressed 32bpp (через TXD Tool)
Replace DFF -> all dffs - нужно заменить в Android/data/com.arizona.game/files/models/gta3.img (через GTA Img Tool)

Видео с установкой скрипта и текстур:

Скрипт работает на MonetLoader - Arizona Mobile и на одиночной версии игры
(работает также и на PC moonloader версии игры, но за установку текстур там я не знаю и не отвечаю)

примечание: скрипт заменяет текстуры drug (закладок), поэтому с установленными текстурами данного скрипта поискать например закладочки на аризоне вы не сможете

Update 13.12.23:
Доработка от @mhertz:
- Небо плавно переходит в другое время
- Небо плавно крутится
Проблема в том, что. скрипт передает объект, который ещё не успел создаться.

Вот фикс:

script_name('SkyBox on MonetLoader')
script_version('2')
script_version_number(2)
script_author('Radare')
script_description('skybox converted from cleo to lua (script written from scratch, only textures taken)')

local ffi = require('ffi')
local gta = ffi.load('GTASA')

ffi.cdef[[
// void CEntity::SetRwObjectAlpha(CEntity *this, int alpha)
void _ZN7CEntity16SetRwObjectAlphaEi(void* thiz, int alpha);
]]

skyRotationSpeed = 0.010 -- sky rotation speed
skyRotation = 0 -- current sky rotation

sky = 0 -- current sky
skyModel = 0 -- current sky model
nextSky = 0 -- next sky (used to show it half-transparent)
currentHour = 25 -- last hour when sky was loaded
nextHour = 25 -- hour when next sky will be loaded
nextSwitchHours = 3 -- time to switch to next sky in hours (aka time when sky will be partially visible)
lastAlpha = 0 -- last alpha in order to not invoke unnecessary lua-C calls
heavens = { -- sky model ids
morning = 1577,
day = 1578,
evening = 1579,
night = 1580
}

function setObjectModelAlpha(object, alpha)
if not doesObjectExist(object) then return end
gta._ZN7CEntity16SetRwObjectAlphaEi(ffi.cast('void*', getObjectPointer(object)), alpha)
end

function timeDiff(h1, h2)
return h1 > h2 and (24 - h1) + h2 or h2 - h1
end

function main()
print("SkyBox Script Loaded! Author: Radare (t.me/ryderinc)")

while true do
wait(0)

-- load required sky
local time, minute = getTimeOfDay()
if currentHour ~= time then
if time >= 5 and time < 10 then
loadSky(heavens.morning, heavens.day)
nextHour = 10
elseif time >= 10 and time < 18 then
loadSky(heavens.day, heavens.evening)
nextHour = 18
elseif time >= 18 and time < 23 then
loadSky(heavens.evening, heavens.night)
nextHour = 23
else
loadSky(heavens.night, heavens.morning)
nextHour = 5
end
currentHour = time
end

-- update skies positions
if doesObjectExist(sky) then
local x,y,z = getCharCoordinates(PLAYER_PED)
setObjectCoordinates(sky, x, y, z+2)
end

if doesObjectExist(nextSky) then
local x,y,z = getCharCoordinates(PLAYER_PED)
setObjectCoordinates(nextSky, x, y, z+1.9) -- make next sky lower to avoid z-fighting
end

-- make next sky visible as time goes on
local toNextSky = timeDiff(currentHour, nextHour)
if toNextSky <= nextSwitchHours then
toNextSky = nextSwitchHours - toNextSky
toNextSky = toNextSky + minute / 60

lastAlpha = toNextSky / nextSwitchHours * 255
end
setObjectModelAlpha(nextSky, lastAlpha)

-- make sky spin (for cloud "movement")
skyRotation = skyRotation + skyRotationSpeed
setObjectRotation(sky, 0.0, 0.0, skyRotation)
setObjectRotation(nextSky, 0.0, 0.0, skyRotation)
end
end

function loadSky(textureID, nextTextureID)

if textureID == skyModel then return end

-- backup quat (если sky ещё не создан
local qx, qy, qz, qw = 0, 0, 0, 1
if doesObjectExist(sky) then
qx, qy, qz, qw = getObjectQuaternion(sky)
end

-- load skies
if doesObjectExist(sky) then deleteSky(sky) end
if doesObjectExist(nextSky) then deleteSky(nextSky) end
sky = createObject(textureID, 0.0, 0.0, 0.0)
nextSky = createObject(nextTextureID, 0.0, 0.0, 0.0)
skyModel = textureID

setObjectDrawLast(nextSky, true)

setObjectQuaternion(sky, qx, qy, qz, qw)
setObjectQuaternion(nextSky, qx, qy, qz, qw)

setObjectCollision(sky, false)
setObjectCollision(nextSky, false)

lastAlpha = 0
setObjectModelAlpha(nextSky, 0)

print('SkyBox: loaded textureID '..textureID)
end

function deleteSky(skyID)
setObjectModelAlpha(skyID, 255)
deleteObject(skyID)
print('SkyBox: sky deleted')
end

function onScriptTerminate(s, quitGame)
if s == thisScript() then
if doesObjectExist(sky) then deleteSky(sky) end
if doesObjectExist(nextSky) then deleteSky(nextSky) end
end
end
 
  • Нравится
Реакции: MrPipiskinXII