Results 1 to 16 of 16

Thread: Scripted Missions

  1. #1

    Default Scripted Missions

    Does anyone know how to fire the assassinate_cardinal mission type? I've tried using "create_mission mission_ID faction_name". I've tried changing the faction's religion to catholic before creating the mission. I've tried spawning in assassins for the faction that's supposed to get the mission and priests with the Cardinal trait for a potential catholic target faction. Nothing. The mission isn't created. In fact, the only mission types I have been able to create using create_mission are council_take_rebel_settlement, council_take_settlement, and gift_from_council, none of which are useful to me.

    I know it's possible to create other mission types (Baron Samedi's One Ring script uses give_ancillary) but I can't get any of them to work. I'm using the same parameters as the vanilla assassinate_cardinal mission. I've tried removing some parameters or setting them to lower values to make the mission more likely (under normal circumstances) but this has no effect. None of the parameters are even needed for the three mission types that I can get working so I'm not sure parameters are needed for any mission type.

    I'm also not sure how the game actually identifies "cardinals". They seem to just be priests with a level effect trait. It seems likely that create_mission won't work unless some key infrastructure is already existent on the map. E.g. you can't create an assassinate_cardinal mission unless you have an assassin (at least one?) and there's another (catholic?) faction with a cardinal (whatever that is really). Likewise, the give_ancillary mission type, being a pope mission, requires that the faction be catholic (?). The gift_from_council mission (which seems to be completely useless for all scripting purposes) has no such requirements and the capture settlement missions are always going to be viable as long as there are rebel or enemy settlements on the map. This is all speculation on my part.

    The only guide I've found on this topic does not list these speculative mission requirements. The hard coded mission triggers are, by themselves, apparently insufficient to trigger a mission using create_mission.

  2. #2
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,272

    Default Re: Scripted Missions

    This shows how to use a scripted give_ancillary. It might have some clues.

    Maybe "cardinal" means one in the College of Cardinals, not just any old Level 2 priest. Or are such priests always in the College? I don't know.

  3. #3
    Jadli's Avatar The Fallen God
    Citizen

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    6,635

    Default Re: Scripted Missions

    Well, Im also missing some kind of a list of mission script commands that work, was thinking of making one myself I think most of them simply cant be given via script commands, and that the devs created the parameters only for those that were needed to use... Perhaps we can try to make a catalogue of functional mission script commands while at it? Though it would be pretty short it seems

    Though you are missing one for sure, which is the "assassinate_general". That can be given via "create_mission assassinate_general source_faction character_label_of_target_character". This one can be used for many things, as you can set whether the target can be killed by any means or not etc, and you can give labels to cardinals (I assume it would also work with names)... using this like thousand times in my WIP dungeons mission script, in many different variants.

    For two missions in descr_missions there is specifically written how to give some missions through scripts (if you look also into the DLCs, which many people forget...):
    - adventurous crusader (teutonic adventurous crusading noble mission): "create_mission adventure_crusader source_faction crusader_label"
    - pope asking you to build a church or something: create_mission papal_build_church target_faction target_settlement"

    And of course, if you are trying to give mission variants (your modified missions), you use the name of the variant, not the base name, but I assume you know that...
    Last edited by Jadli; August 06, 2020 at 11:21 AM.

  4. #4
    Jadli's Avatar The Fallen God
    Citizen

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    6,635

    Default Re: Scripted Missions

    Anyways, I assume your problem actually is, that you are trying to assign the mission and let the game pick (random cardinal) target, moreless?

    Pretty sure you cant do that, it must be a specific target, when given through a script. It might be similar to "assassinate_general" , perhaps try to use the same format as I have shown, and you will get the mission to work
    Last edited by Jadli; August 06, 2020 at 12:45 PM.

  5. #5

    Default Re: Scripted Missions

    Thanks guys. I was not aware that you could add further parameters in the create_mission line after the faction name.

    Edit: I got the assassinate_general mission working. It seems it only works with the character label, not the name. This complicates using the assassinate_cardinal mission type since priests can't have labels and I'm guessing the mission can't be created without a label. Interesting catch 22...

    The issue I'm running into with the assassinate_general mission is that I don't actually want the mission to be winnable or have any chance of expiring except by script. I'm basically just using the mission to display script objectives so I don't have to use hotkey historic_events (which non-English keyboard users always have trouble with and require scripted timers for every script). The assassinate_general type would work well if I could somehow make the general invisible and underground so that the location marker shows a region of interest (rather than the corner of the map, which will no doubt confuse people) but without making it possible to interact with the target general in any way. Spawning the target in a settlement almost works except they "go into hiding" which expires the mission.

    Quote Originally Posted by Jadli View Post
    you can set whether the target can be killed by any means or not
    How do you do this?

    The fact that assassinate_general can be created provided the correct campaign_script parameters are supplied implies that the other missions also work. It's just a matter of discovering the correct parameters to supply it with for it to be created. I'm curious how you know that the character label was needed to create this mission type (and how Withwnar knew about the parameters needed for the give_ancillary mission type). Is there are list of these required parameters somewhere?
    Last edited by Callistonian; August 06, 2020 at 05:47 PM.

  6. #6
    Jadli's Avatar The Fallen God
    Citizen

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    6,635

    Default Re: Scripted Missions

    Quote Originally Posted by Callistonian View Post
    Thanks guys. I was not aware that you could add further parameters in the create_mission line after the faction name.

    Edit: I got the assassinate_general mission working. It seems it only works with the character label, not the name. This complicates using the assassinate_cardinal mission type since priests can't have labels and I'm guessing the mission can't be created without a label. Interesting catch 22...

    The issue I'm running into with the assassinate_general mission is that I don't actually want the mission to be winnable or have any chance of expiring except by script. I'm basically just using the mission to display script objectives so I don't have to use hotkey historic_events (which non-English keyboard users always have trouble with and require scripted timers for every script). The assassinate_general type would work well if I could somehow make the general invisible and underground so that the location marker shows a region of interest (rather than the corner of the map, which will no doubt confuse people) but without making it possible to interact with the target general in any way. Spawning the target in a settlement almost works except they "go into hiding" which expires the mission.
    Well, are you sure agents cant have labels? I think they can (and you could also force it on them through EOP I suppose...)

    Well, as you will be scripting the mission to happen at exact time (I assume) via script, you can give him all personal security traits you can find I suppose . Or perhaps you could spawn a new character along with giving the mission, who would be target, so you could control where that character is and other things, as you dont want to kill the cardinal anyway...

    Could you explain your reasons for wanting him safe and so on? As it seems its complicating an already compliated thing here ....



    Quote Originally Posted by Callistonian View Post
    How do you do this?

    The fact that assassinate_general can be created provided the correct campaign_script parameters are supplied implies that the other missions also work. It's just a matter of discovering the correct parameters to supply it with for it to be created. I'm curious how you know that the character label was needed to create this mission type (and how Withwnar knew about the parameters needed for the give_ancillary mission type). Is there are list of these required parameters somewhere?

    There are many various paramaters (more than Im interested in in discovering new mission commands Im interested in finding new parameters , there are some additional ones in DLCs as well....), however mostly only a few of them work with certain missions.... some missions are very hardcoded, trying to add new parameters to them causes a crash (at least one finds out quickly)

    However, assassinate_general is our friend, as that one is the most flexible I think (I assume thats because because in vanilla/DLCs there already are several variants....)
    the ones that work with assassinate_general are:
    Code:
    enemy_modifier    ...
    own_region_modifier    ...
    per_unit_modifier ...
    character_type    ...  ; named_character, priest, leader, heir,...
    attribute_type    ... ; command, piety,...)
    attribute_min_threshold    ... 
    target_religion    ... ; can be more than just one
    target_faction    .... ; can be more than just one
    guild_handles    ....            ; what guilds are required for this mission
    killed_by_any_means            ; kill in any way possible, remove if only assassination is desired
    expire_on_hide_disabled        ; hiding the victim does not invalidate mission
    perhaps there is some more, but likely nothing significant... Not sure if it helps you... though you could use high piety to target them I suppose, but if you want to give it via script, it wouldnt matter anyway...

    Possibly you might be interested in parametr "link_mission_id". It means that a name of a mission that you write behind it is given to the player immediately once he finished the current mission (the one that has the parametr). It was used in teutonic as well, for tasking you to take a settlement, and subsequently convert it, using it for similar stuff in my mod.... but I have a feeling this one can work with any mission (or at least most of them), so perhaps it could help your issue somehow... Possibly of some use for you could be as well "source_faction faction_name" and "min_stance_threshold diplomacy_status", but not sure if they would work with this type of mission...


    As I said, I dont think there is any list, I assume because not so many mission command parametrs are actually known, and also not so many people are into missions... though indeed, perhaps its time to make one ... Perhaps "guild_take_settlement" might also be possible to give via script, as its kind of similar to "council_take_settlement" , but the parametrs are different, so not sure - ou need a guild for it and it can target only based on a hidden resource parametr, and it cant target faction or religion...



    Ill be geting back into finishing my missions stuff soon, as I have finished other things, so I may try to compile a lost of parametrs and script commands...
    Last edited by Jadli; August 06, 2020 at 06:34 PM.

  7. #7

    Default Re: Scripted Missions

    Thanks for the reply Jadli.

    Quote Originally Posted by Jadli View Post
    Well, are you sure agents cant have labels?
    I think agents can have labels but not in campaign_script which is how I was attempting to spawn them.

    Quote Originally Posted by Jadli View Post
    Could you explain your reasons for wanting him safe and so on? As it seems its complicating an already compliated thing here
    Sorry, it seems I'm asking for help with Y. Let me provide some background. Let's say we have a script with an objective that the player moves a character to some region (or whatever objectives your random script may have). I inform the player about this objective using a historic_event. How do I remind the player of the objective after this? I could use a hotkey (and in fact this is what I have been doing for years) but there are some obvious problems with this. First, anyone with a non-English keyboard is going to have trouble using the hotkey. Second, players tend to forget the hotkeys even if they're listed in the F12 list. Third, if the script objective has a timer, I will need to script this in for each objective which, despite being scripting 101, is still quite unwieldy and wastes resources.

    Instead, how about I use a mission? Everyone already knows how to check mission objectives and the timer is set up right there (can use MissionFinished or LeaderMissionFailed to check if timer expires). All I need is a mission type that 1) can be created using create_mission, 2) can be expired via script (e.g. by killing the target), and 3) can't be completed normally, that is to say, the player can't finish the mission before the script and then have their script objectives disappear.

    The obvious candidates for suitable mission types are assassination missions. The problem is condition #3 above, how to prevent the player (or any AI factions) from interacting with the assassination target? What I've done to address this is spawn the target character into a settlement. This puts him "in hiding". Then I use the mission parameter that you've kindly supplied: expire_on_hide_disabled. Now, there is no way to complete the mission normally meaning that only fulfilling the script conditions (as specified in the mission description) can end the mission (with kill_character, campaign_wait 0.1, clear_messages). Even if the settlement the target is hiding in changes ownership, the target remains hiding there and the mission continues. I can even do missions in sequence using the other parameter you supplied: link_mission_id. A few cosmetic modifications make the illusion complete: an invisible strat model for the target general and name corresponding to the region of interest for the script so the mission location finder makes sense.

    One interesting thing I discovered along the way is that if you destroy the BG unit for the target general, you can still create the assassination mission but there will be no Target line in the mission scroll. At the start of the next turn the mission will expire due to target death.

  8. #8
    Jadli's Avatar The Fallen God
    Citizen

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    6,635

    Default Re: Scripted Missions

    Quote Originally Posted by Callistonian View Post
    Thanks for the reply Jadli.



    I think agents can have labels but not in campaign_script which is how I was attempting to spawn them.
    Ah, well. If thats the case Im pretty sure you can assign label to any character via EOP (in one of his vids he assigned to a princess if I remember correctly), and you are using EOP already, so that would do it (you can assign it based on priest ancillary or something plus the turn of your script...)



    Quote Originally Posted by Callistonian View Post
    Sorry, it seems I'm asking for help with Y. Let me provide some background. Let's say we have a script with an objective that the player moves a character to some region (or whatever objectives your random script may have). I inform the player about this objective using a historic_event. How do I remind the player of the objective after this? I could use a hotkey (and in fact this is what I have been doing for years) but there are some obvious problems with this. First, anyone with a non-English keyboard is going to have trouble using the hotkey. Second, players tend to forget the hotkeys even if they're listed in the F12 list. Third, if the script objective has a timer, I will need to script this in for each objective which, despite being scripting 101, is still quite unwieldy and wastes resources.

    Instead, how about I use a mission? Everyone already knows how to check mission objectives and the timer is set up right there (can use MissionFinished or LeaderMissionFailed to check if timer expires). All I need is a mission type that 1) can be created using create_mission, 2) can be expired via script (e.g. by killing the target), and 3) can't be completed normally, that is to say, the player can't finish the mission before the script and then have their script objectives disappear.

    The obvious candidates for suitable mission types are assassination missions. The problem is condition #3 above, how to prevent the player (or any AI factions) from interacting with the assassination target? What I've done to address this is spawn the target character into a settlement. This puts him "in hiding". Then I use the mission parameter that you've kindly supplied: expire_on_hide_disabled. Now, there is no way to complete the mission normally meaning that only fulfilling the script conditions (as specified in the mission description) can end the mission (with kill_character, campaign_wait 0.1, clear_messages). Even if the settlement the target is hiding in changes ownership, the target remains hiding there and the mission continues. I can even do missions in sequence using the other parameter you supplied: link_mission_id. A few cosmetic modifications make the illusion complete: an invisible strat model for the target general and name corresponding to the region of interest for the script so the mission location finder makes sense.

    One interesting thing I discovered along the way is that if you destroy the BG unit for the target general, you can still create the assassination mission but there will be no Target line in the mission scroll. At the start of the next turn the mission will expire due to target death.
    Didnt know there was a definition for stuff like this, I have went Y often myself as well

    Ah, I understand now... Yea even on my labtop when I use any of the F numbers while in game, it usually doesnt end up well...

    From what I gathered, you have figured it out then

    You can of course also change description of the missions, so basically you can change name to anything you want, such as instructions for players (though be careful, it cant be extra long).

    Interesting, how does one destroy a BG unit of a general?

    Also, I suppose the last parametr that could be useful to you is "event_mission". I havent tested it thoroughfully but Im pretty sure it should work with all types of missions. What it does is, that this mission can be given only through script, not given "randomly" by game at any time (at least I believe so ). That would be very useful for your story quests I suppose. (but careful, you have to place "event_mission" into the part between duration and paybacks, not to the bottom part.). There is also the "turn_start", which I believe tells the game since what turn can such missions be granted, though afterwards it could be likely given any time, so checking it with "event_mission" is likely safer. (though I suppose you can just set turn_stark to some huge number as Withwnar suggests in his great guide.)

    Im myself heading similar way, I want to replace several of my inpractical "story scripts" with unique missions.
    Last edited by Jadli; August 07, 2020 at 04:46 AM.

  9. #9
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,272

    Default Re: Scripted Missions

    Quote Originally Posted by Callistonian View Post
    I'm curious how you know that the character label was needed to create this mission type...
    Presumably only because there's an example in the teutonic mod/DLC descr_missions.txt...

    create_mission adventure_crusader [receiving_faction] [crusader_script_label]

    Just as it, vanilla grand campaign's descr_missions.txt and docudemons give an example for papal_build_church...

    create_mission papal_build_church england London

    Quote Originally Posted by Callistonian View Post
    ...and how Withwnar knew about the parameters needed for the give_ancillary mission type.
    My tutorial doesn't use additional parameters, only the two that docudemons say are required: mission_id and faction.

    I don't know of any resource that mentions which additional parameters work for other mission types.

    Quote Originally Posted by Jadii
    Perhaps "guild_take_settlement" might also be possible to give via script
    It is. The player's faction must have a guild (any guild, anywhere) at the time that create_mission is called. Losing the guild later does not end the mission, so a guild building could be script-built and script-destroyed around that create_mission call if need be.

    Note, however, that there's no direct way to specify what the target settlement should be, for any of the xxx_take_settlement mission types.

  10. #10
    Jadli's Avatar The Fallen God
    Citizen

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    6,635

    Default Re: Scripted Missions

    Quote Originally Posted by Withwnar View Post

    It is. The player's faction must have a guild (any guild, anywhere) at the time that create_mission is called. Losing the guild later does not end the mission, so a guild building could be script-built and script-destroyed around that create_mission call if need be.

    Note, however, that there's no direct way to specify what the target settlement should be, for any of the xxx_take_settlement mission types.
    Ah, you tested it? very nice to know it works... Though did it randomly pick one of the settlements with the hidden resource specified in descr_missions for this missions? I assume then, that the command is just "create_mission guild_take_settlement faction_name"? My issue with mission kind of is, that Im not sure whether if there are several settlements with that hidden resource and some of them are held by allies, would the game pick the ones that are not held by your allies as target or not? (with this mission almost no additional parametrs work...). And I assume the council of nobles ..._take_settlement and ..._take_rebel_settlement would use the same format as you guys say it work?

    By the way, if that worked that way, you can still specifiy signigicantly a target for council of nobles conquest missions, as for them (or actually only ..._take_settlement and not _take_rebel_settlement) you can specify several additional parametres not used in vanilla, such as target_faction and target_religion. Possibly also the diplomacy stance, though havent tested that one

    I assume if guild_take_settlement work, then perhaps guild_build should work as well? Its kind of weird mission, what it does is that the guild builds a building (from a list in descr_missions) for you, something as money from council of nobles, so I assume it would be "create_mission guild_build faction_name settlement_name" (as in papal_build)... This mission kinda disappointed me anyway, as I wanted my guilds to task players to build something, and seems the papal_build cant be repurposed, though I will test in upcoming days...
    Last edited by Jadli; August 07, 2020 at 05:36 AM.

  11. #11

    Default Re: Scripted Missions

    Quote Originally Posted by Jadli View Post
    Interesting, how does one destroy a BG unit of a general?
    By using:
    Code:
    destroy_units faction_name unit_type
    Before you mentioned the expire_on_hide_disabled parameter, I was experimenting to see if it was possible to kill or somehow send the target off map until rebel faction's turn and then respawn them at the end of the rebel's turn so they wouldn't "go into hiding" and expire the mission prematurely. My best bet was to induce the bug where a general exists on the strat map with no units (not holding a banner). I'm not actually sure how to induce this bug but I've seen in many times so I attempted using destroy_units (although I knew this alone would not work). The result was that the game was still able to create the mission on the same turn that the target general had existed. Perhaps this is the same scenario Withwnar is describing with guilds needing to exist only on the turn the mission is created?

    Quote Originally Posted by Jadli View Post
    Also, I suppose the last parametr that could be useful to you is "event_mission".
    I will test this. I was using turn_strat 999 following the One Ring script.

  12. #12

    Default Re: Scripted Missions

    It seems a few things conspired by accident to make this work out so well for me which anyone attempting to use this trick should be aware of.

    It's impossible to spawn a foreign assassination target into a settlement to put them "in hiding". What actually happened in my case is that the target spawned on the settlement tile, slid off to the neighboring tile to the south-west (as usually happens when you try to spawn stuff in residence), and then hid in the forest that just happened to be on that tile. Furthermore, the character had a locked (reduced movement points) trait. The result is that the assassination target becomes bugged and can't interact with anything - can't be attacked, can't be assassinated, can't participate in diplomacy, nothing (at least that I've tested so far). If you move another character or agent onto the tile where the assassination target is hiding, he won't be affected. What's really peculiar is that if you use the location finder on the mission scroll, it will select the character or agent that you moved onto that tile.

    This result, which clearly relies on some sort of bug in the game, ends up being exactly what I needed. But it only works if the target is hiding in a forest and has a locked trait. The target doesn't need to slide of a settlement onto a forest tile, he just needs to be spawned in the forest. I suppose it would work if the character can be hidden any other way, but as far as I know the only way to "hide" anything in Medieval II is on a forest tile. It's also a good idea to use a dummy faction with their AI frozen for the target character (to prevent him from walking around and coming out of hiding).

    If anyone using this trick discovers that there is a way to interact with the assassination target (beyond using the mission scroll target finder) please do let me know.

  13. #13
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,272

    Default Re: Scripted Missions

    Quote Originally Posted by Jadii
    [guild_take_settlement] Though did it randomly pick one of the settlements with the hidden resource specified in descr_missions for this missions? I assume then, that the command is just "create_mission guild_take_settlement faction_name"? My issue with mission kind of is, that Im not sure whether if there are several settlements with that hidden resource and some of them are held by allies, would the game pick the ones that are not held by your allies as target or not?
    I only used it campaign start for one faction, with a resource (furs) which only one starting neighbour region has. The game always makes the mission as a "capture that region", never any other region with furs, so I assume such missions are restricted to neighbouring regions. If more than one neighbour had furs then I think the game would randomly choose one of those regions as the target - not sure I tested that so not sure that it is random.

    Yes: create_mission guild_take_settlement faction_name, but I made a variation of that mission type and used that as the mission_id instead of "guild_take_settlement".

    I don't know if it can target allies.

    Quote Originally Posted by Callistonian
    If you move another character or agent onto the tile where the assassination target is hiding, he won't be affected. What's really peculiar is that if you use the location finder on the mission scroll, it will select the character or agent that you moved onto that tile.
    Very strange overall. I wonder if the above means that at this point the other character is now the target, so if he dies then your mission will end. And, if so, is it the act of using the location finder that made the other guy the target or is the act of him standing on that tile in the first place.

  14. #14

    Default Re: Scripted Missions

    The location finder doesn't change the mission target. If you spawn the assassination target on a forest tile with a Locked trait, he will be bugged and the mission scroll location finder will select him (white selection circle). If you then move another agent onto this tile, the location finder will select this agent now (green selection circle since it's your agent). If you move the agent away, the location finder will go back to selecting the assassination target (white selection circle) who has remained on the same tile all along.

    I've also tried moving a named character onto the target's tile and killing him instead of moving him away. This has the same result as above - the location finder goes back to selecting the original assassination target and the mission does not expire. This indicates that the location finder has no real effect, but it is getting confused as to who it should select when there are multiple characters on the same tile at once (a result of this bug with spawning locked characters into hiding).

    One thing to keep in mind with this trick is that the forest tile must be unoccupied when the assassination target is spawned. If there is already a named character or captain standing there, then the assassination target will slide off to the south-west, won't be hidden, and won't be bugged in the desired way (unless of course the tile he slides off into is also forest). This can obviously be fixed by putting the forest on inaccessible terrain.

  15. #15

    Default Re: Scripted Missions

    If I understand you correctly, you want to achieve a mission description that is not dependent on hotkeys.

    Did you have a look at the custom missions script in the Rise of the Three Kingdoms mod? They do just that via a show_me script. With a bit of tweaking that sounds like what your are looking for.

  16. #16
    Gigantus's Avatar I am thinking more about running away now then I did as a kid, but by the time I put my teeth in, my glasses on and find my car keys I forget why I am going.
    Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,814
    Blog Entries
    23

    Default Re: Scripted Missions

    The missions in RotK are purely script based without using the mission mechanic. The show me script (it could have been integrated into the regular script) is used to pop up a message window with the target description.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •