I have tried using the following code:
Code:
core:add_listener( "df_dwarf_turn_start",
"FactionTurnStart",
true,
function(context)
local faction = context:faction();
local faction_name = context:faction():name();
if faction:is_human() and faction_name == "wh_main_dwf_dwarfs" and cm:model():turn_number() == 2 then
cm:trigger_mission(faction_name, "wh_main_grudge_ancestor_grudge_of_gunbad", true)
output("trigger_mission_please");
end;
end,
true
);
This produces no errors loading the script but no mission appears. In the logs it says this:
Code:
[out] <74.7s> ++ triggering mission from db wh_main_grudge_ancestor_grudge_of_gunbad for faction wh_main_dwf_dwarfs, fire_immediately: true
[out] <74.7s> >> whitelist_event_feed_event_type() called, event_type is faction_event_mission_issuedevent_feed_target_mission_faction
[out] <74.7s> trigger_mission_please
When I use the mission_manager:new(...) syntax like so
Code:
core:add_listener(
"df_dwarf_turn_start",
"FactionTurnStart",
true,
function(context)
local faction = context:faction();
local faction_name = context:faction():name();
if faction:is_human() and faction_name == "wh_main_dwf_dwarfs" and cm:model():turn_number() == 2 then
local ancestor_grudge_one = mission_manager:new(faction_name,"wh_main_grudge_ancestor_grudge_of_gunbad",false);
ancestor_grudge_one:add_new_objective("CAPTURE_REGIONS");
ancestor_grudge_one:add_condition("region wh_main_rib_peaks_mount_gunbad");
ancestor_grudge_one:add_payload("effect_bundle{wh_main_payload_event_grudge_settled; turns 5;}");
ancestor_grudge_one:set_should_cancel_before_issuing(false);
ancestor_grudge_one:trigger();
output("trigger_mission_please");
end;
end,
true
);
I get this from the logs but still nothing happens
Code:
[out] <56.4s> ++ mission manager triggering mission from string:[out] <56.4s> ++ triggering mission from string for faction wh_main_dwf_dwarfs mission string is mission{key wh_main_grudge_ancestor_grudge_of_gunbad;issuer CLAN_ELDERS;primary_objectives_and_payload{objective{type CAPTURE_REGIONS;region wh_main_rib_peaks_mount_gunbad;}payload{effect_bundle{wh_main_payload_event_grudge_settled; turns 5;}}}}
[out] <56.4s> >> whitelist_event_feed_event_type() called, event_type is faction_event_mission_issuedevent_feed_target_mission_faction
For contrast, when the game adds one of CA's own missions the log appears like so
Code:
[out] <53.4s> ++ triggering mission from string for faction wh_main_dwf_karak_izor mission string is mission{key wh_dlc06_grudge_belegar_eight_peaks;issuer CLAN_ELDERS;primary_objectives_and_payload{objective{type CAPTURE_REGIONS;region wh_main_eastern_badlands_karak_eight_peaks;}payload{effect_bundle{bundle_key wh_dlc06_bundle_eight_peaks_recapture;turns 0;}}}}
[out] <53.4s> >> whitelist_event_feed_event_type() called, event_type is faction_event_mission_issuedevent_feed_target_mission_faction
[out] <53.4s>