Jump to content

Make NPC AI attack objects


Mktavish

Recommended Posts

I'm looking for some idea's on how to make buildings destroyable , but not just that. But to have an Actor detect it as an enemy and proceed to try and destroy it. Short of specific scripting to tell each enemy actor within range to specifically target said object. Unless somehow that might work in one script for the object.

 

What I have is buildings of a factions base , that the enemy can and will destroy , once they have killed any enemy actors in the vicinity , or even during combat if it is closer.

 

Say for example : "WastelandMarquee01Exterior" which is the tent static.

But I suppose would at least need to turn it into an activator first and give it destruction data. Then some enemy units come along on a travel or patrol package ... sending them into combat by means of their combat style , and attack that object.

 

All I can think is to have an enemy actor placed at the structure with a guard package keeping them in place ... then once the actor is killed it destroys / disables the structure. But then I guess the structure collision will be getting in the way. Or would that not matter since it will be getting hit with bullets , and tracked with the destruction data health ?

 

IDK ... just looking for any idea's , plus I should mention this is for Fo3 ... so no JIP,Lutana or NVSE functions will be available to me.

Link to comment
Share on other sites

Look at the initiates at the citadel. IIRC, they have a package or script that makes them shoot at the static targets. You'll probably need to add a distance check (and another package to get them to fight their way close to it), but i don't think you'll have any issue using an activator with destruction data instead of a static.
Link to comment
Share on other sites

Yes Pix ... that helped :) But sounds like I would have to do some nifskope work setting up nodes for 30+ meshes. And then according to getting npc's to attack them like Uhmatt mentioned ... which is a UseItem (weapon) package , for those initiates. They have to move to a location first , then attack irregardless of what in combat would have them do.

 

Lotsa scripting for lota items ...

 

So I think the idea of an npc located with the structure on a guard package would be better.

Enemy actors will attack them on auto AI ... with some of them fighting back , but some just staying in place.

With a large health pool of course. Then an OnDeath block running ... something like ...

 

Begin OnDeath

 

PlaceAtMe MyExplosion ; no force , no damage , just FX

Disable ; with all the building pieces being children

End

 

The tent will be a unique scenario for the NPC can hide ... but maybe some way can even it out ?

Most the rest of the structures won't hide the npc like that one. These are a few I'm using also ...

 

RCStand01 , OasisPavillion , WoodShackPile01 , Barn01 , MegatonCrowsNest01 .

 

Most of the other's will be derivatives of static objects put together. A scol I guess ?

Link to comment
Share on other sites

I'm not sure what you can do to make sure they attack the objects rather than other NPCs if that's what you want. If you were using JIP LN, you could run that package ad use the SetCombatDisabled function. I'm not sure but I don't think that function disables weapon use entirely, just combat AI. You're not using JIP LN anyway, though, so it's a moot point.

Link to comment
Share on other sites

Ya moot point with no JIP ... and I can't see an easier way than just having an NPC represent the building.

Then linking the static pieces as children. Plus at least half the buildings will be fighting back ... therefore would need an Actor anyways.

 

The question though is ... since this building starts out disabled , then gets built , maybe destroyed ... then can be built again. I guess I should not mark for delete the actor.

 

Unlike all the other actors that will die. (the ones running around) Their corpses need to be cleaned up right away. (As you had mentioned earlier EPDGaffney for performance issues)

So I will have to have an "OnDeath" Block on every actor. with "MarkForDelete" following "Disable" ??? But that just deletes the Ref-ID right ? And then another Ref from the base -ID can be made carrying its own script? Although I guess these ref's will be made dynamically , and to give them packages ... hmm ?

 

But anyways while I have some modelers here ... what say you guys about this request ?

 

https://forums.nexusmods.com/index.php?/topic/6761527-looking-for-someone-to-model-some-unique-armor/

Link to comment
Share on other sites

The OnDeath blocks themselves can unfortunately cause performance issues. Using an event handler would be much better for performance. Was that included in FOSE? Hope so. If not, try the vanilla OnDeath block and see what you get.

 

You can use X markers with PlaceAtMe if it works correctly, that way the buildings can be zapped as a clean-up and then respawned only when needed (disabled actors can still cause performance hits). With an OnLoad block, you may be able to make sure PlaceAtMe works as intended. This is all if you want to do it that way. It should work all right for performance if you disable, don't zap, and then ResetHealth and Enable when needed. The PlaceAtMe was just an alternative in case it's needed.

Link to comment
Share on other sites

No I wouldn't want to zap ( markfordelete) the building pieces or the actor that represents them for health and what enemy AI will attack. But yes will want to reset their health upon "Enable" from building it again.

 

The way that will work is a small activator centered at the building to be enabled. The player clicks it at spends resources. Then an FX plays for awhile showing something is going to be built there.

Then the building with actor is enabled. Most of these buildings you will click on the actor or some activator , to then create a unit , or make an upgrade for units.

 

And then yes , was planing on an XmarkerHeading being part of the building for where a new unit will be placed. And these units can then be given packages.

I guess I will have to go with generic named units ... that you set a package on for however many you have of that particular base-ID. Instead of being able to give this or that Ref-ID a separate package.

At least with the human and Robot faction. But do you think with the Creature faction ... with troop selection being done by shooting a particular reference with a gun that opens message buttons.

Could then add/change package just on the Ref ? Even though there were 3-5 other ref's using that base-ID ? Hmmm ya , doesn't sound possible ... thinking have to set packages to base-ID only ... therefore effecting all refs ???

 

But back to the "OnDeath" block. Will need to clean these ref corpses up. So do you think will need to set a variable for the ref ... to only end up disabling , and marking for delete ... just the ref ? Instead of using the implicit scripting ?

Link to comment
Share on other sites

Packages can be added to Refs, sure. If that couldn't be done, all the raiders would have the same package all the time, for example.

 

You could have a quest that runs every five seconds and just disables and zaps all corpses. Set the fade flag on the Disable function for it to look nice. The Ondeath block may work but I think I recall a problem with this sort of thing. Try it anyway of course, but a quest at that delay rate would work I think. The best would be an event handler, but I'm not sure FOSE has those. OBSE did, but the wiki mentions just NVSE, not FOSE.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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