ID:149637
 
Digital X wrote:
In DM i was thinking and came up with an idea for a proc.
That Proc is FlashScreen
EG

mob/verb/sleep()
FlashScreen('digital.bmp',usr)//Flashes the usr's screen with 'digital.bmp'
usr.health= usr.MaxHealth

or...
mob/verb/blindingFlash(mob/M in oview())
FlashScreen('attack.bmp',M)//flashes M's screen with 'attack.bmp'
M.Health -= usr.Strangth

Like That.
If it can already be done somehow, can someone tell me how??

Thanks
Digital X

I would create a client screen object and show it to the client for one or more ticks, then remove it from the client screen. The following code flashes a single tile icon to the entire screen. If it doesn't fit your needs you can use it as a guide to create your own multi-tile image flash.
proc/FlashScreen(icon, who, layer = FLY_LAYER, delay = 1)
/* Flashes an icon on the entire mapscreen of a player.
ARGS:
Arguments marked with an * are optional
icon icon to be flashed onscreen
who mob or client to show the flash too
layer* graphic layer this obj will be flashed on.
You probably want it above all other map
items so it defaults to FLY_LAYER.
delay* number of ticks the flash is to remain onscreen.
Default value: delay = 1
*/

// get the client for who
var/client/Client
if(ismob(who))
/* I use : here because Who isn't a mob
type var, but the line above makes
sure that Who is a mob. */

Client = who:client
else if(istype(who,/client))
Client = who

if(!Client) return // no need to go on if there is noone to display this to.

// create the display obj
var/obj/O = new()
O.layer = layer
O.icon = icon
// this single obj covers the entire map
O.screen_loc = "SOUTHWEST to NORTHEAST"

Client.screen += O // show it to Client

spawn(delay)
// remove it from Client's screen
Client.screen -= O
del(O)


If you intend to flash the same image many times, it may be better to create a single instance of that image and use it each time you flash, especially if you use a larger image.