Random animations during 'chase'

  • #10, by afrlmeThursday, 07. May 2015, 11:40 10 years ago
    Yes, yes... heard that all before. roll

    What I'm more interested in knowing is: does the wee duck have a sharp pointy beak, or maybe some sharp pointy teeth hidden under that beak? grin

    Imperator

    7285 Posts


  • #11, by JoemcrThursday, 07. May 2015, 14:52 10 years ago
    The duck is entirely placid, and 100% irrelevant to story and puzzles smile

    Newbie

    96 Posts

  • #12, by afrlmeThursday, 07. May 2015, 15:00 10 years ago
    But I want to see a cute fluffy thing that turns into a ravenous demon - in the true sense of Monty P. wink

    Still, I guess even a wee duck chasing you round every screen for no apparent reason at all is a crazy enough idea all on its own.

    Imperator

    7285 Posts

  • #13, by JoemcrThursday, 07. May 2015, 15:42 10 years ago
    just for you...

    Newbie

    96 Posts

  • #14, by afrlmeThursday, 07. May 2015, 16:06 10 years ago
    Ai sus! Very good fandango! grin

    What are some of the random animations the duck will be playing while idle? Speaking of random animations it would probably be a good idea to add some kind of counter measure to check if duck is playing a random animation & have it wait until finished before resuming chase if character is already moving, no? I wonder if it's possible, will have to check the data structure.

    * edit: according to data structure it's possible, as you can check animation state of characters which will return an integer value based on idle, talking, character, random animations. - I wonder why walking is not included in the list?


    CharacterAnimState | t_int | Type of currently playing character animation:

    '0': No animation.
    '1': Individual character animation.
    '2': Random animation.
    '3': Talk animation.
    '4': Standing animation.


    here's the final revised script... (no promises that it's the final version mind).
    --[[
    Automated chase character handler (dynamic distance radius) [v4] (07/05/2015)
    Written by AFRLme [Lee Clarke]
    -- + --
    afrlme@outlook.com | skype @ AFRLme
    -- + --
    This script is donation optional. In game credit is non-negotiable.
    You are free to: ¹ use it in your game(s). ² modify the script.
    Do not remove - or edit - this comment block.
    --]]
    
    -- * local variables * --
    local distance = 250 -- radius from current character in pixels @ 100%
    local chaser = Characters["duck"]
    local temp_distance -- empty (will be used to calculate new distance based on current characters scale value)
    
    -- * function that is used to start & stop character chasing * --
    function quackers()
     if game.CurrentCharacter.CharacterState == 3 and chaser.CharacterFollowCharacter ~= game.CurrentCharacter and chaser.CharacterAnimState ~= 2 then
      if ActiveActions["end_chase"] ~= nil then stopAction(ActiveActions["end_chase"]) end
      chaser.CharacterFollowCharacter = game.CurrentCharacter; chaser.CharacterFollowReachDistance = 0
      elseif game.CurrentCharacter.CharacterState ~= 3 and not chaser.CharacterFollowCharacter:isEmpty() then
      temp_distance = math.floor( (chaser.CharacterSize / 100) * distance)
      chaser.CharacterFollowReachDistance = temp_distance; startAction("Actions[end_chase]")
     end
    end
    
    registerEventHandler("mainLoop", "quackers") -- turns quackers function into a looping function
    


    Please let me know if this works. It should automatically wait until idle animations have finished playing, so it might be an idea to only set your idle animations to play a limited amount of loops.

    Imperator

    7285 Posts

  • #15, by JoemcrThursday, 07. May 2015, 16:32 10 years ago
    Ah, don't seem to be able to get gif working... you can see the animations here... http://projectnonamegame.blogspot.co.uk/2015/05/william-bill...

    Newbie

    96 Posts

  • #16, by JoemcrThursday, 07. May 2015, 16:33 10 years ago
    animations are only very short, so cutting them off in the middle is really not a problem...

    Newbie

    96 Posts

  • #17, by afrlmeThursday, 07. May 2015, 16:58 10 years ago
    well the script should wait until they end, so if they are short then all the better. wink

    Imperator

    7285 Posts

  • #18, by JoemcrTuesday, 14. July 2015, 12:05 10 years ago
    Would it be possible to tweak this again to add a short pause before the chase starts? so both characters don't start moving at the exact same time...

    Newbie

    96 Posts

  • #19, by afrlmeTuesday, 14. July 2015, 14:45 10 years ago
    hmm probably. But you would probably have to start the chase action inside of a called by other action instead, which contains a pause then a chase character action part.

    Sorry, not got the time at the minute to revise the script.

    Imperator

    7285 Posts