Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: a-v-o on Wed 21/09/2005 20:53:14

Title: PLUGIN: Flashlight plugin v1.2
Post by: a-v-o on Wed 21/09/2005 20:53:14
Hello everybody who was waiting for this great new feature  :o  in the flashlight plugin:

In version 1.2 the state of lighting is saved and restored with the game, so after restoring a saved game the lighting will be exactly as it was when it was saved. No more scripting is needed.

OK, I confess: I just added these few lines of code and changed the version number which was the most difficult part of the update.  ;D

And thanks to all who voted for this plugin.

Download here (http://ags.freie-ressourcen.de/plugins/ags_flashlight_1_2.zip)

Download other AGS scripts and plugins: http://ags.freie-ressourcen.de/
Title: Re: PLUGIN: Flashlight plugin - v1.2 released
Post by: JD on Wed 21/09/2005 21:18:32
Hurrah a new version! :D I love this plugin, though there is one thing which I'd love to see: multiple lightspots. So you could have a fixed lightspot, and a moveable flashlight spot in the same room :)
Keep up the good work!
Title: custom flashlight
Post by: Mordalles on Thu 13/04/2006 21:11:54
i cant get the flashlight plugin to work with version 2.7. i read something about only working with 16bit? my game is 32 bit. is that it?

anyway, i was just wondering the guy who wrote the flashlight plugin used? tints? or rawdraw? or what. i want to try my own, but dont have any time since im doing it for mags. i just need a headsup.  ;D  :-\
Title: Re: custom flashlight
Post by: DoorKnobHandle on Thu 13/04/2006 21:17:25
I don't know what the creator of that plug-in used (chances are he didn't even use AGS's native drawing functions but other ones that are available only when you are writing a plug-in for AGS), but the simple flashlight effect is quite easy to simulate anyways -- just create a GUI with a black rectange that has a transparent circle in it and position this GUI so, that the center of the circle is always where the mouse currently is. That's just a bit of playing around with offset values, and then you can enable or disable your flashlight by showing or hiding this GUI.

Additionally (if your game is 32-bit), you could add alpha transparency which is going to improve the look of your flashlight effect even more.

Was that understandable? If not, feel free to ask again!
Title: Re: custom flashlight
Post by: a-v-o on Thu 13/04/2006 23:45:13
The flashlight plugin was programmed in Delphi without using the AGS script functions. Parts of the plugin are written in assembler.
Title: Re: custom flashlight
Post by: Mordalles on Fri 14/04/2006 20:27:41
thanks, dkh! it was understandeable!  ;D

i wanna use it for mags, so that sounds like a perfect solution.

in delphi you say? didn't know you guys wrote the plugins with other languages. is the source code available, since i know delphi pretty well.  8)
what is the best language to write plugins in? c++ or delphi?
Title: Re: custom flashlight
Post by: Scorpiorus on Mon 17/04/2006 20:28:22
In theory, you can write a plugin in any language that is capable of building a Windows DLL file.

Practically though, there are two templates (for C++ and Delphi) available to use.

Also bear in mind, only C++ (using Microsoft Visual C++ compiler) is officially supported.

Here is the link to plugin page (with templates and API reference):

http://www.adventuregamestudio.co.uk/acplugin.htm
Title: Re: custom flashlight
Post by: a-v-o on Tue 18/04/2006 12:09:58
You can find the delphi plugin template on:
http://ags.freie-ressourcen.de/
It is for following AGS version:
  AGS    : v2.60.450 (2.6)
  Editor : v1
  Engine : v12

The engine is now in version 18, so some functions must be added.

You can download the source code for the flashlight plugin with the following link:
http://ags.freie-ressourcen.de/plugins/ags_flashlight_1_2_source.zip


Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: petaglair on Mon 23/10/2006 20:23:47
hi
i would like to know if i could use this plugin with ags version 2.72

Thanx

Pétaglair
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Candle on Fri 27/10/2006 04:00:41
It does. well it did for me.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Da_Elf on Thu 30/11/2006 17:09:25
I'm trying to give this a try but when i go to save the room it says it doesnt like the code. it says error (line 207): undefined symbol 'GetPlayerCharacter' in this code



SetFlashlightFollowCharacter (GetPlayerCharacter (), 0, -20, 20, 10);


did it change in 2.72 to something else and if so what did it change to. ive tried looking around the help manual but cant seem to find it.

actually when i check properties in the plugin al the tabs like syntax basic/tint etc are all empty. am i supposed to paste the code from the tutorial.txt file into those spaces?

opps. my backgrounds are 32bit so I'm guessing it wont work anyhow :(

EDIT

does anyone know of a way i can do this for a 32bit game? i have a character walking around in a cave with a flaming torch and i need to get the same effect this plugin seems to want to do.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Kweepa on Fri 01/12/2006 00:55:28
Quote from: Da_Elf on Thu 30/11/2006 17:09:25
i have a character walking around in a cave with a flaming torch and i need to get the same effect this plugin seems to want to do.

Quote from: dkh on Thu 13/04/2006 21:17:25
the simple flashlight effect is quite easy to simulate anyways -- just create a GUI with a black rectange that has a transparent circle in it and position this GUI so, that the center of the circle is always where the mouse currently is. That's just a bit of playing around with offset values, and then you can enable or disable your flashlight by showing or hiding this GUI.

Additionally (if your game is 32-bit), you could add alpha transparency which is going to improve the look of your flashlight effect even more.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Da_Elf on Fri 01/12/2006 16:55:53
yeah but is it possible to have a gui follow the possition of the character. also is it possibly to have a gui component (like the circle only) follow the character where as the black rectangle part remains where it is?
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Rui 'Trovatore' Pires on Fri 01/12/2006 19:31:20
Quoteposition this GUI so, that the center of the circle is always where the mouse currently is.

If you can do it with the mouse, why shouldn't you be able to do it with the character?

As for your other question, no, not as far as I know. Why isn't the whole rectangle good enough for you?
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Da_Elf on Fri 01/12/2006 20:32:31
im assuming the rectangle of the GUI is going to be black to represent the dark area of the cave and the circle will be in the center and this will be transparent. therefore we will be able to see our background where the circle is. if the center of the gui is centered on the character then it means that the rectangle will have to be double the screen size. this way when the character is all the way to the left then the edge of the gui is slightly beyond the edge of the screen on the right. where as if you could get an element of the GUI to follow the character (the circle) then the rectangle can be screen size and will never need to move. I was wondering if this was possible since i wasnt sure if having a huge GUI would slow down the game play
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Rui 'Trovatore' Pires on Sat 02/12/2006 10:20:32
It sounds like a huge slowdown, but it isn't, really, hence my last question.
Title: Re: PLUGIN: Flashlight plugin v1.2 in 32bit color
Post by: Lt. Smash on Fri 09/02/2007 18:34:33
is there a way to make that plugin work with 32bit color?
if not, could the author of that plugin or someone else fix that?

I'm using alpha blended sprites so I can't use 16bit and I need that plugin.

Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Kweepa on Sun 11/02/2007 17:02:35
If you read Da_Elf's posts on this page and those following, you will find help.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: monkey0506 on Mon 12/02/2007 08:25:23
I wrote a module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=30137.new#new) to achieve a similar effect which should work with 32-bit games.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: beomoud on Fri 31/10/2008 12:58:06
I can't get the function to work, i used the plugin, i put the "switch flashlight on" part in my code but nothing happens. What could be the problem?
Title: SOLVED: Turn off Flashlight 1.2.1
Post by: Slasher on Thu 27/09/2012 06:31:17
I am using Flashlight plugin 1.2.1 by Andreas Vogel and I can't seem to turn it off.

I was ok, if I remember, with and older version.

After using it in a darkened room and then going back to previous room I have the room state set to background 1 and the player back to normal views. However at most I clear the follow character spotlight but the room looks 'washed'.

Tried
Code (AGS) Select
SetFlashlightDarkness (GetFlashlightMaxLightLevel ());

Are you able to assist:

many thanks

Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Gilbert on Thu 27/09/2012 06:43:46
(Merged with the plugin's thread.)

I'm not sure as I have never used it, but since the plugin is rather old there may be some compatibility problems (people more familiar with the plugin may be able to share some light on this). You may also try the module (http://www.adventuregamestudio.co.uk/forums/index.php?topic=30137.0) version which is a bit newer.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Slasher on Thu 27/09/2012 13:50:46
Flashlight Version 1.2.1

I was having trouble turning it off.

For those that may come across my scenereo I have made 2 buttons: light on and light off which controls flashlight on and off. I can also switch it on via a light item in the inventory which i use on player. I have 2 backgrounds: black room (background 0) and the main room background 1.

This is what I used:

Code (AGS) Select
function Blighton_OnClick(GUIControl *control, MouseButton button)
{
  SetBackgroundFrame(1);
 
  cELF.ChangeView(40);
  cELF.SpeechView=41;
  cELF.SetIdleView(42, 0);
 
  SetFlashlightDarkness (20);
  SetFlashlightBrightness (GetFlashlightMaxLightLevel ());
  SetFlashlightDarknessSize (50);
  SetFlashlightBrightnessSize (100);
  SetFlashlightFollowCharacter ( (1), 0, -20, 20, 10);
}

    function Blightoff_OnClick(GUIControl *control, MouseButton button)
   {
    cELF.ChangeView(3);
    cELF.SpeechView=4;
    cELF.SetIdleView(12, 0);

    SetBackgroundFrame(0);
    SetFlashlightBrightness (GetFlashlightMaxLightLevel ());
   }



sorted
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Julius Dangerous on Wed 01/01/2020 22:27:24
This is the best (and only) plugin for flashlight, i updated my game to AGS 3.4 and 3.5 and it doesn't works any more :sad: :cry:
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Cassiebsg on Thu 02/01/2020 16:51:16
@Julius, what error does it give?
I'm not sure it works with plugins, but have you tried setting the compatibility to 3.4 version?
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Crimson Wizard on Thu 02/01/2020 18:49:04
Quote from: Cassiebsg on Thu 02/01/2020 16:51:16
I'm not sure it works with plugins, but have you tried setting the compatibility to 3.4 version?

No, it does not affect plugins.
EDIT: the only way script version may affect plugin is if plugin's script function matches some of the new engine functions and there's naming conflict.
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Julius Dangerous on Thu 02/01/2020 22:13:12
Quote from: Cassiebsg on Thu 02/01/2020 16:51:16
@Julius, what error does it give?
I'm not sure it works with plugins, but have you tried setting the compatibility to 3.4 version?

no error message, tried with other compatibility script version, but game starts and flash light not working
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Crimson Wizard on Thu 02/01/2020 22:48:27
Quote from: Julius Dangerous on Thu 02/01/2020 22:13:12
no error message, tried with other compatibility script version, but game starts and flash light not working

Have you tried running in Software gfx mode? I have a thought this original plugin may only run with DirectDraw5 (called Software renderer now).

I don't remember how flashlight looks like in this plugin, but maybe it's possible to recreate with just a black GUI with a transparent hole?
Title: Re: PLUGIN: Flashlight plugin v1.2
Post by: Julius Dangerous on Mon 13/01/2020 17:03:04
Quote from: Crimson Wizard on Thu 02/01/2020 22:48:27
Quote from: Julius Dangerous on Thu 02/01/2020 22:13:12
no error message, tried with other compatibility script version, but game starts and flash light not working

Have you tried running in Software gfx mode? I have a thought this original plugin may only run with DirectDraw5 (called Software renderer now).

I don't remember how flashlight looks like in this plugin, but maybe it's possible to recreate with just a black GUI with a transparent hole?

Thanks for answer. Yes i tried with all modes and with all script compatibility/API version combinations, and 16/32 color depth.
So i made it with a GUI (double of the screen size) with an hole in the middle (png), and added script:

function room_RepExec()
{
gFlashlight.SetPosition(mouse.x-800, mouse.y-600);
}
:cheesy: