Problem placing a new feature with Lua

Tomatekh

Emperor
Joined
Aug 6, 2012
Messages
1,433
So I've run into a problem with the new mod I'm working on. I created a new map feature. It doesn't get generated or placed on the map, but rather I use Lua to put it on a tile after a certain event. The Lua itself works in and of itself, the problem is that it refuses to place the feature.

For example, if I replace my code and tell it to place any existing feature (Forest, Oasis, etc.) it works perfectly fine.

However, if I tell it to place my new feature, instead of placing it, the game always places the Ice feature on the tile instead.

The new feature is being loaded into the game. It appears in the civlopedia and I can place it on the map using don quiche's ingame editor.

Am I missing something?
 
Okay, doing a test, if I put a nonexistent feature in the Lua code

cPlot:SetFeatureType(FeatureTypes.FEATURE_WHATEVER);

It also places ice, so that's what happens if the feature doesn't exist. Except, as I said, the new feature does exist as it shows up in the civlopedia and IGE (and I double checked for any typo errors).

Any ideas?
 
Use GameInfoTypes (GameInfoTypes.FEATURE_WHATEVER) instead of FeatureTypes, and it should work properly :)
 
To add some more informations... All functions and methods in the game whose args are labeled "xxxType" require numeric row ID, you can never provide the type string directly. And GameInfoTypes is the recommended way to get an ID from a type string, even when tables like FeatureTypes exist (because this one is not updated when a mod changes the features table).

I, too, put a lot of ice before I understood that. ;)
 
Back
Top Bottom