Problem with flashlight in VS 5?

  • #1, by steve-1Saturday, 30. March 2019, 17:15 11 months 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)))
    1
    2
    3
    4
    5
    6
    7
    8
    9

    (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-1Monday, 01. April 2019, 17:12 11 months 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 11 months 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')
    1

    Any help is appreciated ^_^

    Newbie

    20 Posts

  • #4, by afrlmeMonday, 01. April 2019, 20:54 11 months 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)
    1
    2
    3

    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

    6662 Posts

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

    Newbie

    10 Posts

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

    Imperator

    6662 Posts

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

    Newbie

    10 Posts

  • #8, by afrlmeMonday, 10. February, 11:12 2 weeks 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

    6662 Posts

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

    Newbie

    10 Posts

  • #10, by afrlmeTuesday, 11. February, 11:39 2 weeks 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)
    1
    2
    3

    Imperator

    6662 Posts

Write post