Random Unit Appearances Issue

Asked by Andre Novellino Gouvêa on 2014-01-23

I am having a problem when trying to give unit types random appearances based on unit variables. For most things, it works fine, but when the unit is walking and its path is blocked, it simply uses the first frame in the still animation, regardless of the setup of the animation. Is there a way to solve this issue?

This is the animation code that I am using:

--
-- Dwarven Scout
--

local ScoutStill = {
 "if-var v.GraphicsVariation.Value == 1 variation_1",
 "if-var v.GraphicsVariation.Value == 2 variation_2",
 "if-var v.GraphicsVariation.Value == 3 variation_3",
 "label variation_1", "frame 0", "goto end",
 "label variation_2", "frame 60", "goto end",
 "label variation_3", "frame 120", "goto end",
 "label end", "wait 4", "random-goto 99 no-rotate", "random-rotate 1", "label no-rotate", "wait 1",}
local ScoutDeath = {"unbreakable begin", "frame 45", "wait 3", "frame 50", "wait 3", "frame 55", "wait 100",
    "frame 55", "unbreakable end", "wait 1",}

DefineAnimations("animations-dwarven-scout", {
  Still = ScoutStill,
  Move = {"unbreakable begin",
    "if-var v.GraphicsVariation.Value == 1 variation_1",
    "if-var v.GraphicsVariation.Value == 2 variation_2",
    "if-var v.GraphicsVariation.Value == 3 variation_3",
    "label variation_1", "frame 0", "move 3", "wait 2", "frame 5", "move 3", "wait 1",
    "frame 5", "move 3", "wait 2", "frame 10", "move 2", "wait 1",
    "frame 10", "move 3", "wait 1", "frame 0", "move 2", "wait 1",
    "frame 0", "move 3", "wait 2", "frame 15", "move 3", "wait 1",
    "frame 15", "move 3", "wait 2", "frame 20", "move 2", "wait 1",
    "frame 20", "move 3", "wait 1", "frame 0", "move 2", "goto end",
    "label variation_2", "frame 60", "move 3", "wait 2", "frame 65", "move 3", "wait 1",
    "frame 65", "move 3", "wait 2", "frame 70", "move 2", "wait 1",
    "frame 70", "move 3", "wait 1", "frame 60", "move 2", "wait 1",
    "frame 60", "move 3", "wait 2", "frame 75", "move 3", "wait 1",
    "frame 75", "move 3", "wait 2", "frame 80", "move 2", "wait 1",
    "frame 80", "move 3", "wait 1", "frame 60", "move 2", "goto end",
    "label variation_3", "frame 120", "move 3", "wait 2", "frame 125", "move 3", "wait 1",
    "frame 125", "move 3", "wait 2", "frame 130", "move 2", "wait 1",
    "frame 130", "move 3", "wait 1", "frame 120", "move 2", "wait 1",
    "frame 120", "move 3", "wait 2", "frame 135", "move 3", "wait 1",
    "frame 135", "move 3", "wait 2", "frame 140", "move 2", "wait 1",
    "frame 140", "move 3", "wait 1", "frame 120", "move 2", "goto end",
    "label end", "unbreakable end", "wait 1",},
  Attack = {"unbreakable begin",
 "if-var v.GraphicsVariation.Value == 1 variation_1",
 "if-var v.GraphicsVariation.Value == 2 variation_2",
 "if-var v.GraphicsVariation.Value == 3 variation_3",
 "label variation_1", "frame 0", "move 3", "wait 2", "frame 5", "move 3", "wait 1",
 "frame 25", "wait 3", "frame 30", "wait 3", "frame 35", "wait 3",
 "frame 40", "attack", "sound throwing-axe", "wait 12",
 "frame 0", "wait 52", "frame 0",
 "label variation_2", "frame 60", "move 3", "wait 2", "frame 65", "move 3", "wait 1",
 "frame 85", "wait 3", "frame 90", "wait 3", "frame 95", "wait 3",
 "frame 100", "attack", "sound throwing-axe", "wait 12",
 "frame 60", "wait 52", "frame 60",
 "label variation_3", "frame 120", "move 3", "wait 2", "frame 125", "move 3", "wait 1",
 "frame 145", "wait 3", "frame 150", "wait 3", "frame 155", "wait 3",
 "frame 160", "attack", "sound throwing-axe", "wait 12",
 "frame 120", "wait 52", "frame 120",
 "label end", "unbreakable end", "wait 1",},
  Death = ScoutDeath,
})

Question information

Language:
English Edit question
Status:
Solved
For:
Stratagus Edit question
Assignee:
No assignee Edit question
Solved by:
Andre Novellino Gouvêa
Solved:
2014-01-24
Last query:
2014-01-24
Last reply:
2014-01-24
cybermind (iddqd-mail) said : #1

Yes. that's a bug. Need to remove StillFrame from CUnit and make engine to calculate it in real-time

Thanks for the explanation, cybermind! Is it possible that this bug will be fixed for the coming version of the engine?

cybermind (iddqd-mail) said : #3

Yes, there is a little work to do

Thanks! :)

cybermind (iddqd-mail) said : #5

Fixed in revision 8862, try it out

Thanks a lot, cybermind!

With DinkyDyeAussie's new windows binaries, I was able to test this out, and it works perfectly! Thanks again, cybermind!