Zufallsanimationen Zeiteinstellungen | Random Animations Set Time

  • #1, by irinahuw_Thursday, 10. May 2018, 11:39 2 years ago
    hallo!

    ich habe das forum bereits zu diesem thema durchsucht, aber alle beiträge
    sind zwischen 3-5 jahre alt... vielleicht gibt es mittlerweile ja eine einfache/andere lösung dazu.

    ich möchte die zeit einzustellen, wann eine random animation abgespielt werden soll.
    im moment dauert es automatisch ca. 20-30 sekunden bis die random animation abgespielt wird. das finde ich zu lange.

    liebe grüsse

    irina

    hello!

    i would like to shorten the time for displaying random animations for my characters.
    is there an easy way to do so? at the moment it is approx. 20-30 seconds by default, which i find too long.

    kind regards

    irina

    Newbie

    49 Posts


  • #2, by afrlmeThursday, 10. May 2018, 12:15 2 years ago
    Quick note: the data structure fields for changing the random animation min & max times are not actually scriptable which means that even though you can change them, the updated values won't get stored in the save game files.

    I also use custom random animation times too, so what I did was create a script in the script section of the editor & wrote a small loop to listen out for scene changes, if the scene changes then it updates the random animation min & max data structure fields - with this we can skirt around the issue of the times not being stored in save game files.
    local scn = nil

    function scene_change()
     if not game.CurrentScene:isEmpty() and game.CurrentScene:getName() ~= scn then
      scn = game.CurrentScene:getName()
      game.CurrentCharacter.CharacterCurrentOutfit.OutfitRandomMinTime = 10000
      game.CurrentCharacter.CharacterCurrentOutfit.OutfitRandomMaxTime = 20000
     end
    end

    registerEventHandler("mainLoop", "scene_change")
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    time values are in milliseconds.

    Imperator

    6771 Posts

  • #3, by sebastianThursday, 10. May 2018, 12:41 2 years ago
    Hello,

    you can overwrite the RandomMinTime and RandomMaxTime values in the outfit via lua, but these dont get saved in the save files, so you may need to change them in the first frame of a started random animation:

    Characters["charname"].CurrentOutfit.RandomMaxTime = XXX (integer)
    Characters["charname].CurrentOutfit.RandomMinTime = XXX (integer)

    Edit: Damn, should go to lunch while posting xD

    Thread Captain

    2331 Posts

  • #4, by afrlmeThursday, 10. May 2018, 13:29 2 years ago
    Hello,

    you can overwrite the RandomMinTime and RandomMaxTime values in the outfit via lua, but these dont get saved in the save files, so you may need to change them in the first frame of a started random animation:

    Characters["charname"].CurrentOutfit.RandomMaxTime = XXX (integer)
    Characters["charname].CurrentOutfit.RandomMinTime = XXX (integer)

    Edit: Damn, should go to lunch while posting xD
    Your method is valid too. Mine is a bit more global, but the less system intensive method would probably be to add the random min/max time changes into the first frame of each & every random animation - like you said. In our case, we have quite a lot of random animations so I used my method to save some time.

    Imperator

    6771 Posts

  • #5, by irinahuw_Friday, 11. May 2018, 09:19 2 years ago
    Thank you @AFRLme & Sebastian for your workaround tips!
    I tried it with AFRLme's Script, inserted it into the script section and saved it there under "randomanimation" and unchecked the box "definitions skript". but now i don't know what to do, because it does not seem to work. do i have to do some additional things? (i am not familiar with scripts)

    thank you for your help!

    Newbie

    49 Posts

  • #6, by sebastianFriday, 11. May 2018, 10:32 2 years ago
    it has to be a definition script 

    Thread Captain

    2331 Posts

  • #7, by irinahuw_Friday, 11. May 2018, 13:45 2 years ago
    it has to be a definition script 

    tank you! i tried to run it with checked & unchecked definition script before writing, and now i found out that the alignment of the random animations somehow was wrong and therefore wouldn't play. a mix of everything (as always) made it not work :|

    but now it works fine, thank you guys a lot!

    Newbie

    49 Posts

Write post