Jump to content

Bug: Spawning Bodhi


Recommended Posts

Classic bug when player save and load during script execution. I believe bug is in following code (ar0801.bcs).

IF
Global("Coffin3","AR0801",2)
GlobalLT("LassalVampires","GLOBAL",3)
THEN
RESPONSE #100
	SetInterrupt(FALSE)
	SetGlobal("LassalVampires","GLOBAL",3)
	AddexperienceParty(9000)
	TakePartyItem("misc6w")
	DestroyItem("misc6w")
	CreateVisualEffectObject("SPDEATH3","Coffin3")
	Wait(1)
	CreateVisualEffectObject("SPFLESH2","Coffin3")
	CreateVisualEffect("SPCLOUD3",[480.1338])
	Wait(1)
	CreateVisualEffect("SPFLESHS",[480.1338])
	Wait(1) // If I save and load here, Bodhi won't appear and game is broken.
	CreateCreatureDoor("bodhi2",[480.1338],14)
	Wait(3)
	ActionOverride("bodhi2",StartDialogueNoSet(Player1))
	SetInterrupt(TRUE)
END

Link to comment

In my experience, variables should not be set in such code blocks until AFTER the creature is created, but before any dialog begins. It might be a good idea to set the variable in dialog as well, in case the save takes place before the dialog can be initiated.

Link to comment

I think block should be splitted to several parts. In first one you stab coffin (gain XP and lose stake), in second one Bodhi is spawned and in third one Bodhi starts to talk. Since script has to be rebuilded, I'd choose to rebuild it completely and avoid modifying dialog file. You cannot simply move that variable at the end because you'd keep gaining XP until you ran out of stakes.

 

I made a new local variable that follows Bodhi's creation progress. Only thing I am not sure of is role of SetInterrupt statement. Can somebody tell me if it has any impact on following code? If somebody wonders why is Wait(3) at the end of second block, it is because of door animation. There is actually no delay between Bodhi's appearance and dialog.

IF
Global("Coffin3","AR0801",2)
GlobalLT("LassalVampires","GLOBAL",3)
THEN
RESPONSE #100
	SetInterrupt(FALSE)
	AddexperienceParty(9000)
	TakePartyItem("misc6w")
	DestroyItem("misc6w")
	SetGlobal("LassalVampires","GLOBAL",3)
	SetGlobal("d_BodhiSpawn","AR0801",1)
	CreateVisualEffectObject("SPDEATH3","Coffin3")
	Wait(1)
	CreateVisualEffectObject("SPFLESH2","Coffin3")
	SetInterrupt(TRUE)
END

IF
Global("d_BodhiSpawn","AR0801",1)
THEN
RESPONSE #100
	SetInterrupt(FALSE)
	CreateVisualEffect("SPCLOUD3",[480.1338])
	Wait(1)
	CreateVisualEffect("SPFLESHS",[480.1338])
	Wait(1)
	CreateCreatureDoor("bodhi2",[480.1338],14)
	SetGlobal("d_BodhiSpawn","AR0801",2)
	Wait(3)
	SetInterrupt(TRUE)
END

IF
Global("d_BodhiSpawn","AR0801",2)
THEN
RESPONSE #100
	SetInterrupt(FALSE)
	ActionOverride("bodhi2",StartDialogueNoSet(Player1))
	SetGlobal("d_BodhiSpawn","AR0801",3)
	SetInterrupt(TRUE)
END

Link to comment

In retrospect, SetCutSceneLite(TRUE/FALSE) would probably be a better solution. This is a special sequence in the game that I feel shouldn't be interruptible by the player. SetCutSceneLite enables/disables a lighter version of cutscene mode that prevents the player from messing with the interface but allows scripts to continue running in the background.

Link to comment
In retrospect, SetCutSceneLite(TRUE/FALSE) would probably be a better solution. This is a special sequence in the game that I feel shouldn't be interruptible by the player. SetCutSceneLite enables/disables a lighter version of cutscene mode that prevents the player from messing with the interface but allows scripts to continue running in the background.
Agreed, works fine. (GUI disappears, save is not possible, it fits situation).
Link to comment

Added to beta fixes for the next version:

 

// bodhi's spawning should be uninterruptible
COPY_EXISTING ~ar0801.bcs~ ~override~
 DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~SetInterrupt(FALSE)~ ~SetCutSceneLite(TRUE)~
REPLACE_TEXTUALLY ~SetInterrupt(TRUE)~  ~SetCutSceneLite(FALSE)~
 COMPILE_BAF_TO_BCS
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Whatever for? Cutscene ID outside an actual cutscene script is completely pointless? I posted because I really don't know that the action exists in non-ToB installs (I think the cursor state action, which is the exact same thing, may exist, but who knows?).

 

Cutscene mode will suck unless you're willing to MoveViewPoint([480.1338],0). For a true fix, it may just be better to move the variables (this is a problem everywhere Wait() is used, and I'm not sure adding cutscenes left and right is really that kosher)?

Link to comment

How's this work for everyone? It moves the SetGlobal to immediately prior to Bodhi's spawning. If the game is saved and reloaded prior to Bodhi's appearance, it'll go through the sequence again and try to spawn her.

 

// bodhi broken if saved during her wait()-laden spawn
COPY_EXISTING ~ar0801.bcs~ ~override~
 DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~SetGlobal("LassalVampires","GLOBAL",3)~ ~~
REPLACE_TEXTUALLY ~CreateCreatureDoor("bodhi2",[480.1338],14)~  
  ~SetGlobal("LassalVampires","GLOBAL",3) CreateCreatureDoor("bodhi2",[480.1338],14)~
 COMPILE_BAF_TO_BCS
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

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

×
×
  • Create New...