Blinking

  • #1, by zurikTuesday, 14. May, 10:05 2 months ago
    Hey, how do I add blinking (or similar: for example looking around) animations without using Lua? I am guessing I have to input a blinking frame to Random animations folder in the Outfits menu for the NPC character? What next?  
    Thanks

    Newbie

    34 Posts


  • #2, by sebastianTuesday, 14. May, 11:05 2 months ago
    thats it. These random animations gdt played from time to time randomly

    Thread Captain

    2315 Posts

  • #3, by zurikTuesday, 14. May, 11:59 2 months ago
    Cool. Can I adjust how often the random animations should play? 

    Newbie

    34 Posts

  • #4, by AFRLmeTuesday, 14. May, 12:20 2 months ago
    Cool. Can I adjust how often the random animations should play? 

    Yes, with Lua - haha grin
    Characters["Tom"].Outfits["default"].RandomMinTime = 1000
    Characters["Tom"].Outfits["default"].RandomMaxTime = 3000
    1
    2

    Now, you need to take into account that you need to do this for every character/characters outfit that you want to change the min/max random animation time for.

    here's a tutorial I created a while back for adding dynamic blinking to characters - I think I've refined it since then, but it's still valid.

    Imperator

    6573 Posts

  • #5, by zurikWednesday, 15. May, 10:00 2 months ago
    Thanks. 
    Sorry, I am not very experienced with Lua grin
    Outfits["Unnamed"], but where/how do I define which animation's RandomMixTime I am adjusting?   

    Characters["Tom"].Outfits["default"]. ----  here?-----.RandomMinTime = 1000

    Newbie

    34 Posts

  • #6, by AFRLmeWednesday, 15. May, 11:54 2 months ago
    Random animation min/max time is global for the outfit, you can't specify which random animation it should play, hence why it would probably be better to use the method in my tutorial that I linked, if you want something more consistent.

    Imperator

    6573 Posts

  • #7, by zurikSunday, 19. May, 09:26 2 months ago
    Thanks. I managed to add a random blinking for my character with your code, but even though I adjust random value to "as often as possible", he blinks very rare.

    Is there any difference where I put the animation, when it's controlled by Lua anyways?

    Newbie

    34 Posts

  • #8, by AFRLmeSunday, 19. May, 11:56 2 months ago
    For me, I inserted the animation into the idle animations because the character breathes & I didn't want the blink animation interrupt that, but you are correct, it can be added as an animation under character animations, but you need to call the correct one based on direction the character is facing - that was another thing that blending my idle animations with blink animations took care of.

    Imperator

    6573 Posts

  • #9, by zurikMonday, 20. May, 13:29 2 months ago
    I must say this is not very easy to understand grin But I am trying.
    So if I put the blinking in the Standing Animations with  a random timing variable, can I do it like this and write this code in the first script?

    if math.random(20) < 15 then
     ActiveAnimations["front1"].AnimationLastFrame = 1
    else
     ActiveAnimations["front1"].AnimationLastFrame = 5
    end


    Newbie

    34 Posts

  • #10, by AFRLmeMonday, 20. May, 18:34 2 months ago
    Hmm... if you are not planning on using more than 1 frame for idle animations then controlling the global pause value would be better. My tutorial was intended for idle animations that contain multiple animation frames. It works by querying a random number generated by math.random & then uses that query to determine if it should display the animation up to whatever the default idle animation frame total number should be, or it displays the entire animation including the blink animation.

    It won't work very well with a single frame because it's looping & querying every single frame.

    As I was saying, if you plan on using a single frame, then it would be better to change the global pause value between frames instead - taking into account that you need to edit the next frame & set the global pause between frame back to the default number it's supposed to be.

    Animations["example"].AnimationPause = math.random(60, 3000)
    1

    so what we are doing in the code example above is setting the global pause between animation frames to a random number between 60ms & 3000ms. The smallest value should be whatever the default pause value is that you set - unless you always want a larger delay.

    Imperator

    6573 Posts

Write post