Ryoga
King
- Joined
- Oct 12, 2010
- Messages
- 993
I have recently successfully managed to change the victory conditions of "Domination" (here is my released mod)
In this thread I'm going to explain how that can be done (relatively) easily and with virtually limitless possibilities.
HOW THE SYSTEM WORK
The interesting part is that there are scripts for each of the five victory conditions in the quest folder and questobjective subfolder.
These scripts are responsible for setting and checking (almost) all the conditions of the default victories.
However their only purpose is to provide updated information for the user interface in the quest log, they are not themselves responsible for the actual code that triggers the victory in the end.
If you remove the quest files of the victory conditions you are simply left without the UI updates, if you modify them, you are simply going to get false information. The actual code, as far as I can understand, is hard coded and therefore cannot be modified without changing the DLL.
THE WORKAROUND
The first thing you want to do is disable the victory you are going to change.
Example:
This is the original code in the Domination quest script. It checks if the game is being loaded from a saved file and if the victory type is set on valid in the advanced game options.
If the first is false and the second is true it proceeds with the quest setup, else it does nothing and the quest log won't show it.
This is the line I added soon after.
So if the victory condition was set on false on the game options it remains false and the quest is not activated. If the victory condition was set on true, it is immediately set on false but the quest is still activated for all the players.
The important thing to consider is that setting the victory as "not valid" only prevents the hard coded victory system to work, it does not however prevent the game to end with that particular victory.
Now this is the default function that runs when the domination victory is completed. It sets the progress bar to 100% it sets the text that appears in the quest completed splash screen and it flags the quest as "succeeded"
Here you can add this line:
Voilà! This line immediately triggers the domination victory for the team of the player that has just completed the quest. The fact that the Domination Victory was disabled before does not prevent this from working.
CONCLUSION
Once you have done these steps, you are now free to modify the quest parameters in any way you like. By taking advantage of the built in quest system you can do that with relative ease as the main functions are already coded in a modular way and ready to be used.
You can completely change a victory objective. By changing the text and the splash image you can even replace a victory condition with something completely different.
The possibilities are endless.
In this thread I'm going to explain how that can be done (relatively) easily and with virtually limitless possibilities.
HOW THE SYSTEM WORK
The interesting part is that there are scripts for each of the five victory conditions in the quest folder and questobjective subfolder.
These scripts are responsible for setting and checking (almost) all the conditions of the default victories.
However their only purpose is to provide updated information for the user interface in the quest log, they are not themselves responsible for the actual code that triggers the victory in the end.
If you remove the quest files of the victory conditions you are simply left without the UI updates, if you modify them, you are simply going to get false information. The actual code, as far as I can understand, is hard coded and therefore cannot be modified without changing the DLL.
THE WORKAROUND
The first thing you want to do is disable the victory you are going to change.
Example:
Code:
function QuestScript.OnStartGame(isLoadGame)
if isLoadGame == false and Game.IsVictoryValid(GameInfo.Victories["VICTORY_DOMINATION"].ID) then
This is the original code in the Domination quest script. It checks if the game is being loaded from a saved file and if the victory type is set on valid in the advanced game options.
If the first is false and the second is true it proceeds with the quest setup, else it does nothing and the quest log won't show it.
Code:
Game.SetVictoryValid(GameInfo.Victories["VICTORY_DOMINATION"].ID, false);
This is the line I added soon after.
So if the victory condition was set on false on the game options it remains false and the quest is not activated. If the victory condition was set on true, it is immediately set on false but the quest is still activated for all the players.
The important thing to consider is that setting the victory as "not valid" only prevents the hard coded victory system to work, it does not however prevent the game to end with that particular victory.
Code:
function QuestScript.OnObjectiveComplete(quest, objective)
quest:SetProgress(100);
quest:SetReward("TXT_KEY_QUEST_VICTORY_DOMINATION_REWARD");
quest:Succeed();
end
Now this is the default function that runs when the domination victory is completed. It sets the progress bar to 100% it sets the text that appears in the quest completed splash screen and it flags the quest as "succeeded"
Here you can add this line:
Code:
Game.SetWinner(Players[quest:GetOwner()]:GetTeam(), GameInfo.Victories["VICTORY_DOMINATION"].ID);
Voilà! This line immediately triggers the domination victory for the team of the player that has just completed the quest. The fact that the Domination Victory was disabled before does not prevent this from working.
CONCLUSION
Once you have done these steps, you are now free to modify the quest parameters in any way you like. By taking advantage of the built in quest system you can do that with relative ease as the main functions are already coded in a modular way and ready to be used.
You can completely change a victory objective. By changing the text and the splash image you can even replace a victory condition with something completely different.
The possibilities are endless.