Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: R4L on Thu 24/06/2004 23:52:21

Title: Light level scale question
Post by: R4L on Thu 24/06/2004 23:52:21
Is it possible to have like a scale or bar that adjusts to the light like in Splinter Cell? I thought about this and thought it would be cool.
Title: Re: Light level scale question
Post by: Radiant on Fri 25/06/2004 15:01:11
What do you mean, an area with a gradual light level? Nope, not currently possible.
But you could do something with TintScreen or SetAreaLightLevel in RepExAl.
Title: Re: Light level scale question
Post by: Scorpiorus on Fri 25/06/2004 15:02:07
I haven't had a chance to play Splinter Cell but if you are talking about brightness here is the thread: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=11263.0
Title: Re: Light level scale question
Post by: R4L on Sat 26/06/2004 03:54:54
The brightness scale is what I am talking about. In Splinter Cell, if you move your character into a dark corner, a little meter on a scale will go down. The scale is horizontal and at the left it gets darker and it gets lighter at the right. Depending on how dark the enviroment is, the scale determinds how dark your character is and how other chars won't see you.
I am talking about doing this and having your character get darker. By the way, is there a way to make it so an emeny won't come after you if you are in a dark spot? Like is there a way in the script to make it so if the player character's too dark(like in 30-40 on regions light level) so an enemy character won't come after you?

Also, how can I make it so like if you want to shoot someone before they shoot you? I have been practicing with the SetTimer and GlobalInts but I can't seem to find an answer.
Title: Re: Light level scale question
Post by: Scorpiorus on Sat 26/06/2004 17:03:58
You can draw a region and set its light level to the one you want and then when a character is standing on it adjust a meter accordingly. A meter scale can be the GUI slider object or something.
If you are talking about continues gradual changing of the light level then, as Radiant already said, it's not supported at the moment and you then have to manually workaround it with SetAreaLightLevel.

QuoteBy the way, is there a way to make it so an emeny won't come after you if you are in a dark spot?
There is no currently way to get a light level of an area, so you need either store it in a variable and override a region light settings or just use GetRegionAt to check what area the player is standind at. That, of course, won't let you determine an actual light level:

room's repeatedly:
int pc = GetPlayerCharacter();
if (GetRegionAt(character[pc].x, character[pc].y)==3) {

// assuming region number 3 is a dark one
// here should go a code handling that event.
// ex: stop an NPC following you

}

QuoteAlso, how can I make it so like if you want to shoot someone before they shoot you? I have been practicing with the SetTimer and GlobalInts but I can't seem to find an answer.
Depends of how you want it to happen, you can make it so if a player clicked on the enemy, the one dies. And, yes, using timers, make the enemy to shoot:

when the enemy has seen you:

SetTimer(1, 100); // set a timeout before the enemy shoots

rep ex:

if (IsTimerExpired(1)==1) {

int enemy_shot_accuracy = Random(10);
if (enemy_shot_accuracy > 5) { <player dies> }
else SetTimer(1, Random(50)); // set a timeout for the next shot

}
Title: Re: Light level scale question
Post by: R4L on Thu 01/07/2004 20:57:22
Thanks! I am going to work with the timer and stuff. Thank you all for the help!

Oh yeah, one more thing, I am trying to save the game and stuff, but I get this error saying that the nested functions are not suppoted or there is no closing brace.
This is what I have.

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: Player enters screen (after fadein)

#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE
Title: Re: Light level scale question
Post by: Gilbert on Fri 02/07/2004 02:35:48
heh isn't that obvious?

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: Player enters screen (after fadein)
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE