Any way to add a ressource to a plot througha lua call?

skodkim

Deity
Joined
Jan 16, 2004
Messages
2,497
Location
Denmark
Hi

I'm a newbie with lua and was messing around with small random events scripts. Doing that I thought it would be nice with a random event where resources could "spawn" e.g. wheat on irrigated plots.

I know how to make a lua call adding a feature to a plot, like below, but is there a call similar to plot:SetFeatureType that can be used to add resources?

plot:SetFeatureType( GameInfo.Features[ "FEATURE_###" ].ID );

Thanks in advance!

\Skodkim
 
Yes, there's a SetResourceType function in the same table. If you want to see the syntax for it, just go into the map generator scripts (specifically AssignStartingPlots) to see how it's used.

I've done this in my own mod; I've got a "Deep Mining" action that spontaneously creates a deposit of a randomly-selected mineral resource. It works just fine.
 
Back
Top Bottom