Flashlight around the character circle style

  • #1, by nikos papaWednesday, 12. April 2017, 12:53 3 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.

    Newbie

    25 Posts


  • #2, by afrlmeWednesday, 12. April 2017, 13:03 3 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.

    Imperator

    6804 Posts

  • #3, by nikos papaWednesday, 12. April 2017, 13:25 3 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?

    Newbie

    25 Posts

  • #4, by afrlmeWednesday, 12. April 2017, 13:49 3 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.

    Imperator

    6804 Posts

  • #5, by nikos papaWednesday, 12. April 2017, 14:02 3 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

    Newbie

    25 Posts

  • #6, by afrlmeWednesday, 12. April 2017, 14:26 3 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.

    Imperator

    6804 Posts

  • #7, by nikos papaWednesday, 12. April 2017, 14:34 3 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

    Newbie

    25 Posts

  • #8, by afrlmeWednesday, 12. April 2017, 15:06 3 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?

    Imperator

    6804 Posts

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

    Newbie

    25 Posts

  • #10, by afrlmeWednesday, 12. April 2017, 16:42 3 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
    1

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

    Imperator

    6804 Posts

  • #11, by nikos papaWednesday, 12. April 2017, 17:03 3 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
    1

    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?

    Newbie

    25 Posts

Write post