Jump to content

processLineOfSight - Can it even retrieve worldModelID?


Fabio(GNR)

Recommended Posts

I have tried in two scripts, one with firing a projectile which succesfully retrieved material id but not worldModelID. Also in this script:

addCommandHandler("removeObject",  
function (playerSource) 
showCursor(true) 
addEventHandler("onClientClick", getRootElement(), clickRemoveObject) 
end 
) 
  
function clickRemoveObject(button, state, x, y) 
  
local cx,cy,cz = getCameraMatrix() 
  
wx, wy, wz = getWorldFromScreenPosition(x,y, 1000) 
  
hit, hX, hY, hZ, hitEl, nX, nY, nZ, mat, light, piece, ModelID, ModelPosX, ModelPosY, ModelPosZ = processLineOfSight(cx,cy,cz,wx,wy,wz, true, false ,false, false, true, true, true, true, nil, true ) 
  
removeWorldModel ( ModelID, 50, ModelPosX, ModelPosY, ModelPosZ ) 
  
setCameraMatrix( ModelPosX, ModelPosY, ModelPosZ + 500 ) 
  
setTimer(setCameraTarget, 100, 1, localPlayer) 
  
end 

worldModelID = nil, and the ModelPos too.

Link to comment

try this:

addCommandHandler("removeObject",function() 
    showCursor(true) 
    addEventHandler("onClientClick", root, clickRemoveObject) 
end) 
  
function clickRemoveObject(button, state, x, y) 
    local cx,cy,cz = getCameraMatrix() 
    wx, wy, wz = getWorldFromScreenPosition(x,y, 1000) 
    hit, hX, hY, hZ, hitEl, nX, nY, nZ, mat, light, piece, ModelID, ModelPosX, ModelPosY, ModelPosZ = processLineOfSight(cx,cy,cz,wx,wy,wz, true, false ,false, false, true, true, true, true, nil, true ) 
    removeWorldModel ( ModelID, 50, ModelPosX, ModelPosY, ModelPosZ ) 
    setCameraMatrix( ModelPosX, ModelPosY, ModelPosZ + 500 ) 
    setTimer(setCameraTarget, 100, 1,localPlayer) 
end 

Link to comment
Didn't see anything change but, didn't work.

try this now:

addCommandHandler("removeObject",function() 
    showCursor(true) 
    addEventHandler("onClientClick", root, clickRemoveObject) 
end) 
  
function clickRemoveObject(button, state, x, y) 
    local cx,cy,cz = getCameraMatrix() 
    wx, wy, wz = getWorldFromScreenPosition(x,y, 1000) 
    hit,hitX, hitY, hitZ,hitElement,normalX, normalY, normalZ,material,lighting,piece,worldModelID,wpX,wpY,wpZ,wrX,wrY,wrZ = processLineOfSight(cx,cy,cz,wx,wy,wz, true, false ,false, false, true, true, true, true, nil, true ) 
    removeWorldModel ( worldModelID, 50, wpX, wpY, wpZ ) 
    setCameraMatrix( wpX, wpY, wpZ + 500 ) 
    setTimer(setCameraTarget, 100, 1,localPlayer) 
end 

Link to comment

try this and tell me if you got all the debugstrings:

addCommandHandler("removeObject",function() 
    showCursor(true) 
    outputDebugString("now you could click") 
    addEventHandler("onClientClick", root, clickRemoveObject) 
end) 
  
function clickRemoveObject(button, state, x, y) 
    outputDebugString("Started") 
    local cx,cy,cz = getCameraMatrix() 
    wx, wy, wz = getWorldFromScreenPosition(x,y, 1000) 
    hit,hitX, hitY, hitZ,hitElement,normalX, normalY, normalZ,material,lighting,piece,worldModelID,wpX,wpY,wpZ,wrX,wrY,wrZ = processLineOfSight(cx,cy,cz,wx,wy,wz, true, false ,false, false, true, true, true, true, nil, true ) 
    removeWorldModel ( worldModelID, 50, wpX, wpY, wpZ ) 
    setCameraMatrix( wpX, wpY, wpZ + 500 ) 
    setTimer(setCameraTarget, 100, 1,localPlayer) 
    outputDebugString("Stoped") 
end 

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...