Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Polygon cutout? (https://forums.graalonline.com/forums/showthread.php?t=134265473)

scriptless 12-31-2011 05:18 AM

Polygon cutout?
 
2 Attachment(s)
I know this is somewhere on the forums but I seem to not be able to find it after hours of searching. So I played with some scripts and tried to get a polygon to display around the whole screen with a cutout around the player.

This is what I came up with. Any suggestions why the top left part of my screen and part of the inner circle dont display right.. Im not 100% familiar with polygons yet.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}
function 
onTimeout() { 
  
temp.circle NULL;
  
temp.circle.add(0);
  
temp.circle.add(0);
  
temp.circle.add(screenwidth);
  
temp.circle.add(0);
  
temp.circle.add(screenwidth);
  
temp.circle.add(screenheight);
  
temp.circle.add(0);
  
temp.circle.add(screenheight);
  for ( 
temp.0temp.< ( pi); temp.+= ( pi 32);) { 
    
temp.circle.addplayer.5.5 costemp.a)); 
    
temp.circle.addplayer.5.5 sintemp.a));
  }
  
temp.circle.add(0);
  
temp.circle.add(0);
  if ( 
player.account == "bloodpet" ) {
    
showPoly1000temp.circle);
    
with(findimg(1000)) { red=green=blue=0; }
    
findimg(1000).alpha .8;
  }
  
  
setTimer(0.05); 


I am playing with making the lantern actually light up the level :( Also getting it completely black around player with a cutout I am trying to accomplish as well..

fowlplay4 12-31-2011 06:02 AM

It's probably easier to create a circle image with a square border then fill in the gaps with polygons.

scriptless 12-31-2011 06:17 AM

Not sure what you mean.. Black image with cutout of a circle stretched over screen? Couldnt that mess the circle up??

DustyPorViva 12-31-2011 06:22 AM

You need to add the first coordinates to the end as well.

scriptless 12-31-2011 06:28 AM

Thanks. That fixed it.. :)

How about for making the lights also show on the poly??

DustyPorViva 12-31-2011 06:47 AM

Quote:

Originally Posted by scriptless (Post 1680180)
Thanks. That fixed it.. :)

How about for making the lights also show on the poly??

You mean multiple lightsources? You're not going to be able to do it.

Also, none of my HD LttP graphics were up for grabs, like the bush, so could you please remove them?

scriptless 12-31-2011 06:54 AM

Quote:

Originally Posted by DustyPorViva (Post 1680181)
You mean multiple lightsources? You're not going to be able to do it.

Also, none of my HD LttP graphics were up for grabs, like the bush, so could you please remove them?

I know nothing of the graphics, just scripts. However, I passed your message along. And I am told they will be removed.

Well other then multiple light sources. How would I make multiple lanterns actually light up near there area.. I tried seteffect() and using a light with an alpha.. and that didn't improve visibility at all.. *shrugs*.. tried poly's too.

DustyPorViva 12-31-2011 06:56 AM

Quote:

Originally Posted by scriptless (Post 1680182)
I know nothing of the graphics, just scripts. However, I passed your message along. And I am told they will be removed.

Well other then multiple light sources. How would I make multiple lanterns actually light up near there area.. I tried seteffect() and using a light with an alpha.. and that didn't improve visibility at all.. *shrugs*.. tried poly's too.

You're gonna have a hard-ass time doing it, sorry. And by hard-ass time, I mean virtually impossible without excessive CPU usage.

scriptless 12-31-2011 06:57 AM

Quote:

Originally Posted by DustyPorViva (Post 1680183)
You're gonna have a hard-ass time doing it, sorry. And by hard-ass time, I mean virtually impossible without excessive CPU usage.

Figured. Is there any approach to at least making it visually pleasing? or do most cases it just looks like crap?

Would be neat to have image masking here.. :(



Also: were sorry for using your gfx without your permission. They are being removed. It wasn't realized they were not up for grabs.

DustyPorViva 12-31-2011 07:12 AM

Quote:

Originally Posted by scriptless (Post 1680184)
Figured. Is there any approach to at least making it visually pleasing? or do most cases it just looks like crap?

Would be neat to have image masking here.. :(

Nope :/ If it was possible it would have been done by now :( Only way I can suggest is to use a drawingpanel gui and fill it all white and draw black holes in it according to the screen and light sources. It's sort of like making a mask. Then draw this on the screen. Only problem is it's very cpu intensive, but v6 does drawingpanels a bit better, and you can alleviate the cpu usage by rendering the drawingpanel at like half resolution and then upscaling.



Quote:

Originally Posted by scriptless (Post 1680184)
Also: were sorry for using your gfx without your permission. They are being removed. It wasn't realized they were not up for grabs.

NP. Thanks for the cooperation.

scriptless 12-31-2011 07:15 AM

Are there any examples of drawingpanel? I am completely unfamiliar with it.

DustyPorViva 12-31-2011 07:21 AM

Quote:

Originally Posted by scriptless (Post 1680187)
Are there any examples of drawingpanel? I am completely unfamiliar with it.

http://wiki.graal.net/index.php/Crea...uiDrawingPanel

However in v6 you can do things like draw polygons and apply filters. If you check out my old server upload I posted in the playerworld section you might find the script in there I made using this technique:
http://i.imgur.com/GEwJM.png

As you can see there are cons. It's a gui, so it's going to be drawn over all in-game elements like showimgs, and it might try to steal focus since it's being drawn over the entire screen. Also, since you're coordinating level positions like players to gui positions, it tends to be a frame behind the player, which can look sort of bad.

scriptless 12-31-2011 07:25 AM

Quote:

Originally Posted by DustyPorViva (Post 1680188)
http://wiki.graal.net/index.php/Crea...uiDrawingPanel

However in v6 you can do things like draw polygons and apply filters.

I am using V6.. And I will more then likely be developing for V6 and dissabling features that cause problems in v5 or providing a v5 version.

Sadly, the wiki lacks hardcore information. Like you said about drawing poly's not even mentioned in the wiki for guidrawingpanel.. :(

scriptless 12-31-2011 07:31 AM

Quote:

Originally Posted by DustyPorViva (Post 1680188)
http://wiki.graal.net/index.php/Crea...uiDrawingPanel

However in v6 you can do things like draw polygons and apply filters. If you check out my old server upload I posted in the playerworld section you might find the script in there I made using this technique:
http://i.imgur.com/GEwJM.png

As you can see there are cons. It's a gui, so it's going to be drawn over all in-game elements like showimgs, and it might try to steal focus since it's being drawn over the entire screen. Also, since you're coordinating level positions like players to gui positions, it tends to be a frame behind the player, which can look sort of bad.

I saw that and was wondering where the script was because I was quite curious how you did it. It's kinda what i want to do but the light wouldnt completely cut out from the poly.. i would need to draw circles over those holes and apply a lesser darkness..

or.. apply lessed darkness where not cur out.. and then throw a slight darkness under it..

DustyPorViva 12-31-2011 07:33 AM

Quote:

Originally Posted by scriptless (Post 1680190)
I saw that and was wondering where the script was because I was quite curious how you did it. It's kinda what i want to do but the light wouldnt completely cut out from the poly.. i would need to draw circles over those holes and apply a lesser darkness..

or.. apply lessed darkness where not cur out.. and then throw a slight darkness under it..

The effect is made via drawing an image of a white circle over the black-filled drawingpanel. You can use softer images(excuse the low quality, I was trying a very low resolution):
http://i.imgur.com/lJg0n.png

scriptless 12-31-2011 07:36 AM

Quote:

Originally Posted by DustyPorViva (Post 1680191)
The effect is made via drawing an image of a white circle over the black-filled drawingpanel. You can use softer images(excuse the low quality, I was trying a very low resolution):
http://i.imgur.com/lJg0n.png

I also saw that example. So fill the surface black and draw a circle at the x/y of the source to light up.. your brigness fades into darkness.. im asumming you used a gfx for this?

and you apply an alpha of .99 or less and the whiter the color the brighter it is?

DustyPorViva 12-31-2011 07:40 AM

Quote:

Originally Posted by scriptless (Post 1680192)
I also saw that example. So fill the surface black and draw a circle at the x/y of the source to light up.. your brigness fades into darkness.. im asumming you used a gfx for this?

and you apply an alpha of .99 or less and the whiter the color the brighter it is?

1) Creative drawing panel with the size of screenwidth/quality,screenheight/quality
2) fill black
3) draw image for each light source(white circles, with transparency(semi-transparency for softer edges) by via screenx(posx,posy)*quality,screeny(posx,posy)*qual ity
4) render drawing panel at 0,0 and at the scale of quality

I haven't looked at the script in a long time though, so I could be making mistakes... but as for flexibility? You're kind of screwed. Last time I tried this it was either totally opaque, or 99% transparent. Those were the only levels of transparency it would allow.

Honestly, you'd be better off looking at the script yourself, as I'm working from memory here.

scriptless 12-31-2011 07:47 AM

Quote:

Originally Posted by DustyPorViva (Post 1680193)
1) Creative drawing panel with the size of screenwidth/quality,screenheight/quality
2) fill black
3) draw image for each light source(white circles, with transparency(semi-transparency for softer edges) by via screenx(posx,posy)*quality,screeny(posx,posy)*qual ity
4) render drawing panel at 0,0 and at the scale of quality

I haven't looked at the script in a long time though, so I could be making mistakes... but as for flexibility? You're kind of screwed. Last time I tried this it was either totally opaque, or 99% transparent. Those were the only levels of transparency it would allow.

Honestly, you'd be better off looking at the script yourself, as I'm working from memory here.

I will do some searching to see if I can find it I guess. I have idea's that might work.. but im not sure the math on it. What if I did seteffect() with this? I know the blackness would be darker. Not sure the math on that tho..

Or just making the center of the white space "softer" ?



EDIT:
Oh, I see what you mean. I have to make the darkness totally black. Hmm. I would need to play with the script to see what I can come up with.

Might this be what you speak of?
http://forums.graalonline.com/forums...t=DustyPorViva


All times are GMT +2. The time now is 02:13 AM.

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