Set_light_ambient method?

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Set_light_ambient method?

Post by Igor Poulpupov »

Hi.

I'm trying to finish the edition of an old (and huge) dungeon of mine and I've a riddle taking place in a level supposed to be dark (precise level of darkness), with only some places getting light from lanterns/brazzers. No torchs and no spells are available in this level.
The problem is: if the party casted the 'light' spell before arriving in this level, it influences the ambient light of the level. I don't want this to happen, I want to set the absolute ambient light of the level.

I've tried to play with the light levels in the "edit level" menu, but having a maximum light level to low makes the lanterns/brazzers lights useless.
I've tried the actions LIGHT_AMBIENT, LIGHT but I don't get the difference between the _ambient version and the not _ambient. LIGHT and LIGHT_AMBIENT seems to both increase the light (so no absolute value available).
I've tried to fix the minimum value of the light level, and then to do a DARK or a DARK_AMBIENT with strength 1000, but the light level becomes inferior to the minimum value (so how does the minimum value acts then?).
I thought of making a "while loop" on the light level using relays, but the light level is not available in the relay conditions list...

I searched a solution here, with no success... I'm pretty sure some people here played with the ambient lights already, so if you have any solution...
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

I may have found something in the RTC archives forum: http://www.dungeon-master.com/forum/vie ... 18&t=25578
I'll try the last advice from GG. I don't get why the "Done for V0.39" was added in the title of the topic BTW...
If I succeed, I'll say it here, so the topic can be deleted if considered useless.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Set_light_ambient method?

Post by beowuuf »

Thr RTC archives are the place where they are removed from active view. As you've just discovered, it's good to be able to find when something was needed and then actually implemented! Or discover if you're about to walk in ther shoes of someone before. No point in deleting it and then having no history later on! :)


I'm afraid I otherwise can't help with this, I haven't played around with it. If you do succeed, then please do post your findings, as it will help others in a similar situation.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Set_light_ambient method?

Post by Gambit37 »

I spent years twiddling with RTC but never messed around the with ambient light settings. Sorry that I can't help, I hope you find a solution.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

Lucky for you I have been messing around with the ambient light for a new custom RTC dungeon of my own.

I have a level where I want different levels of light, depending on where you are. I laboured with this until I found out you can set up an "ACTION" wallitem with the action "LIGHT_AMBIENT" and set the level of light I want in the "Strength" box at the bottom of the dialogue. I activate this item with a "TRIGGER" flooritem that targets the ACTION item and has its "OP_BY" setting set to "PARTY" at the entrance to the area where I want different ambient light. at the exit to this area I set up another trigger operated by the party that activates another action that sets the ambient light back to the normal amount for that level. I've already tested this and it works fine.

As for the extra light you're getting, that could be because the light spell has not worn off yet, I'm not sure what you could do about that though.
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

Thanks for the answers.

@Seriously Unserious, I tried that already, my problem is -all- about the previous casted light/dark spells that would still affect my light level: I want an action/relay or whatever that defines an "absolute" light level. In other word, the better solution would be something that would reset all the previous casted light/dark spells to zero, so an action "LIGHT_AMBIENT" would define this "absolute" level then.

Well, the propositions from the old post I digged did'nt help me directly, but gave me an idea... I have a solution now, but it's a bit destructive for my whole dungeon light system:
I replaced the effect "LIGHT" of the FUL spell by the effect "LIGHT_AMBIENT". Consequence: the newly built FUL spell only affects the level where I am when I cast it, it lasts forever, and it defines the absolute light level (between 10 for LO and 100 for MON I guess). This way, going in my "supposed to be dark" level, I can fix the -absolute- ambient light using "LIGHT_AMBIENT" action... This solution seems to work (I need to test it more carefully now, I somehow expect unwanted effects), but is very disappointing... The longer light and darkness spells become useless now, and more than that, I need to bannish them from the dungeon.

If other people have other ideas, I'm still looking for something better than this solution.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

Ahh, well then I'm not sure of any better way of doing that, unfortunately. I don't think rtc was designed with the idea of setting an absolute light level unfortunately. An object or action that cancels all existing light, magic torch or other similar type spells would be useful, but if it doesn't already exist in rct then it won't happen as rtc is no longer under development or supported by its designer.

If you're looking for something like that you might want to check out the newer dungeon strikes back (dsb) and see if it can do what you want, or if the developer is willing to add that feature into a future version.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Set_light_ambient method?

Post by Gambit37 »

^^^ Indeed, DSB allows you to get and set all light values arbitrarily in code. If you're trying to make RTC do things it wasn't designed to do, you may prefer to use DSB which can be scripted to do things RTC could never do.
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

I believe that it is possible to do many things with RTC, I mean even things that were not supposed to be done. This lighting thing is the first that really blocks me in a riddle idea, there's this first -middly satisfying- solution and I'm sure there's one or several better other solutions for this.
I read about DSB, but never tried it. Maybe afer finishing that dungeon that already counts 27 levels... I guess I won't be able to finish it with DSB.
And... I think that the Grimrock editor is already the next on my list.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Set_light_ambient method?

Post by Gambit37 »

Sure, RTC can do a lot of weird and clever stuff. But it can take an incredible amount of hacking to make it do that stuff. A lot of things you're trying to do with those hacks can be done with one simple command or a couple of lines of code in DSB.
It took me a long time to switch to DSB because I had the RTC "point and click to build things" mindset, but once I realised how powerful DSB is by comparison, there was no contest ;-) But yeah -- if you have 27 levels in RTC, there's no point changing engines now :-)

I'm looking forward to Grimrock editing too, but somehow I doubt I'll ever get around to it....
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: Set_light_ambient method?

Post by Saumun »

I was just looking through these posts, as i had the same problem. I wanted a whole level that couldn't go above a certain light level.
I stumbled across a solution, which was to set maximum, minimum and ambient all the same (i set mine at 60). This works even when coming in from a level with a full light spell.
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Set_light_ambient method?

Post by Chaos-Shaman »

that is great Saumun, i just didn't consider that. i struggled with the lighting for some time, never could get it to work perfectly from 0-100%. was working on a 100,80,60,40,20,0 effect for my outdoor scenes but never could get it to work correctly.
keep your gor coin handy
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

@Saumun: But are you still able to light various places of this level independantly? I actually want the player to enter a dark place with no possible ways to change the lighting by himself (no magic zone, no torchs allowed), but able to light various places of the level using dedicated items (which would work, for example, with "light" floor mechanics).

I don't remember if I've tried your solution (one year old question), but I'll test it, the question is still missing a satisfactory answer...
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

I just thought of a way to temporarily disable the party's torches so they don't give off any light. When the party enters the riddle level where you want the party's own light sources disabled, have the party activate a trigger that swaps all the party's torches out for an equivalent torch that doesn't give any light, then when the party leaves this area, swap them all back to the normal versions.

I can look into seeing if there is some way to get a relay to test for light levels and have it trigger an action set to create darkness if the light is above the target level, and create light if it is below. I'll post back here in a bit when I'm done.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

I played around with this a bit and am working on some ideas that may work for you, but it'll take a bit of time to play around with them. I'll post here again with my results when I've finished.
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Set_light_ambient method?

Post by Chaos-Shaman »

and also some of the objects emit light as well, you may have to check to see they are set to 0.
keep your gor coin handy
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

Right, like the Illumilet. If you have any such items, a simple swap out for a clone that doesn't emit light whenever the party enters that puzzle area would fix that, which is what I tested for the torches and that works perfectly. I then swap them back to the normal, light producing versions whenever the party leaves the special area. The challenge will be in figuring out what to do about any existing light spells. Preventing new light spells from being cast in this area will be easy, there is an object that creates a no magic zone, which could work for that, or there is the option of routing all light spells through a relay that checks if the party is in the no light area and just block relay from activating whenever the party is in that puzzle area.

I'll work out how previously cast light spells could be cancelled out, but this would be easier if I knew what the delays are for the light and long light spells at each power level. I'll have to look around for that in the morning.

Actually, this sort of unorthodox use of lighting in a dungeon could have many interesting applications in dungeons.
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Set_light_ambient method?

Post by Chaos-Shaman »

yes, i did play with the torches a while back, created a torch level. what i did was took the different torch settings and put them into a loop, from low medium high medium high, this gave the torch a flickering that made it seem all that much more real, then it was set up to a time limit to switch from high medium high low high, to a medium low medium low low. it worked pretty good, when it was down to low low low medium low, it was swapped eventually to burnt out. so it was the three torches put into loops set on a timer that eventually burns out.
keep your gor coin handy
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

I've searched around and couldn't find any info on how long the light spells last, if anyone knows this or where I could find this info please post it or a link to it...
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

Thanks for looking into that problem. For now, my "solution" is still a very unpleasant one: I turned the "light" spell into a "light_ambient" spell so I can play on how the lighting should be in the no-light level (and disabled the longer light spell); and placed a movable wall that blocks the level entrance if the player carries a torch (there are several versions for torches), an illumulet or any bolt caster staff. Bolt spells create light as well, and the "turn to alternate version" trick won't work as well for them as for the torches...
But the major problem is still the one you're trying to solve: the "ful" spell effect, since my current solution affects my whole dungeon... So good luck to you. As you said, this could open opportunities for many riddles.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

Right now the main holdup in getting the spell light solved is that I don't know how long the spells last or exactly how much light they produce. If I knew that I could have the ful spell run through a set of relays and use a counter to keep track of how much light is being produced by magic at any given time. With that info I could simply counter any active light spells with equivalent darkness effects.

In the meanwhile I'll play around with some other, simpler ideas and see if any of them works out.

as for the torches and illumelet, I have that solved.

I set up a little test dungeon with a "dark room" area and whenever the party enters that area, I have a trigger change the ambient light to 25, and swap out all torches in the dungeon to a version that produces no light using the swap_global_fast action. I do this for full, almost full and almost empty torches, each of which has a cloned version that does not emit any light. Any staff that has a light spell attached to it could just as easily be swapped out for a cloned version that has the light spell broken so that it does not produce any effect while in the area. To prevent any new light spells (eg ful) from being case, the simplest option would be to set up a 1 tile room somewhere that the party can't get at and place the floor mechanic party_tile on it, along with a floor mechanic no_magic_zone (it may not be that exact name but something to that effect).

The simplest way to deal with any existing light spells would be to just cancel them out with a darkness action powerful enough to override them, but also have a minimum light level set to the desired amount. I'll experiment with some ideas and see if anything works.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

OK, I did some experimenting with this and countering each light spell with an equivalent darkness action should work to cancel out any existing light spells if any are present. Keeping track of light spells could be done with a counter that is incremented for each light spell cast and decremented for each light spell that expires and for each darkness spell cast. The only thing it would take is doing testing to get the timing right and properly balanced.

Any item that's capable of producing light gets swapped out for a clone that does not produce light whenever the party enters your no light zone and swapped back to the normal versions whenever they leave this area. To prevent casting any new light spells fill the area up with the floor mechanic flooritem_nomagic_point.

To control the ful and oh ir ra spells, have them each activate a unique cloned relay that activates:
1- the wall mechanic action with the action set to action_light and action_light_long respectively
2- a relay that deactivates a counter, with 1 counter tracking how many full spells are active and another to track how many oh ir ra spells are active.
3- a relay set to a delay that activates the counter associated with the spell that's wearing off. (you will need to do some testing or searching to find out what the exact delay value you will need to synchronize this relay's delay with the amount of time it will take for the spell to wear off)

then, whenever the party enters your no light zone, have a trigger:
1 - activate a swap_global_fast for each item in the dungeon that can produce light for the non-light producing clone
2 - set a working counter to the value of the ful counter
3 - activate a relay that checks the value of the working counter, if it's greater then 0 have it activate a darkness action, activates the working counter (to decrease its value by 1) and reactivates itself, this way the relay will just keep going until the working counter gets to 0.
4 - repeat steps 2 and 3 for the oh ir ra counter
5 - the trigger(s) that swap all light producing items back to their originals
6 - a relay that deactivates this trigger


when the party exits this area, have another trigger (starts inactive) that:
1- swaps all light producing items back to their originals
2 - activates the trigger above
3 - activates a relay that deactivates this trigger

I'd recommend you set up a tiny 2 level test dungeon to experiment with the relays and delays until you get it right, so you don't risk messing up your big dungeon with any experiments if something doesn't work right.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Set_light_ambient method?

Post by Paul Stevens »

That's a rather extensive hack. And a bit
delicate in all probability. CSBwin or DSB
could probably handle the whole affair with
a single function call to set the 'ABSOLUTE'
light level. Is RTC that much better?
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

SU: thank you for this idea. Never thought of turning these spells into relays activators, which is something that I did several times in the case of, eg, creature death. The 3rd point will probably be tricky, but it should work.

About the staffs, I was just pointing out the fact that firing a bolt creates light,even if it doesn't last. In my no-light level, I don't want the player to be able to cast any form of light, even bolts lights, so the whole level is a no-magic zone and I also ban the staffs, storm rings, etc at the level entrance. Anyway, that's another problem, I don't need a special solution for this. Maybe a trigger that turns the player's torches and staffs to _x ones (consumed) would sound more logical to the player than the movable wall I talked about. The player would leave his staffs at the level entrance anyway.

I'll test your idea as soon as I have enough time for it...

Paul: the point is that my dungeon is pretty big already, I don't want to recode it from the begining.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Set_light_ambient method?

Post by Paul Stevens »

I don't want to recode it from the begining.
Nor would I.
User avatar
Seriously Unserious
Master Superior
Posts: 1418
Joined: Sun May 11, 2008 11:53 am
Location: Wandering around aimlessly in Lynchgate Woods
Contact:

Re: Set_light_ambient method?

Post by Seriously Unserious »

@IP: I'd swap the staffs out for a cloned version that has all functions disabled so you can then swap them back to the normal version when the party exits the no magic, no light zone. From my testing, such a zone works best if it's on it's own level, accessed via either teleporters, stairs or pits.

and I agree, I wouldn't want to start a big, well-developed dungeon again in a new engine either.
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Set_light_ambient method?

Post by Chaos-Shaman »

About the staffs, I was just pointing out the fact that firing a bolt creates light,even if it doesn't last. In my no-light level, I don't want the player to be able to cast any form of light, even bolts lights
yeah i see what you mean. maybe you could fire a stone representing the bolt, create your own firebolt just for that level.
keep your gor coin handy
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

Well, I've tried looking into this again. Basically, it's about being able to control the lighting without totally killing the DM lighting mechanics.
I tried SU's solution, but finding exactly how fast the light (and longer light) spell fades out is very complicated... It seems like there are several parameters affecting the fading: the spell level (LO, UM, ...), the spellcaster level, etc. It probably depends on some random realizations as well... I gave up.
I thought of another solution which is a mix of SU's solution and mine, which was to replace the LIGHT action of the ful spell to a LIGHT_AMBIENT action. LIGHT_AMBIENT only affects the level where it is casted. It also sets (instead of LIGHT, which increases) the lighting. Easy to control, but the lighting never fades out so, it's nothing like DM anymore.

So I tried building the fading out by myself using the following technique: the ful spell activates a relay that activates two actions (act1 and act2) and one relay (rel1).

- act1 is a light_ambient action, strength 0. Explanation: It sets the current level ambient light to a value depending over the spell level (and over some random spell realization, you don't always get the exact same lighting).
- act2 is a set_counter action, strength 0, on counter count1. Explanation: count1 is set to the number corresponding to the spell realization, meaning to the current level ambient light.
- count1 does nothing. Explanation: it's just here to count what the current level ambient lighting is.
- rel1 activates a counter (count2) and itself, after some fixed delay, say 10. It only works if count1 is greater than 0.
- count2 initial value is greater than 0, say 40. It activates an other relay, rel2. Explanation: The count2 initial value and the delay in rel1 will in the end decide on how fast the light fades out: what was so complicated to find out!
- rel2 activates 3 actions: act3 act4 act5.
- act3: resets count2 to its original value (here 40). Explanation: count2 will then keep on counting from 40 to 0 as long as there is light in the level (which is decided by rel1 condition).
- act4 is the action responsible for the fading out. And that's where my problem is.
- act5 is a counter_decrement acting on count1, strength 1. Explanation: it counts the fading out.

Example: the player enters a level with 0 light. He casts UM FUL. The level light goes to, say, 35. count1 is also set to 35. count2 starts counting from 40 to 0 every 10 time units. Each time 0 is reached, count1 and the light level decreases, until they reach 0 (if the player casts a new spell, nothing wrong, count1 and the light level change and count2 keeps on counting). Once 0 is reached in count 1, everything stops and is back as when entering the level.

Allright. I guess it's hard to understand. I can send a file if you want... All of this works as expected, but without act4, it's useless. Here is what I tried for act4:
- a dark_ambient method, strength 1. I thought it would reduce the ambient light by 1. But it actually does that just one time and does nothing then. I tried checking if act4 is activated just once (by adding a sound activation at the end of what rel2 does) and it is activated several times. It just does nothing past the first activation. Question: what does the dark_ambient method do???. I just can't understand this!!!
- a light_ambient method, with strength the counter count1 value after it has been decreased, using the %VALUE:ref...% technique. It's not allowed by RTC in the "strength" box. I can't think of another way to send the count1 information to this action...
- I tried using dark, but it's not acting on the same lighting, there are two independent lightings: the party light and the current level light. I was not able to do anything with it. BTW, strength 1 on dark is much more effective than on dark_ambient...

So... I'm close to a nice solution, but blocked once again. Any idea on the dark_ambient method? Any alternative idea on how to do this? Any news concerning a totally different solution? I'm not used to hex editors, is there a way to use something like this to see the variables in use, as it could help in finding how fast the normal light spell fades out? Did you like the colors? What is the difference between a duck?
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

I also tried using DARK_AMBIENT exactly as I use LIGHT_AMBIENT (through a spell activating a relay activating an action), and I get the same problem: it just works once.
I even tried making a DARK_AMBIENT attack method for a monster so I don't use an action object, and I get the same as well: the monster reduces the light when attacking the first time, and his next attacks do nothing, no matter if I recast a LIGHT_AMBIENT spell or not.
I guess the dark_ambient method is bugged... Or I just don't get what it does.
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: Set_light_ambient method?

Post by Saumun »

I may have gotten a little muddled here...
Do you want the whole level at a particular maximum light with the light spells making it brighter in certain areas?
Or do you want those areas already brighter than the rest of the level without spells?
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
Post Reply