A simple means to create and access creature data via script in a single player module. This includes two script functions that replace Create and Destroy object functions for creatures. I have inserted this into NESS in my module so that I can generate and track data related to a creature. (I renamed this entry to help clarify this fact.)
Purpose is to associate a data object with a creature, and thereby have persistency of the creature's data across respawns. Spawning or despawning using this system requires the user to call respectively either the SpawnCreature or the DespawnCreature functions within user scripts.
There is much room for expansion of this. I am using it in a module in which a creature is spawned and despawned a number of times, but I wanted to track its hitpoints across spawns, and not allow it to be spawned if it was killed.
Version Notes:
1.1
- This version changed the SpawnCreature function to return the creature object so that it operates in the same manner as CreateObject.
- This version also corrected the bad files that were included in the previous version.
1.0
-A future version may have an array object so that a dynamic set of data for the creature can be stored and retrieved.
Instructions:
#include "_inc_simplespawn" in a script in which you create or destroy a creature. As long as the creatures spawned with this system use the default death script (which this system overrides), their death should be tracked.
The functions to use are SpawnCreature and DespawnCreature. They do as their names suggest. Whenever creating or destroying a creature, these functions should be used if you wish to track their data and spawn state. See the scripts for more information.
Advanced Scripters:
To integrate this system with another spawning system replace the CreateObject functions of that system with SpawnCreature from this one.
I had developed this for a single player module last year. For that it works very well. I am now looking to generate similar functionality in a PW using NESS and Knat's Natural DataBase Extender.
It is not technically difficult to solve, but I haven't puzzled out the best design for this yet. One could conceivably tie directly to the database and cut out this system as a middleman. The advantage however to this is that a builder without scripting knowledge can configure population settings for a creature (max population etc...). So that is likely the direction I will take this.
Anyway, I am thinking about how best to adapt this to my needs now, and will share if I come up with a universally applicable solution. _________________________ Vault Submissions | Arnheim | Beyond Vives
Posted by Rolo Kipp at 2012-10-20 07:41:26 Voted 10.00 on 10/20/12
I have a use for this in tracking the Catastrophies in a regional mod...