Jump to content

How to set up NPC action in proximity to an area exit?


ericp07

Recommended Posts

If my mod NPC is in close enough proximity to the entrance to a lair (which I understand to be an area exit), how should I code to simulate the NPC's discovering signs of activity that would be read and interpreted, leading the NPC to correctly determine that the lair is, in fact, the one the party seeks? Picture a ranger (Aragorn/Strider, if you're familar with Lord of the Rings) inspecting a small area and interpreting what has happened based on evidence in that area. Or, picture a CSI team gathering evidence at a crime scene :thumbsup:

 

To implement this in my mod, I'd like my ranger to, at a certain distance from Firkraag's lair in AR1200, perform a little search and report to the PC that she's certain that this is the lair entrance. I've looked through iesdp, but didn't determine which elements would be involved in such a construction.

 

Thanks,

Eric

Link to comment

Add a region trigger somewhere near the entrance (use 'fj_area_struct' function from WeiDU) and give it a script with the following (untested)

IF
 Range("meleryn",20) // set the desired value
 InParty("meleryn")
 !StateCheck("meleryn",CD_STATE_NOTVALID)
 Global("warned_lair","ar1200",0)
THEN
 RESPONSE #100
SetGlobal("warned_lair","ar1200",1)
ActionOverride("meleryn",StartDialogNoSet(Player1))
END

Link to comment
Add a region trigger somewhere near the entrance (use 'fj_area_struct' function from WeiDU) and give it a script with the following (untested)
IF
 Range("meleryn",20) // set the desired value
 InParty("meleryn")
 !StateCheck("meleryn",CD_STATE_NOTVALID)
 Global("warned_lair","ar1200",0)
THEN
 RESPONSE #100
SetGlobal("warned_lair","ar1200",1)
ActionOverride("meleryn",StartDialogNoSet(Player1))
END

 

Already looking to sort this one out. I don't know how to do the trigger part; I saw something regarding range in iesdp, but it was somewhat different, so I didn't think it was the right choice. I'll adapt the script above...it belongs in my AR1200.baf, right?

 

And now, of course, I'm second-guessing myself. Is it reasonable to believe that the dragon would use that lair entrance for his comings and goings, or might he prefer a nice big hole in his roof that opens to the sky? Regardless, this kind of proximity setup will likely prove useful to simulate tracking and closely related clue-detection...

 

Thanks!

Eric

(Who--believe it or not--is writing dialogue)

Link to comment

If it's an entrance to another area, it's already a travel region and has a script name. Wouldn't a simple Range() check suffice?

 

Edit: and if it doesn't, adding regions to the area is overkill. Stick an invisible creature at the entrance and do a Range check with it instead.

Link to comment

bg1npc does this by creating a trap who's script sets the global, and I think I have seen some other mods using a scriptblock that fires off when in range of an invisible .cre summoned at coordinates close by, but I think Ardanis' usage is both easier and cleaner.

 

The only reason I even mentioned invisible .cre is that it is a "cheap" way in terms of time and in terms of flexibility; there should be no reason with modern macros why adding a trigger, trap, info point, etc. Couldn't be done just as easily. I have been thinking about DA:O's "banter trigger areas", and the way that might work to enhance area entries. I think most people didn't bother with this kind of triggered-when-coordinates-passed-over was because area and local scripts worked well enough, and most folks didn't need that level of specificity (Coran's sighting the dragon skeleton in BG is the only one that springs to mind, but there is an example of it somewhere in vanilla, too, I think.)

 

You have got me thinking again about this kind of thing, though.

Link to comment
If it's an entrance to another area, it's already a travel region and has a script name. Wouldn't a simple Range() check suffice?

And yes indeed, Range("Tran1201",30) returns true as you approach the entrance. No need for area hacks or invisible creatures.

Link to comment
If it's an entrance to another area, it's already a travel region and has a script name. Wouldn't a simple Range() check suffice?

And yes indeed, Range("Tran1201",30) returns true as you approach the entrance. No need for area hacks or invisible creatures.

 

Excellent, I'll substitute that for Range("EP#Mel",20), yielding:

 

IF
 Range("Tran1201",30) // set the desired value
 InParty("EP#Mel")
 Global("EP#MelWarned_Lair","ar1200",0)
THEN
 RESPONSE #100
SG("EP#MelWarned_Lair","ar1200",1)
ActionOverride("EP#Mel",StartDialogNoSet(Player1))
END

 

Sehr gut?

- E

Link to comment
Add an area check as well, as tran1201 is not unique. Otherwise your character will start stuttering when you reach ar1202 and it's tran1201 travel region back to ar1201.

 

So, I'll add Area("AR1200") to the script's conditions, and this should be all set. Yeah, it would be silly to have Meleryn do the same thing at the lair's exit back into AR1200 *L*

 

Thanks!

Eric

Link to comment

Archived

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

×
×
  • Create New...