eugene Posted September 30, 2012 Share Posted September 30, 2012 hello everyone, i am trying to finalize my mod but having some dialog issues about firing (actually not firing) texts. what i want to see is below, assume Player1, custom NPC, Jan, Edwin and Minsc are in party. Custom NPC> here are the pills, blue and red, take one. Jan> take red, and then give it to me Edwin> take blue Valygar> take both (not firing because not in party) Minsc> smash the pill Viconia> dont take any (not firing because not in party) ...Custom NPC>... dont interfere with <CHARNAME>'s decision (this talk is not required actually but i thought it is due to engine limitations) <Player option> red please <Player option> blue please <Player option> i hate pills INTERJECT did not work as i expected. only last added worked (in my case it was Jan's), I wanted all of them fire as listed. if bioware NPCs are not in party, skip their talks. CHAIN is something else as far as i know. any idea how to script it easily? I think i can script them one-by-one manually (check Jan if exists talk and go to minsc's, if minsc is not here go to edwin etc...). For a very simple talk this would require so many code to write. thanks Link to comment
Bookwyrme Posted September 30, 2012 Share Posted September 30, 2012 1) Go here and read this: http://katbella.com/npcguide/ 2) If I understand what you want, CHAIN is preciesly want you want. // set your basic conditions (PC & your NPC are in party & can talk, we're not in the middle of a fight, etc): CHAIN IF ~ CombatCounter(0) !See([ENEMY]) InMyArea(Player1) InParty("customnpc") !StateCheck("customnpc",CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) Global("custom","GLOBAL",0)~ THEN c#cust cchat ~Here are the pills, blue and red, take one,~ DO ~SetGlobal("custom","GLOBAL",1)~ // you don't want this endlessly firing //Add anyone else you want, checking availability as you go: == BJAN IF ~InMyArea("Jan") InParty("Jan") !StateCheck("Jan",CD_STATE_NOTVALID)~THEN ~take red, and then give it to me~ == BEDWIN IF ~InMyArea("Edwin") InParty("Edwin") !StateCheck("Edwin",CD_STATE_NOTVALID)~ THEN ~Take blue.~ == BVALYGA IF ~InMyArea("Valygar") InParty("Valygar") !StateCheck("Valygar",CD_STATE_NOTVALID)~ THEN ~Don't trust either one.~ //note: If he's not in party, dead, or out of range, he won't talk; the same is true of the others. //And etc--and no, custom doesn't need the final word. END ++ ~Red, please.~ EXIT // or extern, depending on whether this goes on. ++ ~Blue, please.~ EXIT ++ ~I hate pills.~ EXIT CHAIN lets you sew together as many different possible speakers as you want. EDIT: Chosen of Mystra used to have a really good thread on the uses & abuses of CHAIN, but now they've moved servers, I don't know where it is. Someone else may be able to link you to it, though. Link to comment
eugene Posted October 2, 2012 Author Share Posted October 2, 2012 thanks for the answer Bookwyrme. I will try this tonight. I didnot post full code because it was long Yes, katbella's guide was the initial tutorial i checked. later on i moved to existing script reading. As fas as i know chain is used for NPC banters but i need this talk to appear in a lovetalk for example so the main talk will start with sth like IF ~Global("NPCLT","LOCALS",10)~ BEGIN NPCLT#5. I havenot seen any "jump" to a chain in other mods but will try to extern C#CUST CCHAT from your example. From other mods' scripts i saw INTERJECT_COPY_TRANS was what i required but for some reason it does not work on custom NPC dialogs. Is this correct or did i misunderstood the concept? thanks Link to comment
Jarno Mikkola Posted October 2, 2012 Share Posted October 2, 2012 EDIT: Chosen of Mystra used to have a really good thread on the uses & abuses of CHAIN, but now they've moved servers, I don't know where it is. Someone else may be able to link you to it, though. Could this be the one ? Link to comment
Bookwyrme Posted October 2, 2012 Share Posted October 2, 2012 There's no particular "right" or "wrong" when it comes to CHAIN and long form. The way I understand it, long form is mildly more efficient behind the scenes. CHAIN, however, is perfect for--was designed for--the kind of "everyone sings (unless they're dead)" sort of thing you're wanting. You can jump back and forth between long form and CHAIN til the cows come home; the computer doesn't care. The only problem it might pose for *you* is keeping track of what you're doing. Yep, Jarno Mikkola, that looks liek what I was thinking of. Link to comment
eugene Posted October 3, 2012 Author Share Posted October 3, 2012 thanks for the tutorial link and CHAIN example. I did not know I could use chain here. After a few tries I made it working. A few globals are required i think because the conversation which should not be fired from nowhere, popped up with CTRL+I I would copy paste the script here but it is too long. basically "IF ~~ EXTERN C#CUSTOM SOMESTATENAME" worked even if SOMESTATENAME is chain or something else. one more thing to simplify my code but something like below does not exist i guess: CHAIN IF ~some condition~ THEN C#CUSTOM SOMESTATENAME @1 == ~BANOMEN~ @2 IF ~some another weird condition ~ EXTERN ~BANOMEN~ ANOMENTALKSALOTSTATE // because it becomes too "complicated" here, anomen talks there and comes here to check jan maybe == ~BJAN~ ..... .... .... END // extern here to go to somewhere how i handled is, I ended the chain after BANOMEN line and handled cases with globals. I could not made the line "IF ~some another weird condition ~ EXTERN ~BANOMEN~ ANOMENTALKSALOTSTATE" working because WEIDU says parser failed. it is not that important as I implemented in long way but still good to know if possible. thanks a lot, cya Link to comment
Bookwyrme Posted October 3, 2012 Share Posted October 3, 2012 I need to see the whole--Globals incldued--before I can answer. Can't quite figure out what it is you're asking, or where you put the globals etc. So, yeah, go ahead & post the whole thing. Link to comment
Mike1072 Posted October 4, 2012 Share Posted October 4, 2012 Delve into the WeiDU readme to check syntax. I don't think what you're doing is valid .D code (check info on CHAIN here, and check out chainText). There is probably a way to do what you're asking but I'm not familiar enough with .D to know the best way. Link to comment
eugene Posted October 4, 2012 Author Share Posted October 4, 2012 Mike1072: according to the list of chaintext it is not possible i guess. it does not mention about any "jump" action. Bookwyrme: here is the code as you are interested. I dont claim it is the best solution but it works for my needs. beware, it is long and yes, it is for probably 10 lines of dialogue CHAIN IF ~Global("EU#LLT23.Party","LOCALS",0)~ THEN ~BEU#LENA~ EU#LLT23#Party @3310 DO ~SetGlobal("EU#LLT23.Party","LOCALS",1)~ == ~BJAHEIR~ IF ~InParty("Jaheira") InParty("Cernd") Global("EU#LLT23.Party.JaheiraCernd","LOCALS",0) !StateCheck("Jaheira",CD_STATE_NOTVALID) !StateCheck("Cernd",CD_STATE_NOTVALID)~ THEN @3311 DO ~SetGlobal("EU#LLT23.Party.JaheiraCernd","LOCALS",1)~ == ~BCERND~ IF ~!InParty("Jaheira") InParty("Cernd") Global("EU#LLT23.Party.Cernd","LOCALS",0) !StateCheck("Cernd",CD_STATE_NOTVALID)~ THEN @3312 DO ~SetGlobal("EU#LLT23.Party.Cernd","LOCALS",1)~ == ~BJAHEIR~ IF ~InParty("Jaheira") !InParty("Cernd") Global("EU#LLT23.Party.Jaheira","LOCALS",0) !StateCheck("Jaheira",CD_STATE_NOTVALID)~ THEN @3313 DO ~SetGlobal("EU#LLT23.Party.Jaheira","LOCALS",1)~ == ~BEDWIN~ IF ~InParty("Edwin") Global("EU#LLT23.Party.Edwin","LOCALS",0) !StateCheck("Edwin",CD_STATE_NOTVALID)~ THEN @3314 DO ~SetGlobal("EU#LLT23.Party.Edwin","LOCALS",1)~ == ~BMAZZY~ IF ~InParty("Mazzy") InParty("Korgan") Global("EU#LLT23.Party.KorganMazzy","LOCALS",0) !StateCheck("Mazzy",CD_STATE_NOTVALID) !StateCheck("Korgan",CD_STATE_NOTVALID)~ THEN @3320 DO ~SetGlobal("EU#LLT23.Party.KorganMazzy","LOCALS",1)~ == ~BMAZZY~ IF ~!InParty("Korgan") InParty("Mazzy") Global("EU#LLT23.Party.Mazzy","LOCALS",0) !StateCheck("Mazzy",CD_STATE_NOTVALID)~ THEN @3322 DO ~SetGlobal("EU#LLT23.Party.Mazzy","LOCALS",1)~ == ~BKORGAN~ IF ~InParty("Korgan") !InParty("Mazzy") Global("EU#LLT23.Party.Korgan","LOCALS",0) !StateCheck("Korgan",CD_STATE_NOTVALID)~ THEN @3321 DO ~SetGlobal("EU#LLT23.Party.Korgan","LOCALS",1)~ == ~BHAERDA~ IF ~InParty("HaerDalis") InParty("Aerie") Global("EU#LLT23.Party.HaerDalisAerie","LOCALS",0) !StateCheck("HaerDalis",CD_STATE_NOTVALID) !StateCheck("Aerie",CD_STATE_NOTVALID)~ THEN @3323 DO ~SetGlobal("EU#LLT23.Party.HaerDalisAerie","LOCALS",1)~ == ~BHAERDA~ IF ~!InParty("Aerie") InParty("HaerDalis") Global("EU#LLT23.Party.HaerDalis","LOCALS",0) !StateCheck("HaerDalis",CD_STATE_NOTVALID)~ THEN @3324 DO ~SetGlobal("EU#LLT23.Party.HaerDalis","LOCALS",1)~ == ~BAERIE~ IF ~InParty("Aerie") !InParty("HaerDalis") Global("EU#LLT23.Party.Aerie","LOCALS",0) !StateCheck("Aerie",CD_STATE_NOTVALID)~ THEN @3325 DO ~SetGlobal("EU#LLT23.Party.Aerie","LOCALS",1)~ == ~BJAN~ IF ~InParty("Jan") Global("EU#LLT23.Party.Jan","LOCALS",0) !StateCheck("Jan",CD_STATE_NOTVALID)~ THEN @3365 DO ~SetGlobal("EU#LLT23.Party.Jan","LOCALS",1)~ == ~BVICONI~ IF ~InParty("Viconia") InParty("Valygar") Global("EU#LLT23.Party.ViconiaValygar","LOCALS",0) !StateCheck("Viconia",CD_STATE_NOTVALID) !StateCheck("Valygar",CD_STATE_NOTVALID)~ THEN @3366 DO ~SetGlobal("EU#LLT23.Party.ViconiaValygar","LOCALS",1)~ = @3367 == ~BVICONI~ IF ~!InParty("Valygar") InParty("Viconia") Global("EU#LLT23.Party.Viconia","LOCALS",0) !StateCheck("Viconia",CD_STATE_NOTVALID)~ THEN @3368 DO ~SetGlobal("EU#LLT23.Party.Viconia","LOCALS",1)~ == ~BVALYGA~ IF ~InParty("Valygar") !InParty("Viconia") Global("EU#LLT23.Party.Valygar","LOCALS",0) !StateCheck("Valygar",CD_STATE_NOTVALID)~ THEN @3369 DO ~SetGlobal("EU#LLT23.Party.Valygar","LOCALS",1)~ END IF ~InParty("Imoen2") Global("EU#LLT23.Party.Imoen","GLOBAL",0) !StateCheck("Imoen2",CD_STATE_NOTVALID)~ EXTERN ~BIMOEN2~ EU#LLT23#Party.Imoen IF ~OR(2) !InParty("Imoen2") StateCheck("Imoen2",CD_STATE_NOTVALID) InParty("Anomen") Global("EU#LLT23.Party.Anomen","GLOBAL",0) !StateCheck("Anomen",CD_STATE_NOTVALID)~ DO ~SetGlobal("EU#LLT23.Party.Imoen","GLOBAL",1)~ EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen IF ~OR(2) !InParty("Imoen2") StateCheck("Imoen2",CD_STATE_NOTVALID) OR(2) StateCheck("Anomen",CD_STATE_NOTVALID) !InParty("Anomen")~ DO ~SetGlobal("EU#LLT23.Party.Imoen","GLOBAL",1) SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Imoen","GLOBAL",0)~ THEN ~BIMOEN2~ EU#LLT23#Party.Imoen @3315 = @3316 END IF ~InParty("Anomen") Global("EU#LLT23.Party.Anomen","GLOBAL",0) !StateCheck("Anomen",CD_STATE_NOTVALID)~ THEN REPLY @3317 DO ~SetGlobal("EU#LLT23.Party.Imoen","GLOBAL",1)~ EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen IF ~OR(2) !InParty("Anomen") StateCheck("Anomen",CD_STATE_NOTVALID)~ THEN REPLY @3317 DO ~SetGlobal("EU#LLT23.Party.Imoen","GLOBAL",1) SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 IF ~~ THEN REPLY @3318 EXTERN ~BIMOEN2~ EU#LLT23#Party.Imoen.2 CHAIN IF ~Global("EU#LLT23.Party.Imoen","GLOBAL",0)~ THEN ~BIMOEN2~ EU#LLT23#Party.Imoen.2 @3319 DO ~SetGlobal("EU#LLT23.Party.Imoen","GLOBAL",1)~ END IF ~InParty("Anomen") Global("EU#LLT23.Party.Anomen","GLOBAL",0) !StateCheck("Anomen",CD_STATE_NOTVALID)~ EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen IF ~OR(2) !InParty("Anomen") StateCheck("Anomen",CD_STATE_NOTVALID)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen @3326 END IF ~~ THEN REPLY @3327 EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.2 IF ~CheckStatGT(Player1,15,CHR)~ THEN REPLY @3350 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.3 IF ~!CheckStatGT(Player1,15,CHR)~ THEN REPLY @3350 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.4 IF ~~ THEN REPLY @3361 EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.5 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen.2 @3328 == ~BEU#LENA~ @3329 = @3330 == ~BANOMEN~ @3331 END IF ~CheckStatGT(Player1,15,CHR)~ THEN REPLY @3332 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.6 IF ~!CheckStatGT(Player1,15,CHR)~ THEN REPLY @3332 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.7 IF ~~ THEN REPLY @3344 EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.8 IF ~~ THEN REPLY @3349 DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BEU#LENA~ EU#LLT23#Party.Anomen.3 @3351 = @3352 = @3353 END IF ~~ THEN REPLY @3354 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.10 IF ~~ THEN REPLY @3355 EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.11 IF ~~ THEN REPLY @3357 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.10 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BEU#LENA~ EU#LLT23#Party.Anomen.4 @3351 = @3358 == ~BANOMEN~ @3359 == ~BEU#LENA~ @3360 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen.5 @3362 == ~BEU#LENA~ @3363 = @3364 END IF ~~ EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.8 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BEU#LENA~ EU#LLT23#Party.Anomen.6 @3333 = @3334 = @3335 END IF ~~ THEN REPLY @3336 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.10 IF ~~ THEN REPLY @3338 EXTERN ~BANOMEN~ EU#LLT23#Party.Anomen.9 IF ~~ THEN REPLY @3340 EXTERN ~BEU#LENA~ EU#LLT23#Party.Anomen.10 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BEU#LENA~ EU#LLT23#Party.Anomen.7 @3333 = @3341 == ~BANOMEN~ @3342 == ~BEU#LENA~ @3343 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen.8 @3345 == ~BEU#LENA~ @3346 == ~BANOMEN~ @3347 = @3348 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen.9 @3339 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BEU#LENA~ EU#LLT23#Party.Anomen.10 @3337 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 CHAIN IF ~Global("EU#LLT23.Party.Anomen","GLOBAL",0)~ THEN ~BANOMEN~ EU#LLT23#Party.Anomen.11 @3356 END IF ~~ DO ~SetGlobal("EU#LLT23.Party.Anomen","GLOBAL",1)~ EXTERN ~BEU#LENA~ EU#LLT23#18 Link to comment
Kaeloree Posted October 5, 2012 Share Posted October 5, 2012 The reason this triggers with CTRL+I is because the dialogue trigger is always true. In order to choose when this triggers, you the trigger should be 1, not 0. In order to trigger the dialogue you must do so from her script; if the conditions for triggering are met, you must then set the variable to 1, and then use Interact() to force the game to look through her B file for a dialogue to trigger. However, if this dialogue doesn't have the lowest weight (as in, it's not at the very top of the B file), anything that is true before it will trigger instead of your dialogue, probably causing a stutter bug. I would recommend moving this file to her J script (her joined script), which we use for interjections and triggered dialogues, to prevent this from happening. In order to force the game to look through her J file for a dialogue to trigger, you must use one of the Dialogue() variants. Link to comment
Bookwyrme Posted October 6, 2012 Share Posted October 6, 2012 I doubt that you need all those Globals, but I can't really tell because without the dialog, I cannot tell *why* you are doing it hat way/what you're trying to accomplish. I'd reccomend against traifying before you're finished, anyway. It complicates an already complicated process. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.