Hoi zusammen.
Hatte vorgehabt mit einem einfachen Code eine Textur(im .png Format) via Shader auf einen Skin z.B. 105 zu übertragen.
Vom Code her klappt eigentlich alles, trotzdem wird die Textur nicht ersetzt.
Habe das Script auf 2 Servern und im lokalen Mapserver getestet mit dem gleichen Ergebnis.
XML: Meta
<!-- Skins -->
<file src="System/Images/Skins/Replacer.fx"/>
<file src="System/Images/Skins/skin1.png"/>
<file src="System/Images/Skins/skin2.png"/>
Lua: Replacer.fx
texture import_texture;
technique TexReplace
{
pass P0
{
Texture[0] = import_texture;
}
}
Lua: Client
local TXD_Name={
[22]={"skin1", "bmyst"},
[102]={"skin2", "ballas1"},
[105]={"skin3", "fam1"},
}
function loadSkin(element)
if isElement(element) then
local ID = getElementModel(element)
if ID then
outputChatBox("Skin ID: "..ID)
outputChatBox("Name: "..TXD_Name[ID][2])
outputChatBox("Path: "..TXD_Name[ID][1])
local TXD_Shader = dxCreateShader("System/Images/Skins/Replacer.fx")
local TXD_Texture = dxCreateTexture("System/Images/Skins/"..TXD_Name[ID][1]..".png")
if TXD_Shader and TXD_Texture then
dxSetShaderValue(TXD_Shader, "import_texture", TXD_Texture)
local ret = engineApplyShaderToWorldTexture(TXD_Shader, TXD_Name[ID][2])
outputChatBox("Loaded: "..tostring(ret))
end
end
end
end
addEvent("loadSkin", true)
addEventHandler("loadSkin", root, loadSkin)
Alles anzeigen
Skin ID: 105
Name: fam1
Path: skin3
Loaded: true
Gibt alles korrekt zurück, auch ret gibt true.