[NPC Pack] SM3DW Ring Burner

Share and discuss custom LunaLua code and content packs for SMBX2.
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

[NPC Pack] SM3DW Ring Burner

Postby Enjl » Sun May 26, 2019 4:08 pm

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.

Mushroom King
Tweeter
Tweeter
Posts: 167
Joined: Sun May 25, 2014 5:09 am

Re: [NPC Pack] SM3DW Ring Burner

Postby Mushroom King » 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?

IAmPlayer
Volcano Lotus
Volcano Lotus
Posts: 559
Joined: Sun May 21, 2017 3:36 am
Flair: I'm a hellspawn.
Pronouns: he/him
Contact:

Re: [NPC Pack] SM3DW Ring Burner

Postby IAmPlayer » 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.

Mushroom King
Tweeter
Tweeter
Posts: 167
Joined: Sun May 25, 2014 5:09 am

Re: [NPC Pack] SM3DW Ring Burner

Postby Mushroom King » Tue May 28, 2019 2:48 am

Just like that? Well that's nice if it's as simple.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: [NPC Pack] SM3DW Ring Burner

Postby Enjl » Tue May 28, 2019 5:19 am

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.

Core
Fuzzy
Fuzzy
Posts: 1110
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

Re: [NPC Pack] SM3DW Ring Burner

Postby Core » 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!

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: [NPC Pack] SM3DW Ring Burner

Postby Enjl » Tue May 28, 2019 5:47 am

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.

LGLMAKING
Ripper II
Ripper II
Posts: 340
Joined: Mon Jun 18, 2018 7:28 am
Flair: H E X
Pronouns: ask for pronouns

Re: [NPC Pack] SM3DW Ring Burner

Postby LGLMAKING » Tue May 28, 2019 1:38 pm

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

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: [NPC Pack] SM3DW Ring Burner

Postby Enjl » 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.

LGLMAKING
Ripper II
Ripper II
Posts: 340
Joined: Mon Jun 18, 2018 7:28 am
Flair: H E X
Pronouns: ask for pronouns

Re: [NPC Pack] SM3DW Ring Burner

Postby LGLMAKING » Wed May 29, 2019 9:07 am

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

Enzo Ferracini
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Fri Mar 22, 2019 12:05 pm
Flair: no

Re: [NPC Pack] SM3DW Ring Burner

Postby Enzo Ferracini » Thu Feb 13, 2020 6:55 pm

I'm in trouble
Image

ANueUtsuho
Spiny
Spiny
Posts: 25
Joined: Sun May 04, 2014 1:13 am

Re: [NPC Pack] SM3DW Ring Burner

Postby ANueUtsuho » Sat Mar 21, 2020 9:42 pm

How would you change the color of the beam?

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: [NPC Pack] SM3DW Ring Burner

Postby Enjl » Tue Mar 24, 2020 2:18 pm

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.

LuisPerssh
Goomba
Goomba
Posts: 1
Joined: Mon May 03, 2021 6:43 pm
Pronouns: PerSSy

Re: [NPC Pack] SM3DW Ring Burner

Postby LuisPerssh » Mon May 03, 2021 7:22 pm

Can't make it work or won't bug when you play with 2 characters? :|
Last edited by LuisPerssh on Mon May 03, 2021 7:25 pm, edited 1 time in total.

TheGameyFireBro105
Eerie
Eerie
Posts: 702
Joined: Thu Jan 09, 2020 6:09 pm
Flair: Good at remakes
Pronouns: he/him

Re: [NPC Pack] SM3DW Ring Burner

Postby TheGameyFireBro105 » Sun May 23, 2021 3:28 pm

I feel like it could be cool if you made ones for the floor, that can be held down by items and players.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest