Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   no idea how to do this (https://forums.graalonline.com/forums/showthread.php?t=80339)

Frankie 07-01-2008 11:45 PM

no idea how to do this
 
I've seen a lot of maze events where your screen is black, but you have the little circle around your character in which you can see. I want to get this effect, but have no idea how.

This is probably considered asking for scripts, but meh, I don't have a clue.

Chompy 07-02-2008 12:11 AM

Well, you could make a huge ass image :]

Just remember to compress it tho

DustyPorViva 07-02-2008 12:21 AM

You script polygons. It's actually fairly simple :)
You script a polygon circle around the player, then 'inverse' it by scripting in a polygon(in the same array!) rectangle the size of the screen.

Frankie 07-02-2008 12:42 AM

I've never really touched the showpoly function (assuming that's what is to be used here?) except for 1 time and I couldn't figure out how to do it z.z

Tigairius 07-02-2008 01:27 AM

1 Attachment(s)
PHP Code:

showpoly(index, {x1y1x2y2x3y3x4y4etc}); 

I guess I should probably explain that a bit better.

PHP Code:

showpoly(index, {startxstartywidthxwidthyheightxheightystartxstarty}); 

In theory, that would create a perfect rectangle.

So, lets say we want to draw a poly across the upper half of the screen:
PHP Code:

showpoly(200, {00screenwidth0screenwidthscreenheight 320screenheight 32}); 

The first two: 0, 0 are declaring the poly should start at 0, 0 of the screen
Second two: screenwidth, 0 are saying that the next point of the poly should be at the edge of the players horizontal screen, and 0 (at the top of the screen). At this point we have a white line that goes across the very top of the entire screen.
Third two: screenwidth, screenheight / 2 - 32 are declaring that the next drawing point should be at the right edge of the screen at the bottom right of half of the screen. Now we have a triangle, so we'll add
Fourth two: 0, screenheight / 2 - 32 which tells the next line to draw to the far left of the screen, and half way down.

It doesn't require a fifth one because it automatically closes it back up by connecting the last one to the starting point.

There's also a showpoly2() which has a format like this:

PHP Code:

showpoly2(index, {x1y1z1x2y2z2x3y3z3x4y4z4etc}); 

If you want an actual circle around the screen it would probably be easier for you to just use an image and stretch it across the screen.

For example, you could use the image below and possibly do something like:
PHP Code:

with (findimg(200)) {
  
image "example.gif";
  
x0;
  
stretchx screenwidth;
  
stretchy screenheight 32;



DustyPorViva 07-02-2008 01:38 AM

The problem with an image is that customizing is pretty much thrown out the window. Not to mention stretching it would mean varying degrees of visibility, depending on how large the screen is.

Tigairius 07-02-2008 01:44 AM

Quote:

Originally Posted by DustyPorViva (Post 1400451)
mean varying degrees of visibility

Oh good point, didn't even think of that. Well if it's absolutely necessary to do a circle you could do what Dusty suggested, it's just a bit complicated.

DustyPorViva 07-02-2008 01:55 AM

Well I suppose it is possible to do with an image, by resizing it... but in the end he'd still have to script polygons around the image. I think that's more complicated than scripting a circle.

Tigairius 07-02-2008 02:04 AM

Quote:

Originally Posted by DustyPorViva (Post 1400454)
Well I suppose it is possible to do with an image, by resizing it... but in the end he'd still have to script polygons around the image. I think that's more complicated than scripting a circle.

Probably, yeah.

Galdor 07-02-2008 05:12 PM

you add a lot of black light effects (not just randomly places out tho) that fades away the closer you get.

projectigi 07-02-2008 11:22 PM

uh cant you just seteffect() the screen and show a layer 3 "light"? O_o

Tigairius 07-02-2008 11:24 PM

Quote:

Originally Posted by projectigi (Post 1400574)
uh cant you just seteffect() the screen and show a layer 3 "light"? O_o

That doesn't really give the same effect.

DustyPorViva 07-02-2008 11:32 PM

Ya, when you do something like that, the light doesn't 'erase' the black. So if you have pure black, you won't actually see anything but a light.

zokemon 07-04-2008 12:37 AM

I just opened light4.png or w/e in paint and inverted it. Then I took that inverted image, stuck it in the middle of the screen and drew a black polygon around it.

Also, make the polygon depend on the image's size in case the image hasn't loaded or for whatever reason. (Use getimgwidth(), etc)

cbk1994 07-04-2008 04:48 AM

One thing to be careful about: If the player goes into capture mode (ALT + 6 or whatever) this disappears with the right options selected.

zokemon 07-04-2008 06:37 AM

Quote:

Originally Posted by cbk1994 (Post 1400764)
One thing to be careful about: If the player goes into capture mode (ALT + 6 or whatever) this disappears with the right options selected.

Why would polygons be disabled with capture mode?

cbk1994 07-04-2008 06:44 AM

Quote:

Originally Posted by zokemon (Post 1400780)
Why would polygons be disabled with capture mode?

They are shown on the screen layer (4+), which is removed if you have "hide the interface while capturing".

zokemon 07-04-2008 11:29 AM

Quote:

Originally Posted by cbk1994 (Post 1400782)
They are shown on the screen layer (4+), which is removed if you have "hide the interface while capturing".

Why would you show it on layer 4? That's just stupid.

DustyPorViva 07-04-2008 03:01 PM

Quote:

Originally Posted by zokemon (Post 1400795)
Why would you show it on layer 4? That's just stupid.

Not entirely. It really depends on what you're doing. Drawing it on layer 3 may cause drawing issues, depending on what kind of images you're showing in the level and such.

cbk1994 07-04-2008 06:09 PM

Quote:

Originally Posted by zokemon (Post 1400795)
Why would you show it on layer 4? That's just stupid.

... so it doesn't lag behind as you move? Unless I'm missing the entire point ...

cbk1994 07-04-2008 06:16 PM

You said "attachtoowner" then you deleted your post .. in any case, this is how GK does it, so I just wanted to warn people ...

Go to the GK staff they are doing it wrong.

Chompy 07-04-2008 08:30 PM

Quote:

Originally Posted by cbk1994 (Post 1400848)
... so it doesn't lag behind as you move? Unless I'm missing the entire point ...

Lag behind? What are you talking about? o.o;;

I did an effect just like this some time ago with a 2400x2400 png compressed down to 71KB (Aeko made that png) and I just did something like this..

PHP Code:

with(findimg(200)) {
  
image "aeko-darkness.png";
  
player.2400/32 1;
  
player.2400/32 1;
  
layer 3;



Galdor 07-04-2008 08:50 PM

And the battle of the nerds continues! meanwhile you can just try my idea, sure it might be a little complicated to pull off, but I think it will work just fine and will also look very flashy.

DustyPorViva 07-04-2008 09:20 PM

Quote:

Originally Posted by Galdor (Post 1400867)
And the battle of the nerds continues! meanwhile you can just try my idea, sure it might be a little complicated to pull off, but I think it will work just fine and will also look very flashy.

Way too much work for an effect he's not even looking for. Polygons aren't that complicated once you get the hang of it, and it would pay for him to just learn them anyways. They're really handy.

Galdor 07-04-2008 11:52 PM

Quote:

Originally Posted by DustyPorViva (Post 1400871)
Way too much work for an effect he's not even looking for. Polygons aren't that complicated once you get the hang of it, and it would pay for him to just learn them anyways. They're really handy.

Yes Dusty polygons are all fine but... I imagine that being very unimpressive looking.
Just like the black and white picture suggestion, but if you used something that looks like "light2.png" it would have been cooler looking as it has a nifty fade into it.

I'm guessing the thing I suggested would look very similar to the darkness effect in four sword adventures, and that darkness looks awesome.

DustyPorViva 07-04-2008 11:59 PM

In order to do anything that looks smooth it would take a huge amount of effects.

Rufus 07-05-2008 12:28 AM

Quote:

Originally Posted by Galdor (Post 1400887)
Yes Dusty polygons are all fine but... I imagine that being very unimpressive looking.
Just like the black and white picture suggestion, but if you used something that looks like "light2.png" it would have been cooler looking as it has a nifty fade into it.

I'm guessing the thing I suggested would look very similar to the darkness effect in four sword adventures, and that darkness looks awesome.

You can still get the same effect you're talking about by using polygons and images :D

http://i284.photobucket.com/albums/l...ic_lights2.png

Galdor 07-05-2008 12:42 AM

Quote:

Originally Posted by Rufus (Post 1400895)
You can still get the same effect you're talking about by using polygons and images :D

http://i284.photobucket.com/albums/l...ic_lights2.png

Hmm I guess that looks fancy :)


All times are GMT +2. The time now is 10:27 AM.

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