[SOLVED] Character skipping regions when interacting an object/hotspot

Started by Nadarian, Sat 30/05/2020 10:55:29

Previous topic - Next topic

Nadarian

Hi there!

This is de situation: My main character has to go through a few regions in the middle of the scene, where there's a strong lightstream. Those regions continuously adjust his LightLevel to add a realistic touch when he's walking under that light, but here's the problem: If the character walks over those regions because the player clicks on an object or hotspot on the other side of the lightstream, the character goes through it completely unaffected by regions.

How could I solve this? ???

Thanks in advance!!
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

Cassiebsg

I don't the problem, when the character walks in blocking mode he won't activate the regions...

I guess the only way I can think of, is checking in rep_exe if the player is on one of those regions and "manually" change his light level.
There are those who believe that life here began out there...

Khris

I did a quick test and a blocking walk through a region with a light level different from 100 works as expected; Roger got brighter just fine during  player.Walk(..., eBlock);

Can you elaborate a bit on what else could be causing this? Did you use region events to change the character's brightness? Because those indeed don't work during blocking walks.

Nadarian

Yes Khris, I used region events to set a different light level on the character (while standing on the region).
How can I change character's brightness in different areas of the background if it's not using region events?
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

Laura Hunt

Regions have their own light level property baked in, you don't need to use events for this. Select a region in the editor, look at the Properties panel, and you'll see a LightLevel property. Set that to your desired light level and that's it!

(Also, as a general rule, if you want something to happen regardless of whether the game is being blocked, use repeatedly_execute_always instead of repeatedly_execute.)

Khris

Nadarian, for stuff that isn't built-in, it's always preferable to use the other two events unless "while standing" is actually necessary. Code in that function will run each game frame (i.e. 40 times per second), so starting an animation for instance wouldn't work unless you write additional checks that make sure the animation is only started once.

Nadarian

Done!
Thanks Khris and Laura! Still learning a lot of basic stuff, and... though I already saw "LightLevel" was among regions properties, I completely forgot about it when I tried to implement this feature, and used the events instead.
Now it works as it should :)
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

Nadarian

Going further into development, I found a new problem related to this.

To sum up: I set a few regions in a room that affect main character's brightness while he's standing there, under a stream of light. As you told me, I did it in the baked in level property in the regions, and worked perfectly even when the character was eBlocked

Now, the room next to this one changes the main character's brightness and tint permanently while in there, so when he comes back to the first room, he's still all tinted and dark. To solve it, I coded this:
Code: ags

function room_Load()
{
  cRoger.Tint(0, 0, 0, 0, 0);
}


But then I noticed, doing this sets those levels permanently, and makes those regions levels completely useless. How can I make him go back to its normal levels, while these regions keep working at the same time in that room?

Tanks!
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

Crimson Wizard

Quote from: Nadarian on Wed 22/07/2020 12:24:00
But then I noticed, doing this sets those levels permanently, and makes those regions levels completely useless. How can I make him go back to its normal levels, while these regions keep working at the same time in that room?

From the manual: https://github.com/adventuregamestudio/ags-manual/wiki/Character#charactertint

Quote
To remove the tint set by this function and return to using the ambient tint for this character, call RemoveTint.


Nadarian

Ok, yes.. it was this simple! (roll)

Thanks for your patience!!
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

SMF spam blocked by CleanTalk