BinderAJ
Chieftain
I created a few weeks ago the "Adaptive Greenhouse" building, play-tested it and works fine, it's quite balanced at the moment, but i'm looking to add a quest to it, so the player can choose between +2 culture or +2 science to the building (same behavior as vivariums).
After some research i found out the quest system is a two part component:
a) 3 XML files with text info the TextInfo_Quest XML, the TextInfo_Traits XML and the PlayerPerks XML, first two contain the descriptions and "lore" about the choices...last one has the yields and effects.
b) a LUA file that contains the code that triggers the quest once you have built the building in your city. Specifically something like "BuildingChoiceTemplateQuest.lua"
Now, i've never dabbled into LUA code...but after checking it looks i can replicate it for a single building.
Is this section of the original LUA file required on my own code?
local QuestScript = hmake CvQuestScript{};
And second, this is the choices for vivariums, which is very similar to what i want to do, all names in "" are references to the XML labels, so changing them should work.
But here comes the tricky question, i know the mod properties window handle the way and sequence all files are loaded onto the game engine, is there any specific order or action i should look for in this case?
regards
AJ
After some research i found out the quest system is a two part component:
a) 3 XML files with text info the TextInfo_Quest XML, the TextInfo_Traits XML and the PlayerPerks XML, first two contain the descriptions and "lore" about the choices...last one has the yields and effects.
b) a LUA file that contains the code that triggers the quest once you have built the building in your city. Specifically something like "BuildingChoiceTemplateQuest.lua"
Now, i've never dabbled into LUA code...but after checking it looks i can replicate it for a single building.
Is this section of the original LUA file required on my own code?
local QuestScript = hmake CvQuestScript{};
----------------------------------------------------
-- Definitions
----------------------------------------------------
hstructure BuildingChoiceStruct
ID : number
Text : string
Epilogue : string
Flavor : number
RewardPerkType : string
end
hstructure BuildingQuestStruct
TitleTextKey : string
BodyTextKey : string
SummaryTextKey : string
ChoiceA : BuildingChoiceStruct
ChoiceB : BuildingChoiceStruct
end
----------------------------------------------------
-- Locals (constants)
----------------------------------------------------
local TRIGGER_CHANCE = 5;
local VARIANT_SUFFIX : string = "_VARIANT_B";
local BUILDING_CHOICES_TABLE = {};
And second, this is the choices for vivariums, which is very similar to what i want to do, all names in "" are references to the XML labels, so changing them should work.
BUILDING_CHOICES_TABLE[GameInfo.Buildings["BUILDING_VIVARIUM"].ID] = hmake BuildingQuestStruct {
TitleTextKey = "TXT_KEY_QUEST_BUILDING_VIVARIUM",
BodyTextKey = "TXT_KEY_QUEST_BUILDING_VIVARIUM_BODY",
SummaryTextKey = "TXT_KEY_QUEST_BUILDING_VIVARIUM_SUMMARY",
ChoiceA = hmake BuildingChoiceStruct {
ID = 1,
Text = "TXT_KEY_QUEST_BUILDING_VIVARIUM_CHOICE_A",
Epilogue = "TXT_KEY_QUEST_BUILDING_VIVARIUM_CHOICE_EPILOGUE_A";
Flavor = GameInfo.Flavors["FLAVOR_SCIENCE"].ID,
RewardPerkType = "PLAYERPERK_VIVARIUMS_SCIENCE_FLAT";
},
ChoiceB = hmake BuildingChoiceStruct {
ID = 2,
Text = "TXT_KEY_QUEST_BUILDING_VIVARIUM_CHOICE_B",
Epilogue = "TXT_KEY_QUEST_BUILDING_VIVARIUM_CHOICE_EPILOGUE_B";
Flavor = GameInfo.Flavors["FLAVOR_GROWTH"].ID,
RewardPerkType = "PLAYERPERK_VIVARIUMS_FOOD_FLAT";
}
}
But here comes the tricky question, i know the mod properties window handle the way and sequence all files are loaded onto the game engine, is there any specific order or action i should look for in this case?
regards
AJ