Jump to content

setCameraMatrix Dimension problem


BennyBunny

Recommended Posts

I have a little script when the player die he see for 10 sec the spawn place.

That work good when the player die in the normal dimension.

The problem is when the player die in a other one he see nothing no objects...

function deathHandler( ) 
    local zufalldeath = math.random(1, 4) 
    local zufallskin = math.random(7, 288) 
    setElementDimension ( source, 0 ) -- that was my test for get the dimension back to 0 but nothing  
    fadeCamera ( source, true, 5 ) 
    setCameraMatrix ( source, -2148.55859375, 2326.0148925781, 25.234376907349, -2225.376953125, 2325.0148925781, 23.234376907349, 0, 0 ) 
... 
end 
addEventHandler("onPlayerWasted", getRootElement(), deathHandler) 
  

in the middle i have only the spawn things and read my db for add some things nothing special.

So how can i get the normal dimension back when the player die so that the CameraMatrix have the right dimension??

Link to comment

Timer the rest of your script. I'm not sure for this one, but some functions have a little little delay and causes upcoming functions to not work properly. So set the dimension to 0, create a once running timer and let the timer execute your upcoming stuff.

  
function deathHandler( ) 
    local zufalldeath = math.random(1, 4) 
    local zufallskin = math.random(7, 288) 
    setElementDimension ( source, 0 ) -- that was my test for get the dimension back to 0 but nothing 
    setTimer ( function ( ) 
        fadeCamera ( source, true, 5 ) 
        setCameraMatrix ( source, -2148.55859375, 2326.0148925781, 25.234376907349, -2225.376953125, 2325.0148925781, 23.234376907349, 0, 0 ) 
        -- The rest (...) goes here then 
    end, 50, 0 ) -- just a mini delay, you shouldn't even notice this. Note that 50 ms is the minimum to pass. 
end 
addEventHandler("onPlayerWasted", getRootElement(), deathHandler) 
  

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