Jump to content

Logos on car


Recommended Posts

yo guys i am noob and can someone tell me what wrong is with this script ?

  
  
local picSize = Vector2(2, 5) -- scale the projected image 
local picPos = Vector2(0, -0.08) -- set image center position 
local picBright = false -- some vehicle do not have specular hightlighting (ie uranus) in this case set to 'true' 
local mask = true -- mask vertices with position lower than element position z component 
local maskHeight = -0.1 -- z position offset 
local texAddress = 4 -- wrap or mirror for repeated, border for a single one 
  
local enableDirt = true 
local enableEnv = true 
  
addEventHandler("onClientResourceStart", getRootElement(), 
    function() 
    if getVersion ().sortable < "1.4.0" then 
            outputChatBox( "Resource is not compatible with this client." ) 
            return 
    end 
    for k, v in ipairs ( getElementsByType ( "vehicle" )) do 
        if getElementData(v, "vehicle.locked") then 
        if getElementData(v, "vehicle.lockedto") == "Phoenix's Legion" then 
        shader, tec = DxShader("proj_paint_flat.fx", 0, 70, false, "vehicle") 
        local texture = DxTexture("p.png", "dxt3") 
        shader:setValue("gTextureColor", texture) 
        shader:setValue("sPicSize", picSize.x, picSize.y) 
        shader:setValue("sPicPos", picPos.x, picPos.y) 
        shader:setValue("sPicBright", picBright) 
        shader:setValue("sTexAddress", texAddress) 
        shader:setValue("sMask", mask) 
        shader:setValue("sMaskHeight", maskHeight)   
        shader:setValue("sEnableDirt", enableDirt) 
        shader:setValue("sEnableEnv", enableEnv) 
        shader:applyToWorldTexture("vehiclegrunge256", v) -- Apply shader 
        shader:applyToWorldTexture("?emap*", v) -- Apply shader 
        local pos = v:getPosition() 
        local elFw = v.matrix:getForward() 
        local elUp = v.matrix:getUp() 
        shader:setValue('elementFwVector', elFw.x, elFw.y, elFw.z)   
        shader:setValue('elementUpVector', elUp.x, elUp.y, elUp.z)   
        shader:setValue('elementPosition', pos.x, pos.y, pos.z)  
            end 
        end 
    end 
end 
) 

everything is almost fine, after movieng vehicle logo dont movies with vehicle (if u still dont understand logo is not attached to vehicle)

Link to comment

But after edit the .dff u can use engineApplyShaderToWorldTexture for change the logo. Some cars with different logos.

If u want i can edit the .dff but i need info about vehicle id and where u want put the logo.

Link to comment
But after edit the .dff u can use engineApplyShaderToWorldTexture for change the logo. Some cars with different logos.

If u want i can edit the .dff but i need info about vehicle id and where u want put the logo.

i have around 30 mods and i am going add more cars too and edit so much dff ? I think this way will be much easyer :wink:

Link to comment
You have to pick the vehicle matrix and get position and the 2 vectors. No need for the rest. That's why you are getting the "with this function already handled" error. Update the values mentioned onClientPreRender event.

can u give me example how to do correct ?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...