Page 1 of 1

[NPC Pack] SM3DW Ring Burner

Posted: Sun May 26, 2019 4:08 pm
by Emral
A product of procrastination, so why not share it?
Reference image:
Image

Image

A download link can be found here:
https://drive.google.com/file/d/1_RO1MG ... sp=sharing

NPC codes:
windup=80 (time before shooting a ring)
radius=128 (radius of the ring)
pulsespeed=2 (speed of the pulse)
pulsedrag=0.1 (speed reduction of the pulse as it reaches maximum radius)

The beam can be modified by adjusting the shader in ringburner.frag

Toggling the friendly flag toggles tangibility but not hostility. They turn darker if "friendly".

Installation instructions can be found in the handbook or in my thread.

Modifications and adaptations of the code is permitted. If you use this particular code as a basis for an enhanced version of these NPCs, please give credit.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Mon May 27, 2019 11:06 am
by Mushroom King
Another cool addition for the npcs. I guess it's not possible to make them shot a square plasma?

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 12:48 am
by IAmPlayer
Mushroom King wrote:
Mon May 27, 2019 11:06 am
Another cool addition for the npcs. I guess it's not possible to make them shot a square plasma?
You can, it's said that the beam is modifiable.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 2:48 am
by Mushroom King
Just like that? Well that's nice if it's as simple.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 5:19 am
by Emral
1AmPlayer wrote:
Tue May 28, 2019 12:48 am
Mushroom King wrote:
Mon May 27, 2019 11:06 am
Another cool addition for the npcs. I guess it's not possible to make them shot a square plasma?
You can, it's said that the beam is modifiable.
Stretching the definition of modifiable, sure. The NPC uses 3 circle colliders and the shader is configured to spawn a visual expanding ring. You'll need to modify the npc to use 4 box colliders and rewrite the shader in order to get a square.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 5:44 am
by KateBulka
Would be cool (and better imo) if you could change wind up, radius, pulse speed and pulse drag in PGE (Item proporties). Still pretty decent!

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 5:47 am
by Emral
Core wrote:
Tue May 28, 2019 5:44 am
Would be cool (and better imo) if you could change wind up, radius, pulse speed and pulse drag in PGE (Item proporties). Still pretty decent!
Not possible for NPC packs at the moment. I don't know if I agree about all of these because they can very easily break affordances that way.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 1:38 pm
by LGLMAKING
What's up with the gold ones?

Suggestion: add ground, wall and roof versions that either shoot beams in the direction the skull would be facing or sideways

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue May 28, 2019 2:09 pm
by Emral
LGLMAKING wrote:
Tue May 28, 2019 1:38 pm
What's up with the gold ones?
Spiky?
LGLMAKING wrote:
Tue May 28, 2019 1:38 pm
Suggestion: add ground, wall and roof versions that either shoot beams in the direction the skull would be facing or sideways
Entirely different code required. It'd be like comparing sideways banzai bills to background banzai bills. Hence, not a part of this pack. If I were to make something similar, it would be something more akin to electric bolts that move across walls and ceilings, since that's easier to parse as a player.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Wed May 29, 2019 9:07 am
by LGLMAKING
Enjl wrote:
Tue May 28, 2019 2:09 pm
LGLMAKING wrote:
Tue May 28, 2019 1:38 pm
What's up with the gold ones?
Spiky?
LGLMAKING wrote:
Tue May 28, 2019 1:38 pm
Suggestion: add ground, wall and roof versions that either shoot beams in the direction the skull would be facing or sideways
Entirely different code required. It'd be like comparing sideways banzai bills to background banzai bills. Hence, not a part of this pack. If I were to make something similar, it would be something more akin to electric bolts that move across walls and ceilings, since that's easier to parse as a player.
Ah OK thx

Re: [NPC Pack] SM3DW Ring Burner

Posted: Thu Feb 13, 2020 6:55 pm
by Enzo Ferracini
I'm in trouble
Image

Re: [NPC Pack] SM3DW Ring Burner

Posted: Sat Mar 21, 2020 9:42 pm
by ANueUtsuho
How would you change the color of the beam?

Re: [NPC Pack] SM3DW Ring Burner

Posted: Tue Mar 24, 2020 2:18 pm
by Emral
ANueUtsuho wrote:
Sat Mar 21, 2020 9:42 pm
How would you change the color of the beam?
The colour is generated based on distance on the ring using the shader (ringburner.frag).
Little breakdown: Here's the line that's important:
c.rgba = mix(vec4((0.9 + 0.1 * grad) * alpha,(0.7 + 0.3 * grad) * alpha,(0.3 + 0.4 * grad) * alpha,alpha), vec4(0,0,0,0), 1- and(gt(dist, radius-8), lt(dist, radius)));
Lot to unpack here. So first let's break up the "mix":
mix(a, b, c)
Mix selects between a and b based on where c is between 0 and 1.
So here this selects between a complicated vec4 (color) input, and the color "transparent" (0,0,0,0) based on the formula that comes after (comparing distance). The mix is basically what makes it look like a ring. The "a" argument is the important bit for us:
vec4((0.9 + 0.1 * grad) * alpha,(0.7 + 0.3 * grad) * alpha,(0.3 + 0.4 * grad) * alpha,alpha)
This is a vec4 (a color consisting of red, green, blue and alpha values). Lemme break down the variables:
"grad" is introduced in the line before and is the gradient you can see going outward from the center (from red to orange).
"alpha" is the fadeout over time and set from the lua file as a uniform.
So let's look at the individual components of the vec4 (r, g, b, a)
r: (0.9 + 0.1 * grad) * alpha - almost completely red starting out, gradually increasing to COMPLETELY red
g: (0.7 + 0.3 * grad) * alpha - a bit of green at the start, leading to a matched red and green at grad=1 (outer ring). So with red and green both that's yellow-ish
b: (0.3 + 0.4 * grad) * alpha - a lot less blue (going from 30% to 70%), adding some lightness and whiteness to it
a: alpha (just the input alpha)

By changing the numeric values you can get different colour results and different gradients. Think of grad=0 as the inner edge and grad=1 as the outer edge. So for black you would do rgb 0,0,0 for the inner edge, and then if you do rgb 0,0,1 for the multiplier for the outer edge you end up with blue.
You can also remove the righthandside of the + sign for each of these to remove the gradient entirely, since you will only have a flat numeric color value.

Hope this helps.

Re: [NPC Pack] SM3DW Ring Burner

Posted: Mon May 03, 2021 7:22 pm
by LuisPerssh
Can't make it work or won't bug when you play with 2 characters? :|

Re: [NPC Pack] SM3DW Ring Burner

Posted: Sun May 23, 2021 3:28 pm
by TheGameyFireBro105
I feel like it could be cool if you made ones for the floor, that can be held down by items and players.