Jump to content

Simple scripting question


dbianco87

Recommended Posts

Making a simple NPC mod for fun, I'm a decent writer and have a decent understanding of infinity engine file structure but am not the strongest programmer. I want a dialogue to launch as soon as the PC enters the temple district, as such I've added these lines of code to the top of the AR0900 script via weidu: (note this is a stripped down version just to see if I can get it trigger, the final will have a few extra conditions).

 

IF
Global("DBSpawnLeo", "GLOBAL", 1)
THEN
RESPONSE #100
SetGlobal("DBSpawnLeo", "GLOBAL", 2)
Continue()
END

 

DBSpawnLeo is set to 1 in the spawn script which occurs in the bridge district. There's then a dialogue where my NPC begs to be taken to the temple district. The problem is this script just does not seem to execute at all, all the other scripts for the area are running such as the ones pertaining to ghaal. When I use cluaconsole to set the DBSpawnLeo to 2 manually the dialogue triggers immediately so I know it's not that...

 

I'm sure the answer is something so simple that I'll be embarrassed but I'm fine with being embarrassed if it solves the problem.

Link to comment

Did you extent top or bottom ?
And what game are you testing this in ?

Not sure at all, but the BG2 has a few flaws in the nonEE games area scripts that might not have them execute unless you install the BG2 Fixpack. Or some other mod could be blocking your attempt if it doesn't have a Continue() in it.

Link to comment

Sorry, should have been more specific. I'm testing in BG2EE and used the extend top command: EXTEND_TOP ~AR0900.bcs~ ~LeoNPC/Script/AR0900.baf~ in my tp2.

 

When I looked at the modified script in near infinity my IF statement is now the first line in the script.

Link to comment

The

Global("DBSpawnLeo", "GLOBAL", 1)

Is really at 1 when you leave bridge district? You checked that?

 

The

SetGlobal("DBSpawnLeo", "GLOBAL", 2)

alone does not trigger your dialogue, unless you have something in your NPC script in addition to trigger the talk?

Also why clutter the area script?

 

Use your NPC's own script instead

IF
Global("DBSpawnLeo", "GLOBAL", 1)
AreaCheck("ar0900")
THEN
RESPONSE #100
SetGlobal("DBSpawnLeo", "GLOBAL", 2)
END
IF
Global("DBSpawnLeo", "GLOBAL", 2)
See(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
MoveToObject(Player1) //or not. just as you like
StartDialogNoSet("Name") //Name of your NPC's joined file containing the required dialogue
END
I understand that the dialogue itself SetGlobal("DBSpawnLeo", "GLOBAL", 3)
Link to comment

Archived

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

×
×
  • Create New...