Fog of War

by Forum_account
Fog of War
A library to create an RTS-style "fog of war" effect.
ID:121100
 
The library uses image objects to create fog of war for clients. The map is covered with blackness that disappears as the player explores. Tiles within a certain range are completely visible, but previously explored tiles fade to gray when they're out of your range.

Multiple mobs can contribute to a client's sight so this is all set to include in an RTS game.

To use the library, here's all you have to do:

// initialize fog of war for the client
client.fog = new(client)
client.fog.init()

// define the mob's sight range and tell the library that this
// mob's sight contributes towards its client's visibility
fog_sight = new(src, client, 2)
Is there a way that you can only set this to a certain area if you dont want every map to have fog on it?
In response to ImmeasurableHate
When you initialize the FogClient object you can pass it a z level to create fog for:

client.fog = new(client)
client.fog.init(1)

That'll make the fog only on the first z level.
ahh thanks.
Why cant i change mob icon_state once i use fog