[base_unit]

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

[base_unit]

Post by AI »

I've decided to use [base_unit] to re-use animations, but I have a few questions (and problems) about how it works.

my new Peasant Magician: http://pastebin.com/f415f0b13
stock 1.3.16 Peasant: http://pastebin.com/f785e8876

Problem:
-Though the [attack_anim]'s filters are quite specific, in-game, the missile attack's animation consists of both a magic missile flying at the target, and a pitchfork flying below it....

Questions:
-How does the game interpret what to replace and what to add? Are the original attacks just ignored? (that's how it seems to work)
-Is the idle animation inherited? I haven't seen it yet.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [base_unit]

Post by zookeeper »

AI wrote:Problem:
-Though the [attack_anim]'s filters are quite specific, in-game, the missile attack's animation consists of both a magic missile flying at the target, and a pitchfork flying below it....
Use an image=misc/blank-hex.png in the [missile_frame] to overwrite any other image= it might otherwise get, either by default or from the inheritance.

I don't know the details of how the inheritance works exactly for animations. Regardless, I think using [base_unit] in this case seems a bit funny since the unit is pretty different from the base and because you're actually not using the inheritance feature a lot (you define a lot of things that are identical to how they appear in the peasant...).
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Post by AI »

I know, all I did so far was cut out the animations (since they change a lot)

The reason I didn't delete much more is because I wasn't sure how much'd be inherited.

for example:
Peasant has melee pitchfork and ranged pitchfork
Peasant magician using base_unit has melee pitchfork and ranged missile
the resulting unit has melee pitchfork and ranged missile

does this mean that
-a new ranged attack replaces old ranged attacks
-any new attack definitions replace all previous ones
-attacks aren't inherited in the first place

as you can see the inheritance system isn't very clear and the wiki doesn't say much either.
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Post by AI »

your suggestion didn't work, the pitchfork is still there...
it looks like it's using both animations at the same time (or throwing them together somehow), despite the fact that the pitchfork filter does not match the new attack.
maybe the attacks are merged too?
megane
Art Contributor
Posts: 410
Joined: October 30th, 2006, 4:55 am
Location: The Big Ö (a.k.a. Austria)

Post by megane »

AIAIK, when you inherit from a base_unit, it essentially copies that unit's cfg file, then overwrites each thing you specify in the new one. So if the base has, say, resistances of 10 to blade and 30 to impact, and you specify only impact=50, you'll get a unit with 10 blade and 50 impact resist. For attacks, I believe it overwrites them in order, and if you want to add a new one you have to add empty [attack] tags to tell it not to mess with the preexisting ones.
that little girl's parents were attacked by ninjas - generic npc
hee hee! - little girl
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Post by AI »

That explains why the attacks work they way I want them to, but it doesn't explain the animations.
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

The inheritance works the same for the animation tags as for any other. You need to count the animations frames, and use empty tags to copy them directly, or use invalid keys to invalidate them.

Really, this kind of copying gets messy - when the original unit changes, all your animation hacking is going to do strange things, too. :?
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Post by AI »

I know, in my case the problem was that the images had changed, messing up the original animation.
Post Reply