Jump to content

Scripting


SimDing0

Recommended Posts

I couldn't get Unlocked() to work for me either, so had to stick with OpenState().

 

There's a slight bug with TakePartyItemNum(). It is supposed to take the specified number of items from inventory, removing the item if the quantity becomes zero. However, this behavior changes in the case of container STO files. With these it will reduce the quantity, but will not remove the instance of the item if the quantity becomes zero. Items with zero quantities can't be seen in-game, can't be removed by TakePartyItem, and will not count toward a container's current item load. If another item of the same type is placed in the container, the quantity increases and the item again becomes visible in the container. I found this out while streamlining the drow item removal code for AR2500.BCS (and others). (I reduced the huge number of TakeItemReplace blocks to a single block that runs much, much faster.)

 

A recent experiment confirmed, for me anyway, that without INSTANT.IDS in the game, pausing dialogs won't properly execute actions except for those in the final action of a given dialog thread. Any changes made to actions in ACTION.IDS should be mirrored if the action is also specified in ACTSLEEP, INSTANT or CHASE.IDS.

 

CreateVisualEffectObject() specifies a dialog file in it's S: parameter, which used to confuse NI but that's been fixed. It should just be S:ResRef. (There's another action that has this mislabeling, but I can't remember what it is atm.) For all such visual effect actions in BG2, the engine will first look for a VVC with the specified filename. If it can't find one, it will search for a BAM with the specified filename.

 

Also in BG2, if the engine can't find a valid PLT file it will look for BAMs instead. This is what allows Lightspeed's Restored BG1 Paperdolls mod to work for BG2. The mod dumps empty (invalid) PLTs into the override folder along with corresponding BAMs that the engine will use instead.

 

 

Also, while I'm here, ARE > Animation > Flags: Bit 9 = Play all Frames. You can see this used in BG2's Temple of Lathander, the spinning globe animation that casts shadows on the statue below. This is actually several frames being played over a larger area, and in sync. Without Bit 9 enabled, only the topmost left frame plays. (This particular animation also has Bit 4: Synchronized Draw, enabled.)

Link to comment
Also note that you must capitalize the scope part of the variable name: GLOBAL works, global doesn't.

A compiler could take care of that for the user, by converting the scope variable to uppercase, in the case of predefined scopes like GLOBAL, LOCALS and MYAREA.

 

Also, it's not covered in the IESDP discussion of variables (Index > Misc > Variables) that the MYAREA scope variable in an area script will work regardless of which area the script is assigned to. Bioware uses this in creature (townsfolk) spawning script blocks that they apparently copied from one area to another. One instance is in AR0700.BCS. For the purpose of setting variables with this scope, the engine apparently substitutes the current area's designation for MYAREA, similar to what is done for the object Myself.

Link to comment
SaveCurrentLocation and ReturnToSavedLocationn seem fine to me. Note that reversal of variable name and area from the standard format in the first action, though.

 

Which number actions are these, and which engine for?

BG2: #236 and #237 are listed as working.

#244 and #245 are listed as not working - is this what is being referred to? Could you provide a sample script showing them working? They do diddly squat for me, so I'm obviously using them wrong.

Link to comment

Here's part of a patrol script I have, demonstrating their use:

 

IF
Global("StartPatrol","LOCALS",0)
Global("SeenEnemy","LOCALS",0)
OR(2)
 Global("PartOfGroup","LOCALS",0)
 Detect(NearestMyGroupOfType)
THEN
RESPONSE #100
 SetGlobal("StartPatrol","LOCALS",1)
 SetGlobalTimer("Patrol","LOCALS",12)
 SaveObjectLocation("LOCALS","DefaultLocation",Myself)
END

IF
OR(2)
 GlobalTimerExpired("Patrol","LOCALS")
 !Detect(NearestMyGroupOfType)
OR(2)
 GlobalTimerExpired("Patrol","LOCALS")
 Global("PartOfGroup","LOCALS",1)
THEN
RESPONSE #100
 MoveToSavedLocationn("DefaultLocation","LOCALS")
 SetGlobal("StartPatrol","LOCALS",0)
END

Link to comment

Archived

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

×
×
  • Create New...