I wanted to explore a suggestion to change a door's visual appearance through the application of a visual effect, and here is what I came up with. In short, it works. Here's my demo script:
// Area OnClientEnter
/*
This is an Area OnClientEnter event handler.
This script demonstrates the application of a spell effect
to a door in order to change its appearance. The script is
placed in the 'On Client Enter Script' property of the area
with the door, and the door itself is given an integer
variable with the ID of the VFX. For example:
visual_effect_ID = 669
Here are some visual effect identifiers:
643 -- VFX_DUR_SPELL_BARKSKIN
661 -- VFX_DUR_SPELL_SPIDERSKIN
669 -- VFX_DUR_SPELL_STONESKIN
688 -- VFX_DUR_SPELL_IRON_BODY
918 -- VFX_SPELL_DUR_TORT_SHELL
*/
// rjshae 4/19/14
const string VISUAL_EFFECT_ID = "visual_effect_ID";
const int VISUAL_EFFECT_SPELL_ID = 6949; // Must be unique
/* This script looks for any doors, then checks whether
they have a "visual_effect_ID" set. If so, it applies
the matching visual effect to the door.
*/
void ApplyVisualEffectToDoors()
{
object oTarget = GetFirstObjectInArea( OBJECT_SELF );
while( GetIsObjectValid( oTarget ) ) {
// Check for a door
int nType = GetObjectType( oTarget );
if ( nType == OBJECT_TYPE_DOOR ) {
// Temporary
object oPC = GetFirstPC();
SendMessageToPC( oPC, "Found door" );
int nVisualEffectID = GetLocalInt( oTarget, VISUAL_EFFECT_ID );
if ( nVisualEffectID != 0 ) {
// Remove a previous visual effect, if any
effect eEffect = GetFirstEffect( oTarget );
while ( GetIsEffectValid( eEffect ) ) {
// Compare the spell ID to VISUAL_EFFECT_SPELL_ID
int nEffectSpellId = GetEffectSpellId( eEffect );
if ( nEffectSpellId == VISUAL_EFFECT_SPELL_ID ) {
// Remove the visual effect and exit the loop
RemoveEffect( oTarget, eEffect );
break;
}
eEffect = GetNextEffect( oTarget );
}
RemoveEffect( oTarget, eEffect );
// Apply the permanent effect to the door
effect eDoorVisualEffect = EffectVisualEffect( nVisualEffectID );
eDoorVisualEffect = SupernaturalEffect( eDoorVisualEffect );
eDoorVisualEffect = SetEffectSpellId( eDoorVisualEffect, VISUAL_EFFECT_SPELL_ID );
ApplyEffectToObject( DURATION_TYPE_PERMANENT, eDoorVisualEffect, oTarget );
}
}
oTarget = GetNextObjectInArea( OBJECT_SELF );
}
}
int StartingConditional()
{
// Event fired via non-party transition (Load Game, Client Join, etc.)
// if ( FiredFromPartyTransition() == FALSE )
// {
// return ( FALSE );
// }
// Get party leader, force control of owned PC
object oPC = GetFirstEnteringPC();
object oLeader = GetFactionLeader( oPC );
oPC = SetOwnersControlledCompanion( oLeader );
object oSpeaker;
string sDialog;
// Look up the doors in the area
ApplyVisualEffectToDoors();
// Revert control to original character
SetOwnersControlledCompanion( oPC, oLeader );
return ( FALSE );
}
Of course, one could apply a named effect file rather than a spell visual effect as was used here. Below is a demonstration of a door after applying the appropriate local variable and adding the above script to the On Client Enter for the area:

You can see the covering maps across the surface, regardless of the position of the door. Here are several more variants. I particularly like the iron skin covering.

So there you go: a way to change a door's appearance without creating a new door placeable.





Retour en haut











