English What Does The fow_in Function Do

9 replies
Goto Page
To the start Previous 1 Next To the start
Up
Mami Tomoe
User
Offline Off
While snooping around with CS2D I found a function called
fow_in
, but I do not know what it does.

Does anybody know?
24.09.21 03:34:09 pm
Up
mrc
User
Online On
Yes, I know. But I don't wanna do that.
CS2DBR @ Comunidade Brasileira de CS2D | https://www.cs2dbr.com
24.09.21 07:17:48 pm
Up
DC
Admin
Offline Off
Oh interesting. It's not documented.
It checks if something is inside fog of war or not.
parameters:
• player ID (it checks if the coordinate is inside the visible area of THAT specific player)
• X coordinate to check (in pixels, not tiles)
• Y coordinate to check (in pixels, not tiles)

returns:
0: coordinate is NOT covered by fog of war (= visible)
1: coordinate IS covered by / is inside the fog of war (= invisible)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
25.09.21 04:41:58 am
Up
Cure Pikachu
User
Offline Off
@user DC: Does that function always return 0 if fog of war is disabled?
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
25.09.21 09:00:40 am
Up
Masea
Super User
Offline Off
Jesus Christ, user DC. I even asked for that in the ideas thread back in the day. Also remember user Rainoth was against the idea because he didn't get the point of such a function and he claimed you can do a very similar checker with just basic Lua on your own. I always thought it'd be cool to have it in the original game since it is kinda expensive to do it yourself (also would be less accurate). I wish it was documented all these years, can't imagine how many beautiful things you could have done with it...
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
25.09.21 09:57:59 am
Up
SQ
Moderator
Offline Off
@user Masea: I've added it not long ago. Probably in the last version.
I might have looked at old ideas thread at that time and this seemed like easy implementation to do.
Took a few minutes.
25.09.21 11:11:46 am
Up
DC
Admin
Offline Off
Documented!
cs2d lua cmd fow_in
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
12.11.21 03:30:04 pm
Up
The Dark Shadow
User
Offline Off
Tested it several times, and all the times it returned 1, whether the player exists or not. Does that even work? Also, would you guys mind teaching us how to do the calculations and maths in LUA without fow_in? Maybe sharing the fow_in related code would be cool! For a very long time I wanted to understand how the fow system works, and I never understood it yet.
13.11.21 12:23:14 pm
Up
DC
Admin
Offline Off
@user The Dark Shadow: What does the script look like which always gives you a 1 as return value? Make sure you're getting the parameters right. Especially the order and the fact that the coordinates are in pixels and not in tiles.

I'm not sure if that command works to be honest. I think user SQ implemented it and I never tested it.

The fog of war calculation works with simple ray casts which are shot from the player to reveal the area and which are stopped by walls. It's a pretty inefficient way of doing it. There are much better ways.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
14.11.21 07:06:10 pm
Up
The Dark Shadow
User
Offline Off
@user DC: I don't know why last time it didn't work, I tested it once again and it worked properly, maybe there is something wrong with it sometimes. Anyways, thanks!
To the start Previous 1 Next To the start