Graal Forums  

Go Back   Graal Forums > Development Forums > Level Design
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-19-2011, 08:37 PM
water95 water95 is offline
Social Worker
Join Date: Aug 2008
Location: New Jersey
Posts: 95
water95 is an unknown quantity at this point
Need help with lights please.

So i'm making a level on the era tileset and I want to add lights to it but I have no idea how. I've asked a bunch of people and all they say is it's an NPC but I don't know what that means. So here is what I do. From my level editor I click Predefined NPCs. I then click on light and set all the numbers to Red:54, Green:31, Blue: 1, and alpha was automatically set to .99. Is their something i'm suppose to add to it and not just click lights. Please, I really need help.
Reply With Quote
  #2  
Old 07-19-2011, 09:17 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Drag and drop one of these into your level. You can edit the values of the red, green, blue and alpha on the right before dragging it in. Double click the light after being placed to edit its script.
Attached Thumbnails
Click image for larger version

Name:	helpgraal.PNG
Views:	180
Size:	96.1 KB
ID:	53185  
__________________
Reply With Quote
  #3  
Old 07-19-2011, 09:41 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
Something like this is generally preferable to the above as it's not using old Gscript. Note that it will only work online.

PHP Code:
function onCreated() {
  
this.dontBlock();
  
this.drawOverPlayer();
}

//#CLIENTSIDE
function onCreated() {
  if (
lighteffectsenabled) {
    
this.setColorEffect(0100.8); // red, green, blue, alpha
  
} else {
    
this.hide();
  }

Give it an image (usually light2.png or light3.png).
__________________

Last edited by cbk1994; 07-19-2011 at 10:01 PM..
Reply With Quote
  #4  
Old 07-19-2011, 09:47 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by cbk1994 View Post
Something like this is generally preferable to the above as it's not using old Gscript. Note that it will only work online.

PHP Code:
function onCreated() {
  
this.dontBlock();
}

//#CLIENTSIDE
function onCreated() {
  
this.dontBlock();
  
this.drawOverPlayer();
  
  if (
lighteffectsenabled) {
    
this.setColorEffect(0100.8); // red, green, blue, alpha
  
} else {
    
this.hide();
  }

Give it an image (usually light2.png or light3.png).
Ah sorry. Setting a bad example. The method above if far better than mine. I just thought that if I tried to explain this, he wouldn't know where to put it.
__________________
Reply With Quote
  #5  
Old 07-19-2011, 09:59 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by cbk1994 View Post
Something like this is generally preferable to the above as it's not using old Gscript. Note that it will only work online.

PHP Code:
function onCreated() {
  
this.dontBlock();
}

//#CLIENTSIDE
function onCreated() {
  
this.dontBlock();
  
this.drawOverPlayer();
  
  if (
lighteffectsenabled) {
    
this.setColorEffect(0100.8); // red, green, blue, alpha
  
} else {
    
this.hide();
  }

Give it an image (usually light2.png or light3.png).
Not really that important especially with it only being an example but just for the sake of giving others the idea, if you are using dontblock serverside you don't need to be using it clientside, the same would also apply with drawoverplayer and most of the variable setting functions as the data is synchronised.
In theory it's better to have all of these serverside in the event of it being a static (motionless for example) NPC such as a light, this way it's only the specific variables being sent to clients rather than the script itself, which involves less data transfer.
Reply With Quote
  #6  
Old 07-19-2011, 10:02 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
Quote:
Originally Posted by ffcmike View Post
Not really that important especially with it only being an example but just for the sake of giving others the idea, if you are using dontblock serverside you don't need to be using it clientside, the same would also apply with drawoverplayer and most of the variable setting functions as the data is synchronised.
In theory it's better to have all of these serverside in the event of it being a static (motionless for example) NPC such as a light, this way it's only the specific variables being sent to clients rather than the script itself, which involves less data transfer.
For some reason I thought that if dontBlock was set serverside it still blocked on clientside. I didn't even know drawOverPlayer existed serverside. Tested it, and you're right. Thanks for the tips .
__________________
Reply With Quote
  #7  
Old 07-19-2011, 10:32 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by cbk1994 View Post
For some reason I thought that if dontBlock was set serverside it still blocked on clientside. I didn't even know drawOverPlayer existed serverside. Tested it, and you're right. Thanks for the tips .
It's possible that with the update that was made several months ago to remove "empty" NPCs from serverside memory that these forms of synchronisation no longer work after the onCreated event.
Something else which also no longer appears to work serverside is showimg();.

On a related note, if you have lots of animated lights via timeout it would be better to use a class script, not so much because it improves usability but because then it is only the class which is required to be downloaded the one time, rather than each NPC script being downloaded as part of the level file.

For instance:

Class script -

PHP Code:

//#CLIENTSIDE
function onCreated(){
  if(
this.image == NULL){
    
this.image "light4.png";
  }

  
//red
  
if(this.attr[1] == NULL){
    
this.attr[1] = 1;
  }

  
//green
  
if(this.attr[2] == NULL){
    
this.attr[2] = 0.75;
  }

  
//blue
  
if(this.attr[3] == NULL){
    
this.attr[3] = 0.75;
  }

  
//alpha
  
if(this.attr[4] == NULL){
    
this.attr[4] = 0.5;
  }

  
//zoom
  
if(this.attr[5] == NULL){
    
this.zoom 2;
  }
  else{
    
this.zoom this.attr[5];
  }

  
this.setcoloreffect(this.attr[1], this.attr[2], this.attr[3], this.attr[4]);
  
this.boundary = {this.attr[4] - (this.attr[4] / 5), this.attr[4] + (this.attr[4] / 5)};
  
this.flickerchange this.attr[4] / 10;
  
this.onTimeout();
}

function 
onTimeout(){
  
this.alpha += this.flickerchange;
  if(
this.alpha in this.boundary){
    
this.flickerchange *= -1;
  }
  
this.setTimer(0.05);

NPC script:

PHP Code:
this.join("levelitem_light_flicker");

function 
onCreated(){

  
//custom light image
  
this.setimg("light2.png");

  
//custom alpha
  
this.attr[4] = 0.25;

  
//neutralise red to make the colour whiter
  
this.attr[1] = 0.75;


Last edited by ffcmike; 07-19-2011 at 10:50 PM..
Reply With Quote
  #8  
Old 07-19-2011, 10:43 PM
water95 water95 is offline
Social Worker
Join Date: Aug 2008
Location: New Jersey
Posts: 95
water95 is an unknown quantity at this point
I cliked the outlined person, and before i put him into my level I set the light preferences and when I put it down still no light, I don't know if i'm doing something wrong and the scripts cbk gave me i don't know how to add them correctly.
Reply With Quote
  #9  
Old 07-19-2011, 10:55 PM
water95 water95 is offline
Social Worker
Join Date: Aug 2008
Location: New Jersey
Posts: 95
water95 is an unknown quantity at this point
Ok, so I set the light preferences and dragged the little outlined man. And I also used light2.png and the light came out and turned red and all, but now how do I get rid of the ugly blackness around it?
Reply With Quote
  #10  
Old 07-19-2011, 11:11 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
Quote:
Originally Posted by water95 View Post
Ok, so I set the light preferences and dragged the little outlined man. And I also used light2.png and the light came out and turned red and all, but now how do I get rid of the ugly blackness around it?
Unless it's absolutely necessary for it to be in GS1, use this instead:

Quote:
Originally Posted by cbk1994 View Post
Something like this is generally preferable to the above as it's not using old Gscript. Note that it will only work online.

PHP Code:
function onCreated() {
  
this.dontBlock();
  
this.drawOverPlayer();
}

//#CLIENTSIDE
function onCreated() {
  if (
lighteffectsenabled) {
    
this.setColorEffect(0100.8); // red, green, blue, alpha
  
} else {
    
this.hide();
  }

Give it an image (usually light2.png or light3.png).
If you prefer to stick with GS1, the issue sounds like your alpha is set to 1. Try setting it to 0.9. If that doesn't fix it, post the script.
__________________
Reply With Quote
  #11  
Old 07-20-2011, 01:53 AM
water95 water95 is offline
Social Worker
Join Date: Aug 2008
Location: New Jersey
Posts: 95
water95 is an unknown quantity at this point
oh wow it worked! thank you so much
Reply With Quote
Reply


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 03:56 PM.


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