Machiavelli24
Mod creator
- Joined
- May 9, 2012
- Messages
- 818
It depends on the yield but for the ones you listed yes.I tried to replace gold with food, culture, science, didn't worked. Do I have to use different words or a totally different code is needed to add those yield ?
Culture
Use "player:ChangeJONSCulture(int change)" because Culture is a pseudo yield that doesn't always behave like other yields. Culture granted this way will not contribute to any city's border expanding.
Food
Food can not be given on the "player level". Food only exists on the "city level". You'll need to get the city object and use "city:ChangeFood(int change)".
Science
This one is tricky since techs don't exist at the "player level" they exists at the "team level". You'll need to get the Team the player is on, than the tech their team is currently researching. Once you have that you'll use "teamTech:ChangeResearchProgress(TechType index, int change, PlayerID player)".
---------------------------------
You can certainly construct something similar, I am just unsure what structure you intend the table to have and what you intend the columns to mean.Looking at your previous works I noticed that you create a table where modders can insert their data (so they don't need to touch the lua code).
If the next paragraphs are confusing, don't worry about it.I don't know if there are any other differences between inserting data in lua or using sql/xml (I usually prefer SQL over xml) and if there are not any major differences...
SQL and XML are use to populate a database of "constants" (things that won't change over the course of a game). XML gets automatically parsed into SQL but there are things SQL can do that can't be done in XML. Thus, if you are more comfortable with SQL than feel free to use it 100% of the time over XML.
LUA isn't generally used to insert data. While XML and SQL are two different ways to do the same thing, LUA is something different.