New Forums

Please go vote on the new forums now. Let's get this shipped.

You are here

How do I reactivate placeable source lights?

5 posts / 0 new
Last post
Tsais
How do I reactivate placeable source lights?

I have a script that turns lights on and off at certain hours of the day. It works fine for placeable lampposts, but when using it for a source light in the CEP ("Source Light: Blue - Dark", with ambient light), it doesn't work quite right.

These particular source lights look like blue flames when activated. When the script turns them off, the flames vanish. So far, so good. But when reactivating the same source lights later, the flame animation never reappears - even though its illumination does.

What's really weird is this: if I leave the area and then return to it, the flames are once again visible. It's only when I'm in the same area as they're being reactivated that the animation can't be seen. (And I am recomputing static lighting, if you suspected that.)

Sample function:

void TurnOnLights(object oArea)
{
    object oLight = GetFirstObjectInArea(oArea);
    while (GetIsObjectValid(oLight))
    {
        if (GetTag(oLight) == "DYNAMIC_LIGHT")
        {
            AssignCommand(oLight, PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
            SetPlaceableIllumination(oLight, TRUE);
        }
        oLight = GetNextObjectInArea(oArea);
    }
    RecomputeStaticLighting(oArea);
}

Anyone ever run into something like this?

  • up
    50%
  • down
    50%
Baaleos
The placeable for the light is definitely not static?
This might sound odd - but could you try running your script with the Recompute done either after a delay, or not at all - to see what the results are?
 
Recompute in my experience has had the ability to lag the game client when called - which is odd - its a server method after all.
But if the client is frozen or lagging while at the same time trying to display an animation change - it might be missing out on the Animation play command.
 
Try recompute after a 1 second delay etc
  • up
    100%
  • down
    0%
Tsais

Thanks for the suggestions. I can confirm that they're not set as static. I had previously tried adding a 1-second delay to Recompute, and then a 6-second delay, but neither made a difference. Sheesh! Stumped here.  

  • up
    50%
  • down
    50%
TheBarbarian

How are you calling TurnOnLights(), and does it also happen for other VFX placeables, like the default fire or the light shafts?

Try putting in debug messages, to check who oArea is, and also check whether the individual lights are qualifying; make them SpeakString something maybe.

If the problem is utterly unique to that one specific model, it's probably something wrong with the model rather than with the script.

  • up
    100%
  • down
    0%
Tsais

I think you hit the nail on the head, Barbarian. It appears that this particular placeable - actually, a whole class of placeables, under the designation of "Source Light: [Color]" in the CEP - have this issue. They all had the same behavior and I thought it was a scripting problem, but after following your suggestion I saw that the script worked fine with ordinary flames, lightshafts, magic sparks, and just about everything else. 

That's too bad, those colored flames are really nice. Anyway: thanks for the help. I'll just have to give up on using those the way I wanted. 

  • up
    100%
  • down
    0%