Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

If CHARACTER is ALIGNED Function

  • #1, by Pyke 12 years ago Zitieren
    Hey guys,

    I would love to have an 'If CHARACTER is ALIGNED' action part so that I could call certain actions if the character is facing a certain direction.

    I can think of hundreds of uses for this, from puzzles to just adding in little character details!

    -Chris
  • #2, by kokalo 12 years ago Zitieren
    Hi there,

    You can access the direction of the character using LUA with something like game:getLink(VGameCurrentCharacter):getInt(VCharacterDirection).

    You could then create a value in your character and have a main loop function update the value.

    Im just starting to use VS so there are probably more/better ways to do it.

  • #3, by Alex 12 years ago Zitieren
    Hi Chris,

    you're right - an action part would be useful for this. I'll add it after the next release (because it needs more time to test, translate labels, etc.).
  • #4, by Pyke 12 years ago Zitieren
    This is why I love Visionaire - its actually constantly being developed and improved! You guys take all the community suggestions seriously and implement them - and it really shows. The engine works in a production environment, because the features being added are things that developers are actively using!

    I know I'll be using Visionaire for a very VERY long time!

    Now about that 4.1..... grin
  • #5, by Alex 12 years ago Zitieren
    I know I'll be using Visionaire for a very VERY long time!

    good to hear smile

    I've started implementing the action part but I'm already facing a problem: let's say the character walks to the left and a few pixels upwards. Because the character mainly walks to the left the left animation is shown. Internally the character direction is e.g. 172°. How do you want to query this direction? should the character direction be mapped to 180° degrees because the left animation is shown (so you can test for 180° degrees)? this won't work for 3d-models because the character is shown for the exact direction.

    I think the best solution would be to add a range value (or whatever it should be called) to the action part. For example you'd query for 'Is character aligned to 180° (+/- 10°)'. The test would be true if the character direction is between 170 and 190°. Would this be ok?
  • #6, by Pyke 12 years ago Zitieren
    The script I'm currently using uses a range and it works perfectly.

    if dir >= 0 and dir <= 44 then
    startAnimation("Characters[" .. char:getName() .. "].CharacterOutfits[" .. outfit ..

  • #7, by afrlme 12 years ago Zitieren
    Couldn't you query the amount of directions the character has & then you divide 360 by the amount of directions to get the range & then you add the range values to a table.

    i.e: character has 8 directions which means that the range is 45º per angle & right (east) starts on 0º, so...
    t[1] = {rs = 0, re = (t[1].rs + (range - 1))}
    t[2] = {rs = (t[1].rs + range), re = (t[2].rs + (range - 1))}
    etc...
    

    I'm not sure how you would implement it in c++, but I think it could work as long as you query if it's the initial table entry, inbetween entries or the last entry so that you can adapt the code as needed.
  • #8, by Alex 12 years ago Zitieren
    as mentioned above this doesn't work for 3d models. I think it makes more sense if the action part works for all characters. therefor I'd add a range value to the action part, either as range from-to or range +/-, e.g.

    if character is aligned between 20° and 30° then
    ...
    if character is aligned to 25° (+/- 5°) then
    ...
    I guess both 'formats' have its advantages/disadvantages (depending on the use case) but both should be easily usable. So I assume it doesn't matter that much which one I'll implement (unless someone of you complains wink ).
  • #9, by afrlme 12 years ago Zitieren
    Aye I guess your method makes more sense. I mis-read what you wrote. smile