Jump to content

Trying to write a script that will effect all loaded NPCs.


SGTbayk47

Recommended Posts

Hey all,

 

I would like to write a script that will allow me to use the 'Update3d' function on all of the currently loaded NPCs when the player loads a save game. By currently loaded I mean all NPCs in the grid that loads around the current cell the player is in.

 

I am planning on adding the script to my existing script, that runs once inside a 'getgamerestarted' check, so I don't need a whole script written.

 

So, for example;

scn myscript

begin gamemode

  if getgamerestarted == 1

    my script stuff

    new section that calls update3d on all npcs

  endif

end

My script already does everything else I need in the 'my script stuff' part, I just need to know what to write in the 'new section' part.

 

From what I have read I think I need to use an array, but all of the information I can find on the subject is well beyond my scripting capabilities.

 

If somebody could help me out with this it would be greatly appreciated and you would be credited for your help.

 

Thanks in advance,

 

BayK

Link to comment
Share on other sites

I think this should do it:

array_var aEntry

foreach (aEntry <- GetRefs 200, -1)
	let rActor := *aEntry
	rActor.Update3D
loop

The -1 that is passed to the GetRefs function makes it search the area that is defined by the uGridsToLoad setting, so this should cover all loaded NPCs.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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