Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
As we touched on before, quests that give a task use waitsubtaskany() and close after one of their subtasks completes. So in TaskPluckingThePetals.xml, rather than use waitsubtasks() like we did in TaskFlowerOfItaly.xml, we'll use waitsubtaskany() and have multiple subtasks, then once the player completes one the other is gone. One of these subtasks will have its script be to go through with the looting, one will be not to do anything. In addition, we'll add a time limit to this task so that it'll auto-cancel if you take too long and the moment of conquest passes, since it stops feeling appropriate after Locris has been a loyal subject for years.
To add a time limit, you add a new tag to your task called "maxtime" and set its contents for the number of days you want the task to exist before time runs out. If you want, you can add a cancelscript tag which will run if the time runs out or if the player manually cancels. To make deciding not to loot a somewhat competitive option, we'll create a cancelscript which assimilates the city a little and gives it a population growth bonus, since they're keeping temples to gods of fertility and family.
For the actual subtasks, the positive subtask's script will be based mainly on the sleepuntil function. This function is similar to waitcapture or waitsubtasks, but waits until any wake event is triggered. A wake event can be triggered either by the game (this is actually how the waitcapture function detects there's been a capture) or via script; we'll be waiting for a custom-defined wake event called "PluckThePetals", and in our status string, add an anchor script to trigger it. Thus the subtask's script will wait until the player clicks the anchor in the subtask's status. We can add that anchor script to the string by wrapping the text with <a script="wakeevent([[PluckThePetals]])">____</a> (note that [[ and ]] can be used in lua to replace " when you need to make sure it doesn't think you're closing a different quote). After that fires, we'll give the player the gold from looting by calling the givegold() command on the player faction and raise its hostility with all the greek factions by starting a loop through every faction, checking if it's greek and isn't the player, and if so raising its hostility through the inchostility function.
The other subtask just needs to make the cancelscript run, since it's just the player actively choosing not to do it. Strictly speaking, it doesn't need to exist since manual cancel options and time limits can have it run if the player would prefer this option, but it's better to make the player's choices obvious. Its status string can just be the default SubtaskReject string, which already has a placeholder for scripts we can fill with a request to cancel this task using the taskcancel() command with the task's name passed in. The actual script for this subtask isn't too important if we do it correctly; all we want is for this subtask to stay paused for the entirety of the task and give the player a chance to cancel the task. I set it to call delaydays() with 7 passed in, which means it will wait out the time limit and can't unpause early.
Of course, both when we start the task and when it's completed, it would be nice to have popups tell the player what's going on, which is where talkinghead functions come in. Talking heads is our name for the advisors or ambassadors that sometimes come up to tell the player about something; they are brought up with a talkinghead function. There are a few talkinghead functions, but they're all pretty similar; the first parameter is the text that they say. You'll want to use the getstring command to retrieve the contents of anything you put in stringwrangler, getstring works by taking first "PH" then the name of the string you want to retrieve. The second parameter of the talkinghead functions describes who the advisor is; their name, their job title, what faction they work for, etc. You can get advisor data by retrieving a faction entity (usually through getplayerfaction() or getfactionbyname()) and calling the getadvisor function with either "diplomat", "spymaster", "general" or "governor" passed in as its only parameter. The talking head will then pause until the player clicks okay, at which point the script will resume. The talking head functions that follow that format are talkingheadrewardcity, talkingheadrewardgold, talkingheadnewobjective, and talkingheadnews, and the main difference between them is that rewardcity says "A NEW CITY HAS JOINED OUR FACTION!" while newobjective says "NEW OBJECTIVE", rewardgold takes a third parameter for an amount of gold to replace any "gold" placeholders with and news has none of these bells and whistles.
For the introduction, we'll use talkingheadnewobjective and add a string with a player advisor pointing out that they could loot the temples, then just wait on any of the subtasks. We'll add a talkingheadnews to the accept script, have a Locrian point out that the player's committed an atrocity and everyone who loves the greek gods will hate them for it, and add a talkingheadnews to the cancelscript where one of the player's advisors state how grateful the people of Locris are.
Our final task looks like:
So that's how the quests from the Flower of Italy mod were put together. I know I sort of quickly blasted through a lot there, but if you have any questions or anything seems unclear, please ask on the forums or through email at chris@longbowgames.com and I'll do my best to go over whatever you asked about in greater detail.
Slightly longer question: Are there any other subtags like it we can use (I also found <cancellable>, for instance)?
Other tags not covered in the above tutorial include
Subtasks can also have some extra tags if you want them to show icons on the map.
I am creating an objective that basically asks the player to conquer any 15 out of a predetermined 21 cities.
I have actually managed to get it to work, however the one thing I am struggling with is making the objective icon on the map actually appear over all 21 cities.
I've basically tried to call 'subtaskposfollow' multiple times, once for each city, but it seems to just overwrite itself each time, so I only end up with the icon over ibossim (the last in the 'coastcities' list).
I don't think I can split this up into subtasks for each city with their own subtaskposfollows because from what I can tell you can either make the task require just one of the subtasks or all of them, not any other amount (like 15).
(steam bleeps out some of the city names for some accidental similarities to... other things)
Any ideas? Is it just not possible?
That said, it is possible to make tasks do something other than wait for only one or all of its subtasks. The task isn't considered done until the task's script, the one that has "waitsubtaskany" or "waitsubtasks" calls, successfully completes its last line. If a task script has
In this case it has the problem of 21 'capture' subtasks being on the screen at once and not communicating clearly that the player only need 15 of them. Also the idea is to have the player hold 15 of them at a time whereas this way it wouldn't check if any of the cities have been lost since first capturing it in the subtask.
But, after sleeping on it for a night and some more experimentation today, I found a pretty good solution!
I basically kept my original subtask, minus the 'subtaskposfollow' bit.
Then I added 21 subtasks like this, one for each city.
And finally used a simple 'waitsubtaskany' in the task script.
Subtasks 2-22 all can't be completed (until the fabric of logic itself changes and 0 becomes a higher number than 1), so it forces the player to complete subtask 1, which counts the amount of cities currently owned as before, and therefore takes into account when a city gets lost, and shows the player through its string how many out of 15 he is currently controlling.
Subtasks 2-22 also all point to an empty string, which means they are invisible and don't take
up any room on the screen when playing. (I was surprised this worked, they don't even take up an empty line or anything like that.)
So what subtasks 2-22 do is just display the icons on the map over the cities (and it checks to see if the player owns it, in which case it will minimize the icon), without further affecting the objective or the player's screen.
So, quite messy, but it seems to work perfectly in-game.
Thanks as always for the help and being so hands-on with it!