Results 1 to 12 of 12

Thread: Custom Mission Help

  1. #1

    Default Custom Mission Help

    Is there a way to give the reward of a mission to the named_character who completed it?

    I created a custom mission that has you kill random generals by any means (so killing in battle is a viable option) and would like to give the succeeding killer a trait as reward. The problem:

    - LeaderMissionSuccess only triggers on the leader
    - AssassinationMission only triggers on assassins
    - MissionFinished does not export a character record at all

    Can anyone think of an event-condition combination that might help identify the actual killer?


    Thank you in advance.

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,149
    Blog Entries
    36

    Default Re: Custom Mission Help

    The descr_mission readme suggests that it is possible to give traits via null_payback arrangement, but I have no idea how.










  3. #3

    Default Re: Custom Mission Help

    Via these triggers, but they only fire on the leader:

    Code:
    Trigger papalmission1
        WhenToTest LeaderMissionSuccess
    
        Condition MissionID return_papal_settlement
    
        Affects AdoredByPope  1  Chance  100
    So they are not of much use to me, unless there is a fancy way to transfer a trait from a factionleader to the actual killer behind the scenes. There is the FactionLeaderTrait condition, but that still does not allow me to specify the killer.

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,149
    Blog Entries
    36

    Default Re: Custom Mission Help

    I am talking about the 'rewards' in descr_missions:

    Code:
    payback_list pope_rome_min_penalty_only
    {
        reward
        {
            null_payback    HUGE_PAPAL_STANDING_REWARD        
            null_payback    VNV_ADORED_BY_POPE
        }
        penalty
        {
            null_payback    SMALL_PAPAL_STANDING_PENALTY
        }
    }
    Not sure if this actually gives a trait or if it is just a message display (see data\text\missions)

    Edit: doesn't look like it, the trait gets triggered as per your example.
    Last edited by Gigantus; July 29, 2020 at 08:30 PM.










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

    Default Re: Custom Mission Help

    If you killed him in battle then both of these events should fire: LeaderMissionSuccess & PostBattle. If LeaderMissionSuccess fires first, and I have no idea if it does, then you could set an event counter in there signalling that the next-occurring PostBattle should treat this as a mission success.

    Script:
    Code:
    monitor_event PreBattlePanelOpen
      ;turn off the 'signal' in case it is still on from a previous battle
      set_event_counter mission_general_killed 0
    end_monitor
    
    monitor_event LeaderMissionSuccess PaybackID your_payback_id
      set_event_counter mission_general_killed 1
    end_monitor
    EDCT:
    Code:
    Trigger papalmission1
        WhenToTest PostBattle
    
        Condition FactionIsLocal
          and I_EventCounter mission_general_killed = 1
    
        Affects your_trait 1 Chance 100
    That's the idea anyway.

  6. #6

    Default Re: Custom Mission Help

    Thanks for the idea, unfortunately the order of execution is: PostBattle -> LeaderMissionSuccess -> MissionFinished.

    Was thinking about a different concept:

    1) always add a hidden trait in PostBattle
    2) set the event_counter in LeaderMissionSuccess as you did
    3) a third event to remove the hidden trait if the event counter is 0 + turn it into a visible trait if the event counter is 1

    But I cannot think of an event that would allow 3) to happen "instantly" (don't want to resort to CharacterTurnEnd). If only MissionFinished would export a character record.

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

    Default Re: Custom Mission Help

    I like the thinking but yeah...
    But I cannot think of an event that would allow 3) to happen "instantly"
    ...I don't think there is one.

    How much time is there between the two events firing? If it's really short then there might be a way.

    Try this...

    Code:
    monitor_event LeaderMissionSuccess PaybackID your_payback_id
      log always ******** LeaderMissionSuccess ********
    end_monitor
    monitor_event PostBattle FactionIsLocal
      log always ******** PostBattle ********
    end_monitor
    ...and check the log after you kill him to see what the timestamps on the pair of log entries are. From that you can calculate how many seconds difference there was between them.

  8. #8

    Default Re: Custom Mission Help

    The time difference is about 1.1 seconds.

    I was thinking about a wait command already, but considering the PostBattle event has to be in the EDCT, I just ruled that option out. Might have missed something here.

    Eager to see, if you can come up with anything.

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

    Default Re: Custom Mission Help

    I think this will be too unreliable but here goes...

    script:
    Code:
    monitor_event PreBattlePanelOpen
      ;turn off the 'signal' in case it is still on from a previous battle
      set_event_counter mission_general_killed 0
    end_monitor
    
    monitor_event LeaderMissionSuccess PaybackID your_payback_id
      set_event_counter mission_general_killed 1
    end_monitor
    
    monitor_event PostBattle FactionIsLocal
    
      if I_PlayerHasMission your_mission_id
        campaign_wait 2.0  ;wait for LeaderMissionSuccess if it's coming
        if I_EventCounter mission_general_killed = 1
          e_select_character
        end_if
      end_if
    
    end_monitor
    EDCT:

    Code:
    Trigger general_killer_trigger1
        WhenToTest PostBattle
    
        Condition I_PlayerHasMission your_mission_id
    
        Affects candidate_trait 1 Chance 100
    
    Trigger general_killer_trigger2
        WhenToTest CharacterSelected
    
        Condition Trait candidate_trait > 0
          and I_EventCounter mission_general_killed = 1
    
        Affects candidate_trait -99 Chance 100  ;clear the candidate_trait points
        Affects real_trait 1 Chance 100
    candidate_trait = hidden trait marking the character as "fought a battle while the mission was still active".
    real_trait = the real trait to be gained when he kills the general.

    The sequence is, after a battle:
    1) EDCT gives the candidate_trait to your general who fought the battle
    2) script waits to see if the mission success message comes in - if it does then it selects the character who fought the battle
    3) EDCT trigger 2 fires giving him the real trait and removes candidate_trait

    My concern is the flakiness of e_select_character. And also that it won't select him until 2 seconds after the PostBattle, in which time you might have already selected somebody else so script auto-selecting this first guy might be strange and annoying behaviour.

    It should also work if you manually select your general any time before another battle, which is no way guaranteed to happen.

    AssassinationMission definitely does not fire on generals/NCs for this kind of mission?

  10. #10

    Default Re: Custom Mission Help

    Fancy! It does indeed work. Did not know e_select_character works within if-statements. Assumed that it would lose track of the character the monitor fired on, good to know.

    I tried AssassinationMission without any further conditions and did not fire. Maybe it only checks the assassin character record or it does not consider "killed_by_any_means", i.e. killed in battle, as a valid completion.

    2 seconds are not too bad considering the animation times of the strat models and possible post battle decisions, might even risk going a bit lower with the wait duration. Could disable ui functionality during the small pause as well, just to make sure.

    Regarding your linked thread, I gather that the only problem would occur if the mission target attacks a settlement with more than one governor and the defenders kill the mission target. At which point e_select_character would not select either of the garrisoned characters and nobody gets the reward trait... well sucks, but not the end of the world. Then the next selected general (who has fought a battle since the mission was active) would get the reward. Might be able to prevent that rare case with a reset of the event counter just after e_select_character.

    This is what I got so far:

    script:
    Code:
    monitor_event PreBattlePanelOpen
        set_event_counter grudge_target_killed 0
    end_monitor
    
    monitor_event LeaderMissionSuccess MissionID dwarf_grudge
        set_event_counter grudge_target_killed 1
    end_monitor
    
    monitor_event PostBattle FactionType poland
        if I_PlayerHasMissionType GRUDGE_MISSION
        campaign_wait 1.5
            if I_EventCounter grudge_target_killed = 1
                e_select_character
                campaign_wait 0.1
                set_event_counter grudge_target_killed 0
            end_if
        end_if
    end_monitor
    EDCT:
    Code:
    Trigger temp_grudge_settler_vnv_trigger
        WhenToTest PostBattle
    
        Condition FactionType poland
            and I_PlayerHasMissionType GRUDGE_MISSION
            and Trait TempGrudgeSettler < 1
    
        Affects TempGrudgeSettler  1  Chance 100
    
    Trigger successful_grudge_settler_vnv_trigger
        WhenToTest CharacterSelected
    
        Condition FactionType poland
            and Trait TempGrudgeSettler > 0
            and I_EventCounter grudge_target_killed = 1
    
        Affects TempGrudgeSettler  -1  Chance 100
        Affects GoodGrudgeSettler  1  Chance 100
    
    Trigger remove_temp_grudge_settler_vnv_trigger
        WhenToTest CharacterSelected
    
        Condition FactionType poland
            and Trait TempGrudgeSettler > 0
    
        Affects TempGrudgeSettler  -1  Chance 100
    Will need to test the system some more, but it seems to be doing its job, thank you very much for the help!

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

    Default Re: Custom Mission Help

    You're welcome. I'm also not sure if e_select_character works during turn end, as I'm fairly sure even select_character doesn't. If not then this won't work if the target is attacking you in their turn.

    AssassinationMission: ah well. That would have been too easy. I do wonder why it bothers exporting character_type because that will always be "assassin" and therefore redundant.

  12. #12

    Default Re: Custom Mission Help

    Yeah, you are right. Guess that's the nail in the coffin of that system.

    Unfortunately will have to resort to other rewards then. The clunkiness and unreliability is probably not worth it.

    Still, learned a lot, thanks for that.

Posting Permissions

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