I'm trying to create an anomaly that awards a new type of ship to the player. For that I created the anomaly in my mod folder in a privately named anomaly file. Then I created another privately named file with the structure of "ShipBlueprintDefs.xml". But whatever I put in there, it is apparently not recognized, even if I take the body of an existing blueprint and put it in my definition so that only the name differs. Whenever my survey ships hit my new anomaly nothing gets awarded. If I award one of the existing blueprints, it works though, so my anomaly definition must be correct.
What am I missing here?
For reference here my anomaly definition (don't mind the weight, that's only for test purposes so that the anomaly takes precedence over all other anomaly definitions):
<Anomaly> <InternalName>LCM-Special-4</InternalName> <DisplayName>Some text</DisplayName> <Description>Some description</Description> <ArtDefine>GraveyardAnomalyArt</ArtDefine> <Weight>900</Weight> <EncounterChance>0.5</EncounterChance> <EncounterTriggers> <OnEvent>OnCollideAtAnomaly</OnEvent> <Target> <TargetType>Fleet</TargetType> </Target> <Lifetime>Instant</Lifetime> <PerformAction> <Action>BattleEncounter</Action> <StringParam>PirateEncounter</StringParam> </PerformAction> </EncounterTriggers> <Triggers> <OnEvent>OnArriveAtAnomaly</OnEvent> <Target> <TargetType>Fleet</TargetType> </Target> <Lifetime>Instant</Lifetime> <PerformAction> <Action>AwardShipOfClass</Action> <StringParam>SwarmBlueprint2</StringParam> </PerformAction> </Triggers> <Triggers> <OnEvent>OnArriveAtAnomaly</OnEvent> <Target> <TargetType>Ship</TargetType> <TriggerGroupTargetType>AllShipsInFleet</TriggerGroupTargetType> </Target> <Lifetime>Instant</Lifetime> <Modifier> <EffectType>ExpPoints</EffectType> <BonusType>Flat</BonusType> <Value>5</Value> </Modifier> </Triggers> </Anomaly>
And here my blueprint definition:
<ShipBlueprint> <InternalName>SwarmBlueprint2</InternalName> <ShipHullType>Small</ShipHullType> <Role>Assault</Role> <ShipGroup>Defender</ShipGroup> <CanBeBuilt>false</CanBeBuilt> <RequiredComponentType>MissileWeapon</RequiredComponentType> <RequiredComponentType>MissileWeapon</RequiredComponentType> <ComponentType>BestDefense</ComponentType> <ComponentType>LifeSupport</ComponentType> <ComponentType>MissileWeapon</ComponentType> <ComponentType>MissileWeapon</ComponentType> <ComponentType>BestDefense</ComponentType> <ComponentType>InterstellarDrive</ComponentType> <FillerComponentType>MissileWeapon</FillerComponentType> <FillerComponentType>MissileWeapon</FillerComponentType> <FillerComponentType>BestDefense</FillerComponentType> <FillerComponentType>LifeSupport</FillerComponentType> </ShipBlueprint>
Doesn't each blueprint have to correspond to an entry in ShipClassDefs.xml? But in general, awarding things seems to be finicky.
I did even put an entry for my new blueprints in ShipClassDefs.xml (although not the name of the class, but the name of the blueprint is used by AwardShipOfClass), but it didn't help.
Anomalies award ships that are included in FactionShipStyleSetDefs.xml. Would adding your Ship Class to those lists make it work?
Tried that, still no luck
There must be more to it ... I found the directory "ShipStyleSet" parallel to my Saves directory. Perhaps there must be a file corresponding to my blueprints in there? Where do these files come from, that is how do I generate them? It looks like there are files for every ship of every Steam Workshop faction I downloaded. Whereas I cannot find such files for the default factions of the game ?!?
I don't think you need ShipStyleSet for simply awarding a ship. Those files are compressed. GRM uses a xxx_FactionShipStyleSetDefs.xml and xxx_ ShipClassDefs.xml for each style. They're just in the Mod -> Games folder.
However:
Should work.
I have something similar that is working (not a custom blueprint tho):
<PerformAction> <Action>AwardShipOfClass</Action> <StringParam>RangerLBlueprint</StringParam></PerformAction>
Should work.I have something similar that is working (not a custom blueprint tho):<PerformAction> <Action>AwardShipOfClass</Action> <StringParam>RangerLBlueprint</StringParam></PerformAction>
I did try it again like you described, even with a static blueprint and by putting the original files in the mod folder and altering them there, but still to no avail ...
If I use "spawnbp <blueprint name>" in the console the message is always "no designs of blueprint found".
For what it's worth, I tested these files and they'll spawn your ship at your anomaly (Crusade 2.7.1). Maybe it will give you a starting point.
They go in the usual Mods -> ModName -> Game
For what it's worth, I tested these files and they'll spawn your ship at your anomaly (Crusade 2.7.1). Maybe it will give you a starting point.They go in the usual Mods -> ModName -> Game
Ok, now we both were on the same track, I implemented the same solution as you did and just now finished testing
So, for all that are interested, the steps are:
- Create a new blueprint definition in a file with the structure of ShipBlueprintDefs.xml in the mod folder
- Create a class definition in a file with the structure of ShipClassDefs.xml in the mod folder
- Compile a FactionShipStyleDefs.xml (and keep the name!) of all xxxShipStyleDefs.xml files that you have and put it also in the mod folder
- Add a line <ShipClass>YourNewBlueprintInternalName</ShipClass> in every shipstyle of the compiled FactionShipStyleDefs.xml. If you don't do that for every faction, your ships will only spawn if you play a faction that has the line added.
- Create your "award" anomaly definition in a file with the structure of AnomalyDefs.xml
- Enjoy
Thanks to laws2150 for your help
One addition: if you play with a mod like Gauntlet's Race Mod you have to put the <ShipClass>YourNewBlueprintInternalName</ShipClass> lines also in his xxxShipStyleDefs.xml files or compile those files into your own FactionShipStyleDefs.xml file (and then delete the other files, since I don't know in which order mods are read).
There are many great features available to you once you register, including:
Sign in or Create Account