Flashlight around the character circle style

  • #1, z nikos papaWednesday, 12. April 2017, 12:53 hodinky 8 years ago
    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)))
    I saw this code which have both of them. How can I make it only show the curcle without hovering on character?
    Also if possible exlpain me how we make shader follow character.

    Bažant

    25 Posts


  • #2, z afrlmeWednesday, 12. April 2017, 13:03 hodinky 8 years ago
    Maybe this will be of some use? http://www.visionaire-studio.net/forum/thread/adding-scripts...

    In the script you've listed you will notice there are some bits containing game.CurrentCharacter.Position. These are binding the specified shader/light to the character.

    Maybe SimonS can provide you with a shader example of a circle spotlight assigned to the characters position. I'm not very savvy with GLSL programming myself.

    Imperátor

    7285 Posts

  • #3, z nikos papaWednesday, 12. April 2017, 13:25 hodinky 8 years ago
    This is the same thing.
    How we make shader follow char. I think I made it but there is any tutorial for shaderLamp?

    Bažant

    25 Posts

  • #4, z afrlmeWednesday, 12. April 2017, 13:49 hodinky 8 years ago
    This is the same thing.
    How we make shader follow char. I think I made it but there is any tutorial for shaderLamp?
    I think it's basically the same thing as the script you shared except instead of 2 different lights you will be using 1 light. Does that script you shared work ok? I'm pretty sure I recall Simon mentioning that shader binding method had changed at some point.

    If Simon doesn't see & reply to this post sometime over the next few days then I'll ask him on Skype - if I remember.

    Imperátor

    7285 Posts

  • #5, z nikos papaWednesday, 12. April 2017, 14:02 hodinky 8 years ago
    shaderActivateLighting(2)
    shaderLamp(1, 1, {1,1,10}, {0,0,0}, {0.1,0.000001,0.00000001}, {0,0,0}, {1,1,1}, 1, 1, 0)
    bind("light1", "lights[1].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{50,-50}))), 1))

    This one works. Like I want it to work. But it has dot inside and follows only right place

    Bažant

    25 Posts

  • #6, z afrlmeWednesday, 12. April 2017, 14:26 hodinky 8 years ago
    What do you mean by "follows only right place"? As for the dot, I think that's probably something to do with the strength parameter inside of the script you've used. I'm pretty sure it can be adjusted to make it softer. Or maybe you could offset the z-index so it's drawn behind the character somehow - I don't remember what any of the parameters are for off the top of my head; it's been at least a year or more since I messed around with shader lights. Sorry.

    Imperátor

    7285 Posts

  • #7, z nikos papaWednesday, 12. April 2017, 14:34 hodinky 8 years ago
    Alright, so thank you for all the help, i just have 1 small last question and im sure than you can help me out! ^^

    So, i have the shaderlamp binded to my current character, is there anyway to bind the shaderlamp to a gameobject? So my goal is to make a "lantern' for my character. and that the shader follows the lantern, is there a way to do it ? 
    thank you in advance

    Bažant

    25 Posts

  • #8, z afrlmeWednesday, 12. April 2017, 15:06 hodinky 8 years ago
    Alright, so thank you for all the help, i just have 1 small last question and im sure than you can help me out! ^^

    So, i have the shaderlamp binded to my current character, is there anyway to bind the shaderlamp to a gameobject? So my goal is to make a "lantern' for my character. and that the shader follows the lantern, is there a way to do it ? 
    thank you in advance

    You should be able to offset the position of the shaderlamp from the characters position, but I guess you would need a loop or something to detect when the character changes direction so that the offset can be adjusted.

    What is the {50, -50} bit in your script next to game.CurrentCharacter.Position for?

    Imperátor

    7285 Posts

  • #9, z nikos papaWednesday, 12. April 2017, 16:01 hodinky 8 years ago
    I've made it. I have another problem now. How we make mouse showing everywhere?. I mean show it into black screen

    Bažant

    25 Posts

  • #10, z afrlmeWednesday, 12. April 2017, 16:42 hodinky 8 years ago
    I've made it. I have another problem now. How we make mouse showing everywhere?. I mean show it into black screen

    You mean it's hidden because of the shader?

    Create a definition type script in the script section & include this line into it...
    game.ShaderExclude = eShaderExcludeInterfaces

    This will prevent text, cursors & interfaces from being affected by the shader. wink

    Imperátor

    7285 Posts

  • #11, z nikos papaWednesday, 12. April 2017, 17:03 hodinky 8 years ago
    I've made it. I have another problem now. How we make mouse showing everywhere?. I mean show it into black screen

    You mean it's hidden because of the shader?

    Create a definition type script in the script section & include this line into it...
    game.ShaderExclude = eShaderExcludeInterfaces

    This will prevent text, cursors & interfaces from being affected by the shader. wink
    Awesome grin Thank you!!!
    What about dialogs? How can we change the color on hover (active).
    If is off topic I'll create a new one for asking that?

    Bažant

    25 Posts