Jump to content

A question regarding PlaceAtMe


Surilindur

Recommended Posts

I was browsing through the Construction Set wiki and I found a way (not sure if it works, though, I have not yet tested it) to delete references created using the PlaceAtMe function to spawn actors. But it only mentions deleting them, not removing them from the savegame. So I was wondering if anyone knows whether it removes the references from the savegame, too. Here is the link to the wiki page:

 

http://cs.elderscrolls.com/index.php?title=PlaceAtMe

 

It would be much easier to use PlaceAtMe to spawn actors than creating a set of predefined actors to "recycle". So if anyone knows about it or has tested it, I would be happy to learn more about it.

 

Thank you.

Link to comment
Share on other sites

As you know, PlaceAtMe create a new dynamic reference. The same do creature leveled lists.

 

Why DeleteReference doesn't work on actors? Because there's no need to destroy actors:

Take all references spawned by leveled list. As you walk around in the wilderness, actors keep spawning from all creature leveled lists around you.

If left alone, they would increase the savegame size in no time. Instead the savegame size is right.

 

Why? Because, the game clean them somehow. By reading this discussion I found this:

- Both dynamic living and dead actors are cleaned when their cell does.

- If you want to spawn actors in a cell reachable by the player (or even the same cell as the player), you don't need to "destroy" them. When the player leave the cell, and after 72 hours they will be automatically cleaned by the engine.

- If you want to destroy the actors now, move them to a dummy cell then reset the cell with ResetInterion. The cell reset immediately and will destroy the actors.

 

The cell "reset timer" only start running after the player leave the cell. If the player never visit a cell, it will never reset itself.

This mean that simply moving an actors to a dummy cell, not reachable by the player, is useless, and the actor will exists forever. You need to reset that cell.

But if you need to spawn actors around the player, then it's fine. The cell reset will handle them.

Link to comment
Share on other sites

Hmm. Yes. Thank you. I think found that discussion earlier, too, but I had not yet read enough about the matter to understand it. :)

 

I was mainly wondering if it is enough to just reset a dummy cell holding the "dynamic" actors. So that the player never needs to visit that dummy cell. Perhaps it is, then. And if the one who posted that solution is QQuix (the typesetting [if it is the correct word] of the discussion is not too clear), I believe I can trust it. He would seem to have done quite a lot of research on the subject.

 

The problem with not moving the spawned NPCs away from where they died is that they will be attacking a player-owned castle and therefore it is possible that the NPCs can just keep piling up in front of the castle if the cell is not given enough time to reset, as I believe the "reset counter" for a cell is reset every time player visits that cell.

Link to comment
Share on other sites

Yes, the reset timer restart if the player visit and leave the cell before the reset. So, if you keep visiting a cell every day, it will never reset (unless you manually reset it).

You could attach a simple script on the actors you spawn, with GameMode and OnDeath blocks:

In the OnDeath block, you set the day (I suggest using the GetDaysPassed) of death in a local variable "dayOfDeath".

In the GameMode block simply check "If GetDead && (GetDaysPassed - dayOfDeath >= 3)". If true, set a global "mustClean" variable to 1 and move the actor to the dummy cell (MoveTo could cause the script to act as a "return", so avoid placing any more code below it, it's not sure it will be executed).

EDIT: Even better: only use a GameMode block for the actor script:

Begin GameMode
   If ( GetDead )
      If ( GetTimeDead >= 72 )
         Set mustClean To 1
         MoveTo dummyCell
      EndIf
   EndIf
End

Then, a quest script (with a fQuestDelayTime of 60 or so) run the GameMode once in a while and if the global "mustClean" variable is 1, call ResetInterior for the dummy cell and reset the variable to 0.

Edited by forli
Link to comment
Share on other sites

I thought about something like that, but that new version of yours is definitely less complicated. I had no idea there was a GetTimeDead function. :D Perhaps I need to read through all the available functions some day. CSE suggests some funtions when writing in the script editor, though, but the probability of me finding something that useful is quite small.

 

Thank you again for your help. Being able to use PlaceAtMe without (hopefully) corrupting people's savegames allows me to add all sorts of nice little (and not so little) features to a mod of mine. Thank you. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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