Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Moving an NPC to a marker at quest stage


syscrusher
 Share

Recommended Posts

Okay, I have this working right now, but I'm not terribly happy with the way I did it, so I'm looking for suggestions of a better approach.

I have an NPC who normally wanders about my town. At a particular stage of the quest, he needs to be put in jail. The good news is that when that quest stage activates, I can guarantee the player is nowhere near the NPC or the jail. (The player is far away talking to another NPC at a fixed location, and that dialog updates the quest stage.)

What I have now is a quest stage result script that does a "movetomarker" on the jail-bound NPC, and he has a high-priority AI package that tells him to wander within a few units of the marker.

This is working, but what I've found is that the NPC being not in the same cell as the player causes his AI not to always evaluate right away (backgrounded), so sometimes he isn't in the cell until the player gets close, then he goes there by walking. I think what may be going on, really, is that he got moved to the marker on schedule by the movetomarker call, but then his previously-active AI package made him leave it until the player is close enough that his AI re-evaluates to the high-priority package.

Is there a better way to do this? The existing jail scripts in the vanilla game aren't much help because they operate on the player, so this whole issue of low-level processing is moot. I can't rely *just* on the AI to "walk him into jail" because the door is locked and he (of course) doesn't have a key.

Edited by syscrusher
Link to comment
Share on other sites

I feel stupid...it was a long day, and I asked this question totally backwards. I'm sorry. Here's what I meant:

What I *wanted* to do was to have a quest result script that did something like "myNPCref.movetomarker myMarker" and then force him to reeval his AI. But the CS won't let me compile that result script in. It issues no error message but won't let me save it. Other result scripts in the same field that don't involve the NPC ref work fine. So what I actually *did* was to have a quest script that had a GameMode that looked for the stage and did the MoveToMarker when it detected that the stage was the desired stage, and the NPC was not within a certain distance of the marker.

I'm sorry for the horrible phrasing in my question. As I say, my only excuse is that I had had a long day and just didn't think clearly when writing.

Link to comment
Share on other sites

I'm out of town right now but will be home this afternoon, and I'll post my scripts then. Thanks for the AddScriptPackage link. I had forgotten about that function. I don't think it will solve my problem, but I do think there's a good chance it will help make the AI move more quickly into the right package than just relying on conditions as I am now.

Link to comment
Share on other sites

Sorry for the delay! It's been a crazy work week.

I am pleased to say that this problem is solved. The changes I made were:

1. Added the EvaluatePackage call suggested by WillieSea -- thanks!

2. Moved the script logic, which wouldn't compile as a stage result, to the main quest script. I had done this before, but it turns out I had too many logical AND conditions, and sometimes they were not being all met. So apparently sometimes the only thing I was getting was the slow-speed AI processing, with the quest script being ignored.

3. Removed the code, no longer needed, on my NPC's own personal script. This also appears to run in the slow low-level-processing mode. Once I got the quest script code debugged, this became redundant.

Thanks for the comments, especially the suggestion of EvaluatePackage, which caused the NPC to make his dialog available instantaneously when the quest stage triggers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...