x0_i0_transform
Library for "transforming" objects -- ie, placeables that 'transform' into a creature, like the skeleton bones object.This system will actually work on any object, not just a placeable -- creatures can easily be transformed into other creatures, for instance.
For efficiency's sake, we don't want to do this with an OnHeartbeat script. It's much better to instead have a trigger nearby with the same tag as the placeable that triggers the changeover when a PC enters it, then destroys itself.
To set up one of these:
- Put down the placeable (or creature) that you want to have transformed.
- Give this object a unique tag, say "TRANSFORM_ORIGIN_FOR_BALOR" or some such.
- Put down a generic trigger and give it the same exact tag as the origin object. Remember, tags are cAsE-sEnSiTive!
- Create a unique script for the generic trigger object's OnEntered handler and paste in the code located at the bottom of this page in the "Trigger Script" gray box.
- Replace "resref_of_creature_here" with the ResRef value of the creature you want to create.
- You can also change "VFX_IMP_DISPEL" to any FNF or IMP effect constant you like, and that effect will be applied when the transform happens. You can also remove that argument completely if you don't want any effect applied.
- That's it!
Constants
Name | Value | Brief Description | sItemPickupSoundResref | it_genericsmall | sItemResrefSuffix | _i |
---|
Functions
Name | Brief Description |
---|---|
ActionCreateObject | Wrapper around CreateObject. This also optionally takes a direction to face. |
GetNearestSeenEnemyForTransform | Internal function. Returns a call to GetNearestCreature(). Private convenience function. |
TransformObject | Transform one object into another, using the specified visual effect (if any) at the original object's location. |
TransformObjectToCreature | Transform the given object into the creature of the specified type, using the specified visual effect (if any) at the object location. Some nice effects that work well: - VFX_IMP_RAISE_DEAD - VFX_IMP_DISPEL - VFX_FNF_SUMMON_MONSTER_2 Any VFX_IMP or VFX_FNF constant should work. |
TransformObjectToItem | This causes an object to be transformed into an item. This is useful for special placeables, where you want to be able to leave an "item" lying around on the ground that doesn't look like a bag but still can be picked up (without creating a new base item type). |
TransformObjectToPlaceable | Transform the given object into the placeable of the specified type, using the specified visual effect (if any) at the object location. Some nice effects that work well: - VFX_IMP_RAISE_DEAD - VFX_IMP_DISPEL - VFX_FNF_SUMMON_MONSTER_2 Any VFX_IMP or VFX_FNF constant should work. |
TriggerObjectTransform | Trigger the nearest object with matching tag to convert. This should be called by the trigger object! It ASSUMES that GetEnteringObject() will work for OBJECT_SELF here. This destroys the trigger after it is successfully invoked by the PC. |
Trigger Script
// This is the code you want to copy into the trigger's OnEnter event. #include "x0_i0_transform" void main() { // Replace "resref_of_creature_here" with the ResRef value of the creature you want to create. // You can also change "VFX_IMP_DISPEL" to any FNF or IMP effect constant you like, and that effect // will be applied when the transform happens. You can also remove it completely if you don't want any effect applied. TriggerObjectTransform("resref_of_creature_here", VFX_IMP_DISPEL); }
See Also
constants:  | VFX_FNF_* | VFX_IMP_* |
events:  | OnEnter Event |
author: Mistress, contributor: Fireboar