KeyNotFoundException when creating new airstrike power

Information and discussion for custom maps and mods.
Post Reply
UberWaffe
Posts: 4
Joined: Fri Nov 23, 2012 8:49 am
Location: Orbiting reality at +3 irrationalities

KeyNotFoundException when creating new airstrike power

Post by UberWaffe »

I'm trying to recreate the spy-plane dropping a parabomb nuke from one of the red alert aftermath missions.
So I copied and mutilated the airstrike power, U2 plane and mininuke weapon.
But I keep getting a KeyNotFoundException whenever I try and use the airstrike.

Exception and code information can be found at: http://pastebin.com/iTVgZN1s

Any help at spotting what exactly is causing the error would be appreciated.


EDIT:
Never mind, I found my problem.

I was under the impression than the period in UBERU2.paranuke was trivial (i.e. simply part of the name with no special parsing attached), but I was wrong. Once I defined UBERU2 it worked without a hitch.


EDIT2:
After playing around with the period syntax some more, I realised I don't actually understand what it does. (Surprise, surprise.)

I though it does the same as "Inherits:", but that doesn't appear to be the case.
I failed to find an explanation of it on the Github Wiki.

Could anyone explain to me what the function of a period in a unit/structure actor is?
Ex: BADR.bomber:
Also, what is the function of the ^ in front of the actor name in the defaults.yaml?
Ex: ^Vehicle:

Phrohdoh
Posts: 28
Joined: Wed Apr 09, 2014 2:30 am
Location: Dallas, TX

Post by Phrohdoh »

^Vehicle:
Is basically a template. Anything that Inherits: ^Vehicles gets those traits with the defined values.

This works the same as one actor inheriting another, but the engine doesn't create an actor/unit for any definition starting with ^.

The dot syntax is just for readability.
You could name something MyUnit.GDIVersion.AntiAir and it wouldn't change the unit at all.
Actor names are all parsed as raw strings so the entire name is "MyUnit.GDIVersion.AntiAir".

You still have to give it the values you want it to have, but it is much easier to reference the correct "version" of a unit this way.

UberWaffe
Posts: 4
Joined: Fri Nov 23, 2012 8:49 am
Location: Orbiting reality at +3 irrationalities

Post by UberWaffe »

Phrohdoh wrote: This works the same as one actor inheriting another, but the engine doesn't create an actor/unit for any definition starting with ^.
Ah, okay. Thanks.

Phrohdoh wrote: The dot syntax is just for readability.
Yeah, that is what I had initially assumed, but then I kept getting the KeyNotFoundException error until I had also defined UBERU2. So that confused me.

Retesting by deleting UBERU2 again shows the error is no longer occurring, so it must have been something else.

Post Reply