Saturday, November 12, 2011

More games with SLS

Since SLS lets you control lights, I've built up several script systems and a trigger based around lighting that uses SLS functionality. First, I've added the ability to turn lights on/off by doing appropriate damage to the light source. Normally this is fire for on, and ice for off, but "cold lights" would just be a matter of a quick script edit. You can also turn lights on/off via a number of non-damaging spells. Gust of Wind or Darkness etc will turn off a torch for instance. Magical lights are not able to be turned off via gust of wind, but can be dispelled. A variable on the light records the level of the creature that enchanted the light, and the dispel line of spells are very straightforward to implement. And of course some light sources can simply be used to turn them on/off.

So what? Well this is where my trigger comes in. I have a trigger for the lightsphere of a lightsource. The trigger reduces the hide skill of pc's that enter (not npc's as the ai can't deal with that, a sneaky npc doesn't stick to shadows), and restores it on exiting the trigger. But the trigger is also aware of the status of the light, if the light is off, the pc gets no bonus entering the trigger. The scripts that allow turning on and off lights also are aware of the trigger assigned to them, and adjust the hide skill accordingly, so for instance if the player is in the trigger when the light goes on, the hide bonus is immediately removed. This is demonstrated in this trigger awareness video .

Finally, the trigger looks for a local variable named guards_lights on anything that enters, and keeps track of if a guard can use the light source (a variable on the light source). Npc's with the guards_lights variable will move to a light source and turn the light back on if it's off and they can use it. Your average castle guard can light a torch, but not turn on a magical light.

In this youtube video you can see the guarded light function in action. link The pc hits the torch with an ice arrow at the very beginning of the video. You can see the guard enter the trigger (marked by the mushrooms for the demo). As he enters the trigger he notices the light is out, has a speakstring that plays "darn light!", moves to the lightsource, plays a use animation (it should loop until the light turns on but doesn't in this demo video), the light comes back on, and he then continues on his patrol path.

3 comments:

  1. Very impressive. I haven't used the SLS system, and instead wrote my own scripts for light control a while back since I wanted my dungeons to be dark. Having wall torches being able to be lit by fire arrows was a fun thing to do, but you have gone far beyond that by integrating it with the hide skill and allowing NPC's to light them.

    How do you keep multiple guards from trying to relight a light? Do you restrict them to one guard only by tag or something?

    - Kaldor

    ReplyDelete
  2. There's a "being lit" variable that gets set as soon as a guard recognizes the light is out. So if "being lit" is true but "is lit" is not, then a guard won't go light it.

    What I've done isn't perfectly flexible. Things are a bit hardcoded so I can just lay down triggers, the scripts look for the nearest object with a variable, nearest light etc, instead of by tag. It means overlapping triggers would be unpredictable, so I don't do overlapping triggers.

    I retroactively implemented this after doing 90+% of the area design, and that was less of a problem than one might think initially. There's very few places where I had to make my trigger not match up to the light sphere. I drew the trigger somewhat inside the actual light sphere, so being at the edge of the light doesn't penalize, it's more of if I can see the light on the ground in the toolset, then that's where the trigger is drawn.

    ReplyDelete
  3. Hi Kamal,

    Very nice ... and something that appeals very much to my idea of incorporating systems to add a "real life" feel to modules. As you know, I have a system of my own, but it does not go into quite so much detail as this. (I had to draw a line somewhere ... ;) ) However, if this becomes public prior to the next module I write (part 2 of 3), then I may very well look at incorporating some of the ideas you bring up. I particularly like both the ideas you have demonstrated here ... and will see what the future ideas bring.

    By the way, your areas that you let me download to use have encouraged me a great deal and I have had some fun ideas for a quest that I am writing at the moment, based on those areas. :) If I can write something that does not give too much away, I may do so next blog.

    Lance.

    ReplyDelete