Jump to content

How is this script supposed to work?


lynx

Recommended Posts

I'm finishing the 10pp playthrough, but just before scaling the Tree of life, Saradas bugs out. This NPC doesn't look maintained or that popular, so I'm not sure it isn't a bug in the mod itself.

 

Anyway, what happens is that an invisible observer (!spotted.cre) is spawned to start a cutscene. This is its only script and it has no interesting effects (invisibility, non-detection and minhp):

IF
  See([pc])
THEN
  RESPONSE #100
    SmallWait(12)
    StartCutScene("!scut02")
    DestroySelf()
END

The cutscene has:

IF
  Global("!Sarafin","GLOBAL",0)
THEN
  RESPONSE #100
    CutSceneId(Player1)
    StartCutSceneMode()
    ClearAllActions()
    FadeToColor([30.0],0)
    Wait(1)
    JumpToPoint([469.639])
    SmallWait(5)
    Face(4)
    MoveViewPoint([469.639],INSTANT)
    ActionOverride(Player2,JumpToPoint([473.639]))
    ActionOverride(Player3,JumpToPoint([511.637]))
    ActionOverride(Player4,JumpToPoint([511.603]))
    ActionOverride(Player5,JumpToPoint([547.634]))
    ActionOverride(Player6,JumpToPoint([547.602]))
    ActionOverride(Player7,JumpToPoint([547.602]))
    ActionOverride(Player8,JumpToPoint([547.602]))
    SmallWait(1)
    ActionOverride(Player2,Face(4))
    ActionOverride(Player3,Face(4))
    ActionOverride(Player4,Face(4))
    ActionOverride(Player5,Face(4))
    ActionOverride(Player6,Face(4))
    ActionOverride(Player7,Face(4))
    ActionOverride(Player8,Face(4))
    SmallWait(12)
    FadeFromColor([20.0],0)
    SmallWait(12)
    CreateVisualEffect("spdimndr",[348.587])
    Wait(3)
    CreateCreature("!Sarafin",[348.587],14)
    SetGlobal("!Sarafin","GLOBAL",1)
    Wait(3)
    EndCutSceneMode()
END

ClearAllActions wipes the observer's queue too, so it doesn't selfdestruct and keeps replaying the cutscene. My question is, is this all as expected or did I find another exception for CAA? The area script has nothing besides observer spawning and nothing calls SetInterrupt.

Link to comment

Change the .cre to set a variable on sight instead of starting the cutscene,

Start the cutscene from the area script detecting the var and advancing it,

Advance again either where it is (which seems to be failing) or somewhere else,

Swap the DestroySelf() to the area script and use ActionOverride() whenthe var is advanced,

and things might work.

 

I have seen this kind of construction in (very) older mods, but I know I have personally fubar'd my own work by trying to emulate those.

Link to comment

I have tested the scripts dozens of times and this bug you mentioned never happened a single time in my game.

The observer actually gets destroyed because the cutscene's chain of events occurs after the observer's one.

Link to comment

gemrb. :p That's why I was asking if there was a gap in community knowledge on how ie works.

 

just sticking a smallwait, breakinstants or similar into the start of the cutscene would probably do it too.

Link to comment

I'm working on a much more complex mod and everything works fine even with my "poor" way of coding. Maybe in the EE, the infinity engine has some different ways of handling the scripts: what perfectly works in the EE might not be as succesful in the vanilla version....I'm just assuming, since I have no problems at all with this chain of events in the EE version.

Link to comment

@Saradas - no worries - we are trying to help diagnose a problem.

 

What works on a single install (and even on several beta-tester installs) =/= what happens in the field, where things are put on multiple engines, in conjunction with many different mods and fixpacks, etc. I spent a good while having folks have a cutspy scene and a regular cutscene in BG1NPC fail randomly in the field, for no rational reason - couldn't track down the conditions under which it failed. The result is what I suggested, because that was what stopped the random bug reports. Other folks are suggesting less drastic changes based on what they have seen in the field.

 

Every coder has written non-robust code, and there is no shame in that. Heck, I make a whole hobby of doing really bad code, then trying to figure out what I completely misunderstood :) In fact, the original vanilla game had alot of "non-robust" code. That's why we have Fixpacks. And a whole modding scene. And a bunch of Mega-Install folks sending even more bugfixes 12 years after the mods in question were first introduced.

Link to comment

Check the new scripts. I moved the DestroySelf() command to the cutscene code and added a global check/set in the observer's script. This might fix the issues

IF
  See([pc])
Global("!Sarafin","GLOBAL",0)
THEN
  RESPONSE #100
    SmallWait(12)
 SetGlobal("!Sarafin","GLOBAL",1)
    StartCutScene("!scut02")
  END
IF
  TRUE()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    StartCutSceneMode()
    ClearAllActions()
ActionOverride("!spotted",DestroySelf())
    FadeToColor([30.0],0)
    Wait(1)
    JumpToPoint([469.639])
    SmallWait(5)
    Face(4)
    MoveViewPoint([469.639],INSTANT)
    ActionOverride(Player2,JumpToPoint([473.639]))
    ActionOverride(Player3,JumpToPoint([511.637]))
    ActionOverride(Player4,JumpToPoint([511.603]))
    ActionOverride(Player5,JumpToPoint([547.634]))
    ActionOverride(Player6,JumpToPoint([547.602]))
    ActionOverride(Player7,JumpToPoint([547.602]))
    ActionOverride(Player8,JumpToPoint([547.602]))
    SmallWait(1)
    ActionOverride(Player2,Face(4))
    ActionOverride(Player3,Face(4))
    ActionOverride(Player4,Face(4))
    ActionOverride(Player5,Face(4))
    ActionOverride(Player6,Face(4))
    ActionOverride(Player7,Face(4))
    ActionOverride(Player8,Face(4))
    SmallWait(12)
    FadeFromColor([20.0],0)
    SmallWait(12)
    CreateVisualEffect("spdimndr",[348.587])
    Wait(3)
    CreateCreature("!Sarafin",[348.587],14)
    Wait(3)
    EndCutSceneMode()
END
Link to comment

Archived

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

×
×
  • Create New...