[Oct 9 2012: I uploaded a leaner and meaner version of this for download to a BSN project of mine]
In order to come up with a more efficient Gargoyle, I looked into replaceing a placeable's heartbeat event with an AOE's onEnter event. For those that do not know what I am talking about... consider the Gargoyle placeable that is scripted to turn into a Gargoyle creature when a PC gets too close, and transition back when the nearest PC is too distant.
The problem I have with this system is that it is heartbeat driven, and thus could be much more efficient. I really like using this method as it works well for undead, plants, and constructs - creatures that typically lie around in plain sight until a PC gets close enough to disturb them. And since I like using them, I'd like the ability to place many without worrying about all the resources they use up. The answer to this is to use AOE's.
AOE's are tricky however. My first implementation applied the AOE directly to the placeable when it was "spawned" via a NESS script. This didn't function. My next implementation applied the AOE to the location of the placeable when the placeable was spawned. The problem with this was two fold: (1) the AOE scripts did not run on the placeable and (2) when the placeable was destroyed, the AOE was not destroyed along with it. I solved this last pair of problems by using the SetLocalObject method on the Area of Effect pointing to the placeable, as well as aon the placeable pointing to the AOE object. Each local object is named "PAIRED" which I have done similarly thorughout my scripts when paired pointers are called for.
SCRIPTS
- spawn_sc_spawn (excerpt) - this is an excerpt from a NESS script which executes on spawn of the placeable
- aa_plcspawn_ent - this is in the OnEnter of the AOE
- aa_plcspawn - this is executed on the placeable, transforming it to a creature and called by other scripts including aa_plcspawn_ent
- aa_ai_plc_hb - this is executed from the heartbeat event on the creature. I execute it from the creature's userdef script under the userdef heartbeat event.
- placeable death event excerpt - this goes in the placeable's death event. It is garbage collection for the AOE when the placeable is destroyed.
- Placeable - the placeable can be any placeable object defined by you. It does however need a series of local objects. Please see aa_plcspawn for a list.
- Monster - the monster created from the placeable. This should have at least two of the local variables defined SPAWN_PLACE and SPAWN_DISTANCE. These local variables in conjunction with the userdef heartbeat script enable the creature when placed by the DM to revert to a Placeable when a PC is not around.
Modifié par henesua, 09 octobre 2012 - 08:51 .





Retour en haut







