Chasing character interaction.

  • #10, by ke4Tuesday, 15. September 2015, 11:10 9 years ago
    Don't need a function for that i will have only one chasing character.
    I was using what i found in the wiki not sure if there is more info about shorthands somewhere. It's working like that.

    local c = Characters["kolegaNormal"].Position
    
    if game.CurrentCharacter.Position.x >= c.x then
     game.CurrentCharacter.Destination = { x = (c.x + 150), y = c.y }
    else
     game.CurrentCharacter.Destination = { x = (c.x - 150), y = c.y }
    end
    

    Key Killer

    810 Posts


  • #11, by afrlmeTuesday, 15. September 2015, 11:24 9 years ago
    Ok dokie. smile

    No there is not any actual information about shorthand Lua script & VisObject access. To be honest, I have no idea how I would even begin to document it as it's not set in stone & you can try various possibilities of accessing / setting something...

    game.CurrentCharacter.Destination -- or
    game.CurrentCharacter.CharacterDestination
    

    Sometimes you can really shorten the paths like in the first example line above & other times you have to type out the full table / field name or it won't work. A good example of a table where you have to type the paths out in full is the active animation table...

    ActiveAnimations["test"].AnimationLastFrame
    ActiveAnimations["test"].AnimationCurrentPosition
    -- etc...
    

    Imperator

    7278 Posts

  • #12, by ke4Tuesday, 15. September 2015, 11:31 9 years ago
    Ok so it's just about trying what works in the current situation, anyway the final script is much cleaner than the first one so thanks.

    Key Killer

    810 Posts

  • #13, by afrlmeTuesday, 15. September 2015, 12:11 9 years ago
    Exactly! & no problem. wink

    Imperator

    7278 Posts