Problem with flashlight in VS 5?

  • #1, by steve-12Saturday, 30. March 2019, 17:15 5 years ago
    Hello everyone,

    i've read all the examples on flashlight here in the forum and I've tried all the solutions. Nothing works with 5.0.9 and the latest script (LINK). The beam is in the middle of the scene and follows neither the mouse nor the character. 

    Debugerror: attempt to call a nil value (global 'point')

    Based on the information here and the reference documentation I can not understand what has changed since VS 4 and how I have to adapt the script:
    shaderActivateLighting(2)
    
    
    
    shaderLamp(0, 0, {900,500,1}, {0,900,10}, {0.001,0.000001,0}, {0,0,0}, {1,1,1}, 1, 90, 0)
    
    shaderLamp(1, 1, {1000,50,1}, {0,0,1}, {0.01,0.0,0.00001}, {0,0,0}, {1,1,1}, 1)
    
    
    
    bind("light1", "lights[0].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 1))
    
    bind("light1", "lights[0].targetpos", point(inverty(cursor), 10))
    
    bind("light1", "lights[1].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 
    
        factor(dist(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200})), cursor), 10)))

    (Code from the step-by-step solution here -> LINK)

    So far, I've found out everything I need for my little game, but now I'm stuck.

    Can somebody help me to find a solution, please?

    Newbie

    2 Posts


  • #2, by steve-12Monday, 01. April 2019, 17:12 5 years ago
    I'm still experimenting with shaderlamp ... At the moment it seems generally not possible to connect shaders to a fixed position in the scene or an object / character. 

    The screen size of my game is 1920x1080 and the scene is almost twice as big. If I want to place the beam of a lamp, the light moves along when scrolling. That means the beam stays in the same place on the screen but my scene with the lamp moves away from it.

    Can I use this shader for such purposes at all (lamps, sunlight, flashlights, ...)?

    Newbie

    2 Posts

  • #3, by marco-roncoMonday, 01. April 2019, 18:25 5 years ago
    Ciao smile 
    I've the same problem.
    I used the latest version of the ShaderToolkit script listed here:
    https://www.visionaire-studio.com/luadocs/downloads/shadersc...

    The same results happens with the ShaderToolkit listed here:
    https://wiki.visionaire-tracker.net/wiki/Shader_%28CMS%29

    The Debugger prints the same error
    Debugerror: attempt to call a nil value (global 'point')

    Any help is appreciated ^_^

    Newbie

    22 Posts

  • #4, by afrlmeMonday, 01. April 2019, 20:54 5 years ago
    Here are the parameters broken down...

    index
    type - 0 spot light, 1 point light
    position - {x,y,z} position
    targetpos - {x,y,z} target position (spot light only)
    falloff - {constant, linear, quadratic}
    ambient - {r,g,b} color that is added
    diffuse - {r,g,b} color multiplied with texture
    diffusefactor - factor for increasing diffuse
    exponent - spotlight exponent (higher more narrow)
    cutoff - spotlight cutoff (is a hard line)

    I asked Simon for them a little while ago.

    This is one I was messing about with recently-ish...
    
    shaderActivateLighting(1)
    
    shaderLamp(0, 0, {pos.x + 90,pos.y + 220,1}, {pos.x + 100,400,1}, {0.003, 0.000003,0}, {0,0,0}, {1,1,1}, 1, (0.1 * Values["m001_shader_intensity"].Int) + 3, 0)

    It's a fixed light, that I attached to a lightbulb. I used a value to adjust the intensity of the light. Also you need to take z-index into account as that also determines how bright/dim the light will be.

    Imperator

    7278 Posts

  • #5, by genaticstudioSunday, 09. February 2020, 13:32 4 years ago
    How can I fix the functionflashlight  on VS5 ? 
    The result is a black screen.

    Newbie

    20 Posts

  • #6, by afrlmeSunday, 09. February 2020, 13:44 4 years ago
    Are you using the latest version of the shader toolkit script?

    Imperator

    7278 Posts

  • #7, by genaticstudioMonday, 10. February 2020, 08:52 4 years ago
    Yes. I use latest version  .
    I wonder if because I don't have  "m001_shader_intensity"   
    Where to find or do?

    Newbie

    20 Posts

  • #8, by afrlmeMonday, 10. February 2020, 11:12 4 years ago
    Ah that's a value someone created - as in an actual value someone created somewhere inside of the visionaire editor, named it that, & then linked that value there. Where did you get that example from?

    Imperator

    7278 Posts

  • #9, by genaticstudioTuesday, 11. February 2020, 05:58 4 years ago
    I received a sample from your post above(Post#4). 

    Newbie

    20 Posts

  • #10, by afrlmeTuesday, 11. February 2020, 11:39 4 years ago
    ah, just replace that with an actual number. I was using a value to change the value dynamically inside of a looping action block or something - I forget.

    shaderActivateLighting(1)
    
    
    
    shaderLamp(0, 0, {pos.x + 90,pos.y + 220,1}, {pos.x + 100,400,1}, {0.003, 0.000003,0}, {0,0,0}, {1,1,1}, 1, 1, 0)

    Imperator

    7278 Posts

  • #11, by patrikFriday, 01. May 2020, 15:37 4 years ago
    Guys, do you someone have an answer for this problem?

    I also used flashlight script:

    shaderActivateLighting(1)
    
    shaderLamp(0, 0, {pos.x + 90,pos.y + 220,1}, {pos.x + 100,400,1}, {0.003, 0.000003,0}, {0,0,0}, {1,1,1}, 1, 1, 0)
    

    But I received just black screen.
    I am using the latest version of shader toolkit script.

    I would like to create light circle which is bind to a character. Can somebody help me please?

    Newbie

    3 Posts