Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-05-2008, 11:12 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Let there be light!

A little lighting effect I made for single levels. You simply put the code in an NPC in the level or place it in a class and join it, the choice is yours really. You can have more than one light source in a level, but it's not gonna do anything advanced, just merely overlaps(and when played with, you can get some nice looking effects out of it). I use it for just aesthetic reasons, not logical. Like in my screenshot I'm not using it to show light coming from a window, but just to create some nice looking effects.
I should note that even though it does a lot of looping, it only does so when you enter the level and it is not noticeable at all(at least in my experience, and I run on a pretty damn terrible computer, and in my level I'm using two).
Anyways, here's the code, and an image attachment of it in effect:
PHP Code:
//#CLIENTSIDE
function onPlayerenters() {
  
// These are tiles that light will 'pass through'... add stuff like vases(that can change 
  // blocking) here. I also have the window tiles in there... so you can have a light source
  // coming from the windows, you might want to remove that
  
temp.nonblocking={0x2AC,0x2AD,0x2BC,0x2BD,0x30C,0x30D,0x30E,0x30F,0x31C,0x31D,0x31E,0x31F};
  
temp.opacity=.5// how opaque the shadow will be
  
temp.checks=300// how many checks to perform, careful not to exceed limit loop

  // NOTHING TO EDIT BELOW THIS
  
temp.seg=(pi*2)/checks;
  
temp.poly={0,0,0,64,64,64,64,0,0,0};

  for (
i=0;i<checks+1;i++) {
    for (
j=0;j<64;j+=.5) {
      if (
onwall(x-sin((i*seg))*j,y-cos((i*seg))*j)) {
        if (!(
tiles[x-sin((i*seg))*j,y-cos((i*seg))*jin nonblocking)) {
          
this.newpoly={int((x-sin((i*seg))*j)+.5),int((y-cos((i*seg))*j)+.5)};
          break;
        }
      }
    }
    
poly.add(this.newpoly[0]);
    
poly.add(this.newpoly[1]);
  }
  
poly.add(0);
  
poly.add(0);

  
showpoly(200,poly);
  
changeimgcolors(200,0,0,0,opacity);
  
changeimgvis(200,0);

Sorry for the bad screenshot... I don't know how to do a full level screenshot in Graalv5.
Attached Thumbnails
Click image for larger version

Name:	graal_1204750948.png
Views:	344
Size:	18.8 KB
ID:	44059  

Last edited by DustyPorViva; 03-05-2008 at 11:38 PM..
Reply With Quote
  #2  
Old 03-05-2008, 11:24 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Very nice, though I was never a huge fan of these kinds of systems. They don't seem to fit into Graal style.
__________________
Reply With Quote
  #3  
Old 03-05-2008, 11:40 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Very nice Dusty
__________________
Reply With Quote
  #4  
Old 03-06-2008, 12:46 AM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
I like it, its just too bad that it doesn't have a z axis to affect how long the shadow should be for things like the table.
__________________
Reply With Quote
  #5  
Old 03-06-2008, 12:49 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I thought about it, but that would be impossible because even though I can assign a z-axis to the light source, I wouldn't have a z-axis to compare it to when it comes to the tiles.
Reply With Quote
  #6  
Old 03-06-2008, 03:39 AM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
Very nice, I think I remember you (or someone else) working on something like this.
Reply With Quote
  #7  
Old 03-06-2008, 09:19 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Rapidwolve24 View Post
Very nice, I think I remember you (or someone else) working on something like this.
Yeah, Knight did :o
__________________
Reply With Quote
  #8  
Old 03-07-2008, 01:34 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
*Eyes are vaporized by the intensity of the light*
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.