Jump to content

More Wacky AI Package Adventures.


EPDGaffney

Recommended Posts

I had a nice idea I thought, which is that during a part of my quest mod when the player is likely overencumbered, if they drop something, the hostile NPC they're trying to survive attacks from can actually pick up the player's stuff that they dropped, especially if it's the stuff they need to transport to the next building.

 

However, several problems are arising, like the NPC running all over the place instead of picking up the stuff, or constantly seeing the player and remembering he should fight the player, without picking up the stuff. And occasionally (very occasionally), it works great, and I can tell it would be phenomenal.

 

So, what package would you use for this? I tried Find but he appears to be literally 'finding' it, as in, searching for it. I may try a workaround using a marker that gets placed by the dropped items.

 

But then my problem is OnDrop can only be called on an object and the object on which I want to call it is a vanilla object, meaning I'd rather not attach a script to it. I tried making my own duplicated version of the object and did all the scripting for it and then realised that it doesn't stack with the vanilla item and looks weird in the inventory as a result. If I can get this to work, I may just accept that, but an alternative would be nice.

 

Edit: Tried marker method and he just runs to the marker, kicks the thing he's meant to pick up, and starts running in circles round the marker. The man's a legend.

Edited by EPDGaffney
Link to comment
Share on other sites

Are you just being to loose with their behavior options during the Find package ?

 

Have you tried , unchecking "Enable Fallout Behavior" Then flag "Must complete" & "Continue if near PC"

Could also check "Always Run" to get the package over with sooner & "Pretend in combat" maybe ?

 

But if you want some randomness ... put a "GetRandomPercent" in the "OnDrop Player" script block that sets this NPC's package.

 

Or what if the NPC has a block in their script , that sets the find package with a "GetDistance" to said object ?

 

or would that be to process intensive ?

Link to comment
Share on other sites

AI is finnicky and for fine-tuned stuff my only advice is to try a variety of things and back it up with scripting that checks for the package changing and forces the npc back to the one you want him to have. Eg if a "Find" is all over the place, try a "Travel", perhaps with 'must complete' flag, and then fake the picking up with scripting, maybe. Can't say much more, it's very much trial and error.

Link to comment
Share on other sites

Thanks for the responses.

 

I had a new idea, but it requires a reference to be maintained through adding and removing from containers (not via script), so to clarify, it would still be the same persistent reference regardless of what I do, correct?

 

The idea is to place the items in question (25 scrap electronics) in a hidden cell to make them persistent references and give them IDs. Then I can use a script to put them into the container where the player finds them (or can I skip most of that and assign them a reference whilst in a container in some way I don't know about?). This way, maybe instead of searching I can have him run to the specific reference IDs? But if there's 25...I don't know about that.

 

Maybe, similar idea but make it a new item that's a 'pack' of 25 scrap electronics, so that it has one ID.

 

I'm about to look more at that thread, Dubious.

 

Mktavish, I'm already doing most of that. I don't think Continue Near PC works in a way that would help here. I think it actually delays completion of the package until the player is gone, so I don't think he'd ever pick up anything.

 

DoctaSax, that's not a bad idea. I'll look at Dubious's link and consider all these options and try something.

 

Edit: Thought all the code in that link was actually part of a tutorial. Looking at it now I realise it's just a bunch of stuff that didn't work, haha. I've never worked with tokens, so I'll try my 25-pack idea and then see how tokens would help me if that doesn't work.

 

Edit 2: Wait, how can I add a specific object reference to a container? I am not seeing a way to do that. I believe that if a player or NPC picks up a reference, it stores that reference's information (because it remembers health and even scale), but I can't seem to add a reference directly to a container via script. I've looked into tokens a bit and if they can help me here, I don't quite understand how yet, so if someone can explain that I'd be grateful.

Edited by EPDGaffney
Link to comment
Share on other sites

Are you meaning that specific reference should be holding a variable in its Base-ID script ? Independent of other ref instances of the same Base-ID ... and its not doing that ?

 

But the ref going into inventory ... then comming back out ... hard to say if it is the same ref.

 

Could set the ref to a variable ,,, then place it back maybe ?

Edited by Mktavish
Link to comment
Share on other sites

Well, my new plan is to make the 25 scrap electronics into a single-item 25-pack that I've made sspecifically for this mod, then attach the following script to its Base Object:

scn GSBScrapElectronicsScript

Begin OnDrop Player
    If GetContainer == 0
        Disable
        GSBScrapElectronicsREF.MoveTo Player
        GSBViperOverlordREF.AddScriptPackage GSBViperOverlordFindScrapElectronics
    EndIf
End

There's a hidden interior cell I've made to hide stuff like GSBScrapElectronicsREF, which as you can see is meant to be moved to the player as soon as the one they drop is dropped, and then the one they dropped should disappear. However, in my very brief test, this didn't happen, and the NPC ran all over the cell we were in instead of picking up the 25-pack. Any amateur scripting errors here? Like, I can't do [blank] in an Object script or something?

 

Edit: Managed to confirm that it seamlessly switches the items and I am indeed 'dropping' the reference version. It's just that his package is all mental. I'll try some other ideas and maybe fake it.

 

Edit 2: If he doesn't detect me (and thus want to kill me), he actually runs directly to the 25-pack and retrieves it. Unfortunately, this only seems to occur if I enter the tdetect console command. Even adding the Find package via the console doesn't work as he immediately reverts to combat, presumably intending to grab it once I'm dead.

 

Edit 3: Fantastic news. I've managed to fix the majority of the problems with the SetCombatDisabled function. It's a bit of a scary function because if not used carefully, certain checks mayn't occur and then your NPC is left without combat being enabled. Have to come up with a failsafe.

 

Also, when the player picks up a persistent reference, it is always remembered, with the same ID and everything. This is now causing me a bit of grief with disappearing scrap electronics but I'll work it out most likely.

 

Edit 4: Brand new JIP function called MoveToContainer is exactly what I needed. None of that Disable and MoveTo Player smoke and mirrors. The real thing is here now.

 

Edit 5: Weirdly, now that I've updated JIP, the AI package that used to work appears to be broken. Depending on the flags I set, he just stands there with combat disabled or he throws away the Find package and returns to his standard package of sleeping, because his combat remains disabled until the item is picked up by someone.

Edited by EPDGaffney
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...