Jump to content

[solved] Coding Looped Dialogue: transactions do not get performed


jastey

Recommended Posts

I have a dialogue like this:

IF ~~ THEN BEGIN giveitems
SAY ~So, what can you give me?~
+ ~PartyHasItem("xxxitem1") Global("Locals1","LOCALS",0)~ + ~Here is item 1.~ DO ~SetGlobal("Locals1","LOCALS",1) TakePartyItemAll("xxxitem1") IncrementGlobal("Itemcounter","GLOBAL",1) DestroyItem("xxxitem1") AddexperienceParty(50)~ + intermediate
+ ~PartyHasItem("xxxitem2") Global("Locals2","LOCALS",0)~ + ~Here is item 2.~ DO ~SetGlobal("Locals2","LOCALS",1) TakePartyItemAll("xxxitem2") IncrementGlobal("Itemcounter","GLOBAL",1) DestroyItem("xxxitem2") AddexperienceParty(50)~ + intermediate
+ ~PartyHasItem("xxxitem3") Global("Locals3","LOCALS",0)~ + ~Here is item 3.~ DO ~SetGlobal("Locals3","LOCALS",1) TakePartyItemAll("xxxitem3") IncrementGlobal("Itemcounter","GLOBAL",1) DestroyItem("xxxitem3") AddexperienceParty(50)~ + intermediate
+ ~PartyHasItem("xxxitem4") Global("Locals4","LOCALS",0)~ + ~Here is item 4.~ DO ~SetGlobal("Locals4","LOCALS",1) TakePartyItemAll("xxxitem4") IncrementGlobal("Itemcounter","GLOBAL",1) DestroyItem("xxxitem4") AddexperienceParty(50)~ + intermediate
++ ~That's all I have.~ EXIT
END

IF ~~ THEN intermediate
SAY ~Aha. I see.~
IF ~~ THEN + giveitems
END



For the classic BGII engine (BGT game), the actions do not get performed - at all. Neither gets the local variables set so the reply options diminish after choosing them while looping through the dialogue, nor are the items taken.
Before I start narrowing this down to certain transaction etc.pp - Does anyone have experience with this? I know it takes 2-3 lines until the engine manages to set variables in a dialogue, but why isn't any of the transactions working in this case?

Link to comment

Have you tested the whole thing without a subsequent transition to (+intermediate)? The mix of actions you have in the DO may only work at the dialogue end due to the timings.

(In EE you could trigger a script to do the actions with a single global/local, but in classic game such a script would only fire after you completed the dialogue.)

 

Does anyone have experience with this?

My experience is that dialogues like this create endless loops - yours has the emergency exit, so at least you can always use that.

Link to comment

As far as i know. Blocking actions are not executed until you exit the dialog (or switch dialog owner?), and non-blocking actions are executed one response later than they were written.

In the EE, you can flag a block of actions as 'execute immediate'.

Link to comment

argent77: Thank you for the link. All actions from above are listed there. :-(

 

Roxanne: The dialogue is all about handing over a lot of collected items one after the other. I wouldn't know how to do it without a looping dialogue (it loops on purpose).

Link to comment

Roxanne: The whole dialogue is for one NPC only, so she is the owner.

If I put the above actions into her script triggered by the local variables, they are executed after the dialogue (in vanilla BG1+TotSC For the BGII engine, I am not that far into testing yet.)

 

EDIT. That was the funny part: in vanilla BG1:TotSC, (at least) the locals get set and the reply options vanish during the dialogue. In BGII, this didn't work.

Link to comment
The whole dialogue is for one NPC only, so she is the owner.

I was just asking because it might have been a summoned or re-appearing creatures . so Locals would not be stored...

 

Maybe for your purpose you should consider to do it like it is done for Cespenar (Botsmith.dlg) or what-is-his-name-in-the-docks-smith instead of the loop?

 

PS - I remember a number of discussions on the Instant.ids and how it actually works in dialogues, i.e there is a discrepancy between specification and what we observe in the game - especially like in the case here where 4 of those actions are supposed to be *instant* at the same time (like I said earlier, those actions take different durations, e.g. the take all party items from all the NPCs inventories...). I have seen some single instant actions work but more often I have seen situations like the problem presented here. I have learned to avoid them.

Link to comment

I can specify the problem now.

 

For the BGII engine, if I split the "intermediate" dialogue state into two, the DestroyItem (and probably the SetGlobal, too) gets executed upon transition during the dialogue, but only for the first item / reply option I click.

 

All others are executed upon exiting the whole dialogue. This is also true for the SetGlobal() action, meaning that the reply option do not diminish while cycling teh loop.

 

Thus, the intended behavior works for the first item, after that, I can click on the remaining reply options indefinitely while I'm in the loop, and the items /variables are taken care of when I exit the dialogue.

 

(This is actually a case where the BG1 engine seems to be superior to the BGII engine. There, the SetGlobal() works during the dialogue so the reply options diminish while stating in the dialogue that the PC hands over the items. The BG1 engine then doesn't execute the DestroyItems, though.)

Link to comment

The EE engine provides additional flags for dialog transitions:

Bit 0: Text associated
Bit 1: Has trigger
Bit 2: Has action
Bit 3: Terminates dialogue
Bit 4: Journal entry
Bit 5: Interrupt (it's supposed to be used for interjections, but I haven't seen it used yet)
Bit 6: Add unsolved quest
Bit 7: Add journal note
Bit 8: Add solved quest
Bit 9: EE: Execute immediate (executes non-blocking script actions instantly)
Bit 10: EE: Clear actions

Bit 9 "Execute immediate" might be of interest to you. WeiDU supports setting these flags directly (by using FLAGS keyword).

Link to comment

Thanks, I need to test the dialogue on BG:EE first, and all in all I'll have to think about a solution that fits for all games, I fear.

One possibility may be to start cutscene mode and a cutscene with your DO. In that cutscene you execute the actions and set the globals (maybe add some effect to illustrate how the taken items are destroyed or used, if appropriate for your scene) - then at the end of the cutscene let your NPC start dialogue again for the next round of the loop.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...