Jump to content

NPC AI Packages Question


Deleted2746547User

Recommended Posts

I have a mod where I have maybe 10 or so NPC's that have AI packages: they go one place to work at a certain time, and then to eat, and then to "play" and then to sleep. I have low level processing ON (so they don't get stuck in a room when I'm not in the cell????).

 

Two quick questions - is this the best way to do it (or could it be causing crashes for some weird reason - I've run into crashes but not sure if its this script or my power/lighting one or something else).

 

Also, what ai package/setting would you need to add to have a NPC follower mimic your combat... (when you crouch, crouch, etc.)

 

Scripting is NOT my forte and it makes mt head hurt. Many thanks for the advice! :thumbsup:

Edited by Guest
Link to comment
Share on other sites

Purge cell buffer mods can cause crashes when AI is low level processing in another cell. Navmesh problems can also cause crashes if it's not finalized on both sides of a portal that they need to go through - in other words - if there is no navmesh path to get to their package destination.

I don't think they mimic your combat unless they are set as playerteammate and in a follow package.

Link to comment
Share on other sites

Purge cell buffer mods can cause crashes when AI is low level processing in another cell. Navmesh problems can also cause crashes if it's not finalized on both sides of a portal that they need to go through - in other words - if there is no navmesh path to get to their package destination.

I don't think they mimic your combat unless they are set as playerteammate and in a follow package.

 

THanks so much for the response. Question, I think my navmeshing is ok and I'm not running any purge cell buffer mods... to my knowledge. What is the best way to make an NPC as a playerteammate? Right now the script just has the (4) team members (part of a mission/quest) as following.

 

It's weird on the crashing... just started. can't figure whether its part of my power/lighting quest script or ?

 

 

arghhH!!!

Link to comment
Share on other sites

You can just do:

MynpcREF.SetPlayerTeamMate 1

in a dialog result script, or in a 'doOnce' section of a quest script, or thier object script. The thing is, when you do this, you will get the wheel. If you don't want that, you can just make an object script for your NPCs that force them to sneak if they are following:

 

 

scn MyNpcScript


BEGIN GAMEMode


   if (MyQuest.iMyNpcFollowPackageVariable)

  	 if (IsInCombat)
  		 if (GetForceSneak)
  			 SetForceSneak 0
  		 endif
  	 else
  		 if (Player.IsSneaking)
  			 if (GetForceSneak)
  			 else
  				 SetForceSneak 1
  			 endif
  		 else
  			 if (GetForceSneak)
  				 SetForceSneak 0
  			 endif
  		 endif
  	 endif
   else
  	 if (GetForceSneak)
  		 SetForceSneak 0
  	 endif    
   endif
   
END

 

Post the script that you think might be crashing.

Link to comment
Share on other sites

MANY thanks for the reply and the script. Again, I would have never figured that out. Question - if you had (4) MEMBERS OF THE "team" would you just change the teammate ref # each script (1,2,3,4?) And def. want the wheel!

 

Here's the (3) scripts that are tied to the lighting/power system. Right now I believe it is checking fuel supplies every 5 seconds for ALL of the light markers on). If there is a better way to do it (and check less often) - I would love the advice.

 

It's weird - the crashes don't always happen but when they do, it seems to occur whenI'm exiting/entering tents/buildings at the NCRCF. And when they come (the crashes) it seems to follow back to back. (That is crash. restart NV, a few minutes into game crash.) But again, doesn't always happen. So I don't know if its NPC's, navmesh, the power... arghh!

 

That was working before but now in the mod.. it seems the tank just "takes" all your batteries (b/c nothing is left in your inventory once you "activate" it.)

 

Not sure what I'm missing...

 

THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

 

POWER BASE SCRIPT {RAN AS PART OF THE BASE QUEST}

---

scn BlackbriarPowerBaseQuestScript

 

int Fuel ; This is the total fuel units in stock

int FuelRqd ; This is the calculated amount that will be used in a single 5 second period

 

Begin GameMode

If Fuel

Else

return

Endif

 

set FuelRqd to 0

 

;Lghts1 uses 3 unit of Fuel/5sec

If BlackbriarLgts1.GetDisabled

Else

set FuelRqd to FuelRqd + 3

Endif

 

;Lghts2 uses 1 unit of Fuel/5sec

If BlackbriarLgts2.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts3 uses 2 unit of Fuel/5sec

If BlackbriarLgts3.GetDisabled

Else

set FuelRqd to FuelRqd + 2

Endif

 

;Lghts4 uses 1 unit of Fuel/5sec

If BlackbriarLgts4.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts5 uses 1 unit of Fuel/5sec

If BlackbriarLgts5.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts6 uses 1 unit of Fuel/5sec

If BlackbriarLgts6.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts7 uses 1 unit of Fuel/5sec

If BlackbriarLgts7.GetDisabled

Else

set FuelRqd to FuelRqd + 3

Endif

 

;Lghts8 uses 1 unit of Fuel/5sec

If BlackbriarLgts8.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts9a uses 1 unit of Fuel/5sec

If BlackbriarLgts9a.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts10a uses 1 unit of Fuel/5sec

If BlackbriarLgts10a.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts11 uses 1 unit of Fuel/5sec

If BlackbriarLgts11.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts12 uses 1 unit of Fuel/5sec

If BlackbriarLgts12.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Subtract the fuel used

set Fuel to Fuel - FuelRqd

 

;Turn off all power users when Fuel runs out.

If Fuel < 1

set Fuel to 0

BlackbriarLgts1.Disable

BlackbriarLgts2.Disable

BlackbriarLgts3.Disable

BlackbriarLgts4.Disable

BlackbriarLgts5.Disable

BlackbriarLgts6.Disable

BlackbriarLgts7.Disable

BlackbriarLgts8.Disable

BlackbriarLgts9a.Disable

BlackbriarLgts10a.Disable

BlackbriarLgts11.Disable

BlackbriarLgts12.Disable

 

Endif

 

End

 

 

 

 

$$$$$$$$$$$$$$$$$$$$ NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$

 

Fuel Tank Script

 

scn BlackbriarFuelTank

Begin onActivate

If GetQuestRunning BlackbriarPowerBaseQuest

Else

StartQuest BlackbriarPowerBaseQuest

Endif

 

If player.GetItemCount FissionBattery

player.removeItem FissionBattery 1

set BlackbriarPowerBaseQuest.Fuel to BlackbriarPowerBaseQuest.Fuel + 1500

Else

; ShowMessage BlackbriarPowerNoBatteries ; Uncomment when/if you want to display a msg.

Endif

End

 

 

$$$$$$$$$$$$$$$$$$$NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

 

Power light script

 

ScriptName BlackbriarPowerLightScript

 

ref light

 

Begin OnActivate

if BlackbriarPowerBaseQuest.Fuel == 0

return

Endif

if light == 0

set light to GetLinkedRef

endif

 

if light.GetDisabled

light.Enable

else

light.Disable

endif

Activate

End

 

 

 

 

You can just do:

MynpcREF.SetPlayerTeamMate 1

in a dialog result script, or in a 'doOnce' section of a quest script, or thier object script. The thing is, when you do this, you will get the wheel. If you don't want that, you can just make an object script for your NPCs that force them to sneak if they are following:

 

 

scn MyNpcScript


BEGIN GAMEMode


   if (MyQuest.iMyNpcFollowPackageVariable)

  	 if (IsInCombat)
  		 if (GetForceSneak)
  			 SetForceSneak 0
  		 endif
  	 else
  		 if (Player.IsSneaking)
  			 if (GetForceSneak)
  			 else
  				 SetForceSneak 1
  			 endif
  		 else
  			 if (GetForceSneak)
  				 SetForceSneak 0
  			 endif
  		 endif
  	 endif
   else
  	 if (GetForceSneak)
  		 SetForceSneak 0
  	 endif    
   endif
   
END

 

Post the script that you think might be crashing.

Link to comment
Share on other sites

The only thing I can see that might possibly cause a crash is this:

1. If one or more objects that you have placed in the editor does not have the 'persistent reference' box ticked.

This check box guarantees that the reference will always be loaded into memory and available for your quest script. If it's not checked, your quest script may be intermittently performing a function on a null reference, which can cause a script halt or crash.

 

If you are not using the Geck powerup, its possible that the Geck let you save a script even though one of the boxes wan't checked on a reference. http://newvegas.nexusmods.com/mods/41642

Link to comment
Share on other sites

The only thing I can see that might possibly cause a crash is this:

1. If one or more objects that you have placed in the editor does not have the 'persistent reference' box ticked.

This check box guarantees that the reference will always be loaded into memory and available for your quest script. If it's not checked, your quest script may be intermittently performing a function on a null reference, which can cause a script halt or crash.

 

If you are not using the Geck powerup, its possible that the Geck let you save a script even though one of the boxes wan't checked on a reference. http://newvegas.nexusmods.com/mods/41642

 

 

Would that be related to "lighting". That is, would the persistent ref. tick in this case refer to the lighting, markers, etc.? Just so I'm clear where to look.

 

I haven't used the geck powerup but will def. check it out. If you ever get time, would love to get your feedback on the mod so far. Still a long way to go - but if you ever find time to do a little playtesting, would love feedback. THANK YOU :thumbsup: for your help!

 

Also, on the "teammate" script - would that teammate number change for each team members script? I'm just a little confused about where I place this script and call it up. Let's say the Quest enables the team of (4) npc's to join you. where exactly would I place this. In the script that enables them? If so, how to apply it to all four. Sorry for the questions - I'm just trying to cut down on me restarting/stopping a 1,000 times trying to make something simple (for you:) to work for me!

Edited by Guest
Link to comment
Share on other sites

By the way, just loaded up powerup.. not sure whether to thank you or find some not so nice names.... :P It gave me a ton of warnings that I didn't know to look for. Weird, no warning with the lights (?) but a handful of NPC ones (masterfile ref XXXXX to base obj. XXXNPC in cell..... should be persistent but not...

 

Could that be it?

 

Also, a ref attached to wrong cell for its location refr form XXXX to stat form nvnrockcanyon XXXX in cell wildenerness.. I will look and see if I moved something inadvertently...

 

A few furniture markers not selected for items errors...

 

A faction relations error (not set the same between factions)

 

And a flag error with my npc teammate package...

 

Wow... tons of things to fix..

 

Happy though it gives me things to look at... and maybe I now also know why NPC's weren't sitting on chairs, etc. in different buildings.

 

And seems you were absolutely right on the persistent ref. thing. Strange though that it only happened sporadically when exiting/entering buildings.

 

THANKS again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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