Light level scale question

Started by R4L, Thu 24/06/2004 23:52:21

Previous topic - Next topic

R4L

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.

Radiant

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.

Scorpiorus

#2
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

R4L

#3
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.

Scorpiorus

#4
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

}

R4L

#5
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

Gilbert

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

SMF spam blocked by CleanTalk