Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   GraalOnline Era (https://www.graalians.com/forums/forumdisplay.php?f=13)
-   -   NPC light (https://www.graalians.com/forums/showthread.php?t=6492)

Dude1310 05-17-2012 12:12 AM

NPC light
 
How do i change a light npc to green?
Like if you use the premade light npc, what gs1 code do i add to this code to make that light be green?
PHP Code:

if (created) {
  
setimg light2.png;
  
dontblock;
}
//#CLIENTSIDE
if (playerenters) {
  
setcoloreffect 1,1,1,0.99;
  
drawaslight;



Beholder 05-17-2012 12:18 AM

setcoloreffect 1,1,1,0.99;

Red Green Blue Alpha

Want green? Take out Red and Blue.
0 1 0 0.99

Dude1310 05-17-2012 12:21 AM

Thanks so much! Is there a way to know the number code for the light colors? Also how do I make it red?

callimuc 05-17-2012 12:36 AM

How I do it:

since its in 'red, green, blue, alpha' I just open paint.net, draw the color i want and note the rgb in the script. Since it can only go up to 1 in the script I divide it by 255 (you can do the same with the alpha).

So it does look like (which won't work)
PHP Code:

seteffect 1981751580,5

in the beginning, and after dividing it (which will work)
PHP Code:

seteffect 198/255175/255158/2550,5


Not everyone will agree with that way but I think that's the easiest way to do it.

Skill 05-17-2012 01:01 AM

you're using gs1, I recommend gs2 if you plan to make it for a live server other than Graal Reborn.

PHP Code:

function onCreated() {  //gs2 uses event functions rather than if statements for being called on events
  
setimg("light2.png"); //parenthesis when using a function and quotes around specific(nonvariable) text detail like filenames.
  
dontblock();
}
//#CLIENTSIDE
function onPlayerEnters() {  //once again event functions rather than if statements
  
setcoloreffect(0,1,0,0.99); //first = red value, second green, third blue. 4th is alpha(transparency)
  
drawaslight();


Quote:

Posted by callimuc (Post 117469)
How I do it:

since its in 'red, green, blue, alpha' I just open paint.net, draw the color i want and note the rgb in the script. Since it can only go up to 1 in the script I divide it by 255 (you can do the same with the alpha).

So it does look like (which won't work)
PHP Code:

seteffect 1981751580,5

in the beginning, and after dividing it (which will work)
PHP Code:

seteffect 198/255175/255158/2550,5


Not everyone will agree with that way but I think that's the easiest way to do it.

if you do it that way divide it on a calculator beforehand. Its wasting resources calculating it. Sure it isn't much, but every little bit helps.


All times are GMT. The time now is 06:49 AM.

Powered by vBulletin/Copyright ©2000 - 2026, vBulletin Solutions Inc.