From 474b6e1c3177f45ebb8f66f87a6e1a9a568e3c2c Mon Sep 17 00:00:00 2001 From: Sven Eberhardt Date: Thu, 31 Jul 2014 23:48:53 +0200 Subject: [PATCH] Add Dlg_*_Init callback to dialogues. To be used e.g. for starting timers of NPC activities. Also fix scenario saving of attention state in dialogue object. --- planet/Objects.ocd/Helpers.ocd/Dialogue.ocd/Script.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/planet/Objects.ocd/Helpers.ocd/Dialogue.ocd/Script.c b/planet/Objects.ocd/Helpers.ocd/Dialogue.ocd/Script.c index 18ef92f2f..4954c35aa 100644 --- a/planet/Objects.ocd/Helpers.ocd/Dialogue.ocd/Script.c +++ b/planet/Objects.ocd/Helpers.ocd/Dialogue.ocd/Script.c @@ -80,6 +80,10 @@ public func InitDialogue(string name, object target, bool attention) // Update dialogue to target. UpdateDialogue(); + // Custom dialogue initialization + if (!Call(Format("Dlg_%s_Init", dlg_name), dlg_target)) + GameCall(Format("Dlg_%s_Init", dlg_name), this, dlg_target); + return; } @@ -295,7 +299,7 @@ func SaveScenarioObject(props) if (!dlg_target) return false; // don't save dead dialogue object // Dialog has its own creation procedure props->RemoveCreation(); - props->Add(SAVEOBJ_Creation, "%s->SetDialogue(%v)", dlg_target->MakeScenarioSaveName(), dlg_name); + props->Add(SAVEOBJ_Creation, "%s->SetDialogue(%v,%v)", dlg_target->MakeScenarioSaveName(), dlg_name, !!dlg_attention); return true; }