View previous topic :: View next topic |
Author |
Message |
Greenwado Well, it's just me, what did you expect?

Joined: 09 Aug 2010 Posts: 70 Location: Okacha (OK-A-CHA)
|
Posted: Sat Aug 14, 2010 7:39 am Post subject: Flashlight |
|
|
How could I make a Flashlight for my walkabout player character using plot scripting? In your answer could you write an example script or a couple of lines to help me figure this out. I want to make a action Thriller game sort of like Alan Wake. _________________ Happy RPG Makin |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Sun Aug 15, 2010 1:41 pm Post subject: |
|
|
First, making a game similar to Alan Wake will require extensive scripting knowledge. You might want to start small.
Second, I've made a game with a flashlight in the past.
Here's the link:
http://www.castleparadox.com/gamelist-display.php?game=938
Third, if you like the flashlight script in House Escape (the above game) I'd be willing to share a little of the code. If you're looking for something different I may still be willing to put you on the right track. |
|
Back to top |
|
 |
J_Taylor The Self-Proclaimed King of Ketchup

Joined: 02 Dec 2009 Posts: 188 Location: Western NY
|
Posted: Tue Aug 17, 2010 3:41 am Post subject: |
|
|
How about a script for just illuminating certain areas; e.g. You're in a dark cave (black) and the only light comes from flickering torches which you can grab and move? _________________ Elemental: .75%
Heart of Darkness: 0% (crash)
The Mansion: .05%
Shattered Alliance: .05%
See a pattern forming? I do, dammit. |
|
Back to top |
|
 |
J_Taylor The Self-Proclaimed King of Ketchup

Joined: 02 Dec 2009 Posts: 188 Location: Western NY
|
Posted: Tue Aug 17, 2010 3:48 am Post subject: |
|
|
How about a script for just illuminating certain areas; e.g. You're in a dark cave (black) and the only light comes from flickering torches which you can grab and move? _________________ Elemental: .75%
Heart of Darkness: 0% (crash)
The Mansion: .05%
Shattered Alliance: .05%
See a pattern forming? I do, dammit. |
|
Back to top |
|
 |
Pepsi Ranger Reality TV Host

Joined: 05 Feb 2003 Posts: 493 Location: South Florida
|
Posted: Tue Aug 17, 2010 6:50 am Post subject: |
|
|
Quote: | How about a script for just illuminating certain areas; e.g. You're in a dark cave (black) and the only light comes from flickering torches which you can grab and move? |
Besides all the helpful answers that come from reading Hamster Republic's OHRRPGCE FAQ's page and clicking on various community resources, there really is a wealth of helpful information in the issues of HamsterSpeak. All you have to do is look:
http://superwalrusland.com/ohr/issue24/lighting/lighting.html
If you give it a chance, you'll find that learning the tricks of the engine through research is almost as fun as making games with it. Remember, kids, reading is FUNdamental. _________________ Progress Report:
The Adventures of Powerstick Man: Extended Edition
Currently Updating: General sweep of the game world and dialogue boxes. Adding extended maps.
Tightfloss Maiden
Currently Updating: Chapter 2 |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Aug 17, 2010 5:10 pm Post subject: |
|
|
There have been quite a few games which have implemented a flashlight by painting black tiles over the map, even before map layers were added (Project `C'). But now you can use slices instead to black out the screen except for a circle of light around the hero, which is both much easier and looks better because it's not jerky as you move around. House Escape is the only game I know of to have used slices to do that so far, so I'll give a script (also put up at 'Scripts:Flashlight circle of light').
On the other hand, you can't do that "local lighting" effect shown in that article. You could limit the circles to walls, but that's much more work.
So if you want to use slices:
* paint a 320x200 overlay
* split it into 80x80 pieces (the size of large enemy graphics)
* save them each as 16 colour BMPs
* import them as large enemy graphics (if any are duplicates, you need just one copy of each)
* adapt this script:
(EDIT: I forgot about slice collections! If you're using a 'nightly build', you can see the wiki article instead of using this script)
Code: | global variable (1, flashlight circle)
plotscript, setup flashlight, begin
#we don't care how large this container slice is
flashlight circle := create container
#change this to whatever your topmost map layer on those map(s) is
set parent (flashlight circle, lookup slice (sl:map layer 2))
variable (sl)
#change these numbers
sl := load large enemy sprite (10)
set parent (sl, flashlight circle)
put slice (sl, 0, 0)
sl := load large enemy sprite (11)
set parent (sl, flashlight circle)
put slice (sl, 80, 0)
#...
sl := load large enemy sprite (19)
set parent (sl, flashlight circle)
put slice (sl, 240, 80)
sl := load large enemy sprite (19)
set parent (sl, flashlight circle)
put slice (sl, 240, 160)
) |
And you can get rid of the effect later with "free slice (flashlight circle)" _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|