Salk Posted March 7, 2023 Share Posted March 7, 2023 Hello! I have the following code (#gfisherdlg.d): /****** SONNER ******/ EXTEND_TOP SONNER 4 IF ~Global("TenyaStory","GLOBAL",1)~ THEN REPLY @210 /* ~The child has said that you killed her mother and have been taking far too much from the seas. I don't like being used, Sonner. It makes me... angry.~ */ EXTERN ~TELMAN~ 6 END ALTER_TRANS SONNER BEGIN 8 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("HelpJebadoh","GLOBAL",3) EraseJournalEntry(%sonnjour1%) EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ END ALTER_TRANS SONNER BEGIN 10 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("HelpJebadoh","GLOBAL",3) EraseJournalEntry(%sonnjour1%) EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ END ALTER_TRANS SONNER BEGIN 13 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("HelpJebadoh","GLOBAL",3) EraseJournalEntry(%sonnjour1%) EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ END ALTER_TRANS SONNER BEGIN 14 END BEGIN 1 END BEGIN "TRIGGER" ~Global("HelpJebadoh","GLOBAL",1)~ END EXTEND_BOTTOM SONNER 14 IF ~~ THEN REPLY @211 /* ~You will die for your trickery!~ */ DO ~SetGlobal("HostileFishermen","GLOBAL",1)~ EXIT END ALTER_TRANS SONNER BEGIN 17 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("HelpJebadoh","GLOBAL",3)~ END ALTER_TRANS SONNER BEGIN 18 END BEGIN 0 END BEGIN "ACTION" ~GivePartyGoldGlobal("FisherPrice","GLOBAL") AddexperienceParty(1000) GiveItem("BLUN03",[PC]) ActionOverride("Telman",EscapeArea()) ActionOverride("Jebadoh",EscapeArea()) EscapeArea() EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ "SOLVED_JOURNAL" ~#%sonnjour10%~ END APPEND SONNER IF WEIGHT #6 ~Global("TenyaStory","GLOBAL",1)~ THEN BEGIN 27 // from: SAY @209 /* ~You again?~ */ IF ~~ THEN REPLY @210 /* ~The child has said that you killed her mother and have been taking far too much from the seas. I don't like being used, Sonner. It makes me... angry.~ */ EXTERN ~TELMAN~ 6 END END /****** JEBADO ******/ REPLACE_STATE_TRIGGER JEBADO 10 ~Global("HelpJebadoh","GLOBAL",2)~ ALTER_TRANS JEBADO BEGIN 7 END BEGIN 0 END BEGIN "ACTION" ~~ "EPILOGUE" ~EXTERN SONNER 7~ END APPEND JEBADO IF WEIGHT #7 ~Global("TenyaStory","GLOBAL",1) ~ THEN BEGIN 12 // from: SAY @209 /* ~You again?~ */ IF ~~ THEN EXTERN ~SONNER~ 27 END END /****** TELMAN ******/ APPEND TELMAN IF WEIGHT #6 ~Global("TenyaStory","GLOBAL",1) ~ THEN BEGIN 15 // from: SAY @209 /* ~You again?~ */ IF ~~ THEN EXTERN ~SONNER~ 27 END END /****** TENYA ******/ ALTER_TRANS TENYA BEGIN 2 END BEGIN 0 END BEGIN "ACTION" ~GiveItemCreate("minhp1","TENYA",0,0,0) ActionOverride("TENYA",FillSlot(SLOT_AMULET)) Enemy()~ END ALTER_TRANS TENYA BEGIN 5 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("TenyaHit","GLOBAL",2) ChangeEnemyAlly(Myself,NEUTRAL) ClearAllActions() ActionOverride(Player1,ClearAllActions()) ActionOverride(Player2,ClearAllActions()) ActionOverride(Player3,ClearAllActions()) ActionOverride(Player4,ClearAllActions()) ActionOverride(Player5,ClearAllActions()) ActionOverride(Player6,ClearAllActions()) SetGlobal("TenyaStory","GLOBAL",1)~ END ALTER_TRANS TENYA BEGIN 5 END BEGIN 1 END BEGIN "ACTION" ~SetGlobal("TenyaHit","GLOBAL",2) ChangeEnemyAlly(Myself,NEUTRAL) ClearAllActions() SetGlobal("TenyaStory","GLOBAL",1) EraseJournalEntry(%sonnjour1%) EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ END ALTER_TRANS TENYA BEGIN 10 END BEGIN 0 END BEGIN "ACTION" ~SetGlobal("HelpTenya","GLOBAL",2) TakePartyItem("MISC53") AddexperienceParty(1000) SetGlobal("TalkedToTenya","GLOBAL",1) ForceSpell(Myself,DRYAD_TELEPORT) SetGlobal("HelpJebadoh","GLOBAL",3) EraseJournalEntry(%sonnjour1%) EraseJournalEntry(%sonnjour2%) EraseJournalEntry(%sonnjour3%) EraseJournalEntry(%sonnjour4%) EraseJournalEntry(%sonnjour5%) EraseJournalEntry(%sonnjour6%) EraseJournalEntry(%sonnjour7%) EraseJournalEntry(%sonnjour8%) EraseJournalEntry(%sonnjour9%)~ END ALTER_TRANS TENYA BEGIN 16 END BEGIN 0 END BEGIN "EPILOGUE" ~GOTO 13~ END There is an incompatibility with a BG1 NPC project component that already modifies SONNER.DLG, adding a few states. The code above assumes that state 27 in SONNER.DLG is the next free state when it is not. The code under /****** TELMAN ******/ also uses EXTERN to reference state 27. At first I thought I could use READ_SHORT 0x8 statesnum to count the number of states and replace 27 with "(%statesnum% + 1) but I don't think it works. Any suggestions? Thanks! Quote Link to comment
jastey Posted March 7, 2023 Share Posted March 7, 2023 Instead of using fixed numbers, just use a name for your new dialogue states. Like, "new_27". Weidu will add it to the existing dlg and give it the appropriate number. Just a note:ALTER_TRANS is a rather non-compatible way of altering dialogue states as it replaces what would have been there. If there is cases in your code where you want to add a trigger or an action, better switch to ADD_TRANS_ACTION or ADD_STATE_TRIGGER. Quote Link to comment
Salk Posted March 7, 2023 Author Share Posted March 7, 2023 Now it's been some time but I think that originally I didn't have a state number but rather something like you suggested: newstate1. But if I remember well, things wouldn't work because later in the code I have: /****** TELMAN ******/ APPEND TELMAN IF WEIGHT #6 ~Global("TenyaStory","GLOBAL",1) ~ THEN BEGIN 15 // from: SAY @209 /* ~You again?~ */ IF ~~ THEN EXTERN ~SONNER~ 27 END END And there I should also replace 27 with newstate1. I think it wouldn't work and that's why I changed to a direct state number, but unfortunately at the moment I am unable to test it. Thanks for the advice about ALTER_TRANS. I usually use ADD_TRANS_ACTION and ADD_STATE_TRIGGER but I seem to remember that in some cases I was sort of forced to use ALTER_TRANS. Quote Link to comment
jastey Posted March 7, 2023 Share Posted March 7, 2023 2 hours ago, Salk said: And there I should also replace 27 with newstate1 Yes, and that should work. If it doesn't then there is something with syntax etc. and the exact error message would be interesting. 2 hours ago, Salk said: I usually use ADD_TRANS_ACTION and ADD_STATE_TRIGGER but I seem to remember that in some cases I was sort of forced to use ALTER_TRANS. Yes, if it doesn't work in any other way then your vision of your mod goes first. It's just that I saw people using this in cases where it wouldn't have been necessary, erasing other mod added changes. Quote Link to comment
subtledoctor Posted March 7, 2023 Share Posted March 7, 2023 Dunno if it helps - I am a rank amateur at this sort of thing - but I simply appended new states when changing Gaelan’s dialogue, using Weidu state names. Works fine, Weidu replaces the names with numbers and it all links up. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.