lighting ???
#1
Posté 27 octobre 2011 - 04:26
to come on at a designated time ( night ) and turn off ( morning )
any help would be greatly appreciated. a tutorial and old post
thank you
landon
#2
Posté 27 octobre 2011 - 06:07
If you have a lamp post that does not give off ambient lighting, you can use the below script and attach it to the placeables heartbeat. Make sure the STATIC BOX is UNCHECKED.
Another trick is to use an invisible placeable with the STATIC BOX unchecked, then placing it over a tileset lamp or something if you did not want to use the tileset light options (flickering flames).
void main()
{
if (GetIsNight() && GetLocalInt(OBJECT_SELF,"lightme")==0)
{
SetLocalInt(OBJECT_SELF,"lightme",1);
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
effect light = EffectVisualEffect( VFX_DUR_LIGHT_ORANGE_5 );
ApplyEffectToObject( DURATION_TYPE_PERMANENT, light, OBJECT_SELF, 6.0 );
RecomputeStaticLighting(GetArea(OBJECT_SELF));
}
else if (GetIsDay() && GetLocalInt(OBJECT_SELF,"lightme")==1)
{
SetLocalInt(OBJECT_SELF,"lightme",0);
effect eLoop;
object oGlowingThing = OBJECT_SELF;
eLoop = GetFirstEffect ( oGlowingThing );
while ( GetIsEffectValid ( eLoop ) )
{
int iType = GetEffectType ( eLoop );
if ( iType == EFFECT_TYPE_VISUALEFFECT )
{
RemoveEffect ( oGlowingThing, eLoop );
}
eLoop = GetNextEffect ( oGlowingThing );
}
RecomputeStaticLighting(GetArea(oGlowingThing));
}
}
This will create an orange glow off the placeable at night and remove it during the day.
FP!
#3
Posté 28 octobre 2011 - 05:07
landon
Modifié par dragonlandon, 28 octobre 2011 - 05:07 .
#4
Posté 28 octobre 2011 - 05:45
Campfires are the same if it's a tileset campfire.
Placeable campfires or torches can be turned off or on by using the script below. Again, make sure the placeable has its STATIC box UNCHECKED. The script is the same as the one above, I just inserted removal or additions of the placeables ACTIVATED or DEACTIVATED status.
void main()
{
if (GetIsNight() && GetLocalInt(OBJECT_SELF,"lightme")==0)
{
SetLocalInt(OBJECT_SELF,"lightme",1);
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
effect light = EffectVisualEffect( VFX_DUR_LIGHT_ORANGE_20 );
//effect light = EffectVisualEffect( VFX_DUR_LIGHT_BLUE_5 );
ApplyEffectToObject( DURATION_TYPE_PERMANENT, light, OBJECT_SELF, 6.0 );
RecomputeStaticLighting(GetArea(OBJECT_SELF));
}
else if (GetIsDay() && GetLocalInt(OBJECT_SELF,"lightme")==1)
{
SetLocalInt(OBJECT_SELF,"lightme",0);
effect eLoop;
object oGlowingThing = OBJECT_SELF;
eLoop = GetFirstEffect ( oGlowingThing );
while ( GetIsEffectValid ( eLoop ) )
{
int iType = GetEffectType ( eLoop );
if ( iType == EFFECT_TYPE_VISUALEFFECT )
{
RemoveEffect ( oGlowingThing, eLoop );
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
}
eLoop = GetNextEffect ( oGlowingThing );
}
RecomputeStaticLighting(GetArea(oGlowingThing));
}
}
Due take note, when the placeable campfire is DEACTIVATED, the glow of the fire still remains, even though the fire itself is no longer flickering. This is the same issue I noted regarding the placeable lanterns.
The torches, found under - Placeables - Standard - Building Adornments - Torch Bracket - will work fine when DEACTIVATED. They do not retain their glow as the placeable lanterns and campfires do.
FP!
Modifié par Fester Pot, 28 octobre 2011 - 05:47 .
#5
Posté 29 octobre 2011 - 03:48
landon





Retour en haut






