Jump to content

Conditional AI Package Changes


FlashyJoer

Recommended Posts

Hi all,

 

ive been scouring the wiki and google for anything that could help me figure out how to have a trigger fire that would cause all NPCs to change package while Player is LOS.

 

I have an effect made that runs for 3 game days. During this time, there is a global variable that is set and used for retrigger purposes. Ive read that I can make a package and have a condition on it that checks for this global variable and if conditon is met, the package behavior will kick in, provided I have scripting in place to force NPC to evaluate packages. Have I got this so far?

 

If so, thats the limit of my understanding of this process... nowhere do my findings tell me where to run the scripting that evaluates the NPC line of sight, nor how to force the NPCs to change package to the desired temporary effect (WorkshopChildFree package) and then when PC is no longer Line of Sight, to revert back to normal packages. Id also like to modify the aggro distance generically for all NPCs during the time when the effect is in play.

 

  • Character has effect - Global Variable is set to 1
  • Character enters line of sight on NPC
  • NPC reevaluates AI package and because condition is set to use FLEE package if GV =1, it kicks in
  • NPC reverts to usual package when character is no longer LOS

This is what I am looking to accomplish. Should be noted, this is not just for a specific NPC, but generic - so say, I walk into DC market, I want ALL non-vendor / guard NPCs to react (flee) when I come within say 200 game units of their LOS. I assume I would need to create a faction and add all of these NPC types to it and then I suppose have a scripting condition that checks if NPC reevaluating package is in faction formlist?

 

So I guess the questions I have then, because Im wracking my brains to figure it out are:

 

1. How to trigger the evaluating script in the first place - where does the script attach? Quest fragment? Package script? As part of my RefAlias Quest script?

2. How to create the eval process with the LOS scripting - any example mods with source code you can think of that I can look at?

 

i thank anyone and everyone who can offer me some mentoring on this. :)

Link to comment
Share on other sites

Update: I have created a package using the FleeFrom template, adding conditions of Global Variable = 1 and GetWithinDistance = 200, as I like this better than using Line of Sight. I kept the package data at default for the template and modified the flags a little to just make anyone using the package a runner from the player. So, the package is made and I see there is a dropdown for Owner Quest, so assuming this attaches to a quest...

 

i did see in ImmersiveLoversEmbrace's source code, the following:

 

while closest == Game.GetPlayer() && z <= 6000
z = z + 250

closest = Game.FindRandomActorFromRef(Game.GetPlayer(), z)

if closest != Game.GetPlayer() ;Removes the need to do allot of logic if it's just player it finds

; Check to see if romance is avaliable and is companion otherwise menu won't trigger
;NEW - Add check for ring : .IsEquipped(RING)
if closest.GetValue(CA_IsRomantic) == 1.000000 && closest.IsPlayerTeammate() == True && IsRingEquiped(closest) == 1
;What we want
;Debug.Notification("Found NPC with ring equiped!")
else

;Magnolia check
if closest == Magnolia
closest = Magnolia
else
;If not follower changes back to player in case its another NPC, continues looping
closest = Game.GetPlayer()
EndIf

endIf

EndIf ;Player check


endwhile

-----

 

Is this basically what I want for triggering the evaluate package script command? Modified of course, but in a nut shell... if player finds NPC within xx game distance, force the found NPC to reevaluate packages and if conditions are met, the package will kick in?

 

If so, the question becomes, how to add the package broad spectrum to the NPCs ingame? Faction formlist? Overrides into my mod for actor records?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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