[NPC Pack] SM3DW Ring Burner

Share and discuss custom LunaLua code and content packs for SMBX2.
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9025
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

Mushroom King
Monty Mole
Monty Mole
Posts: 144
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?

User avatar
1AmPlayer
Volcano Lotus
Volcano Lotus
Posts: 546
Joined: Sun May 21, 2017 3:36 am
Flair: I'm a hellspawn.
Pronouns: he/him
Contact:

Re: [NPC Pack] SM3DW Ring Burner

Postby 1AmPlayer » 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.
These banners don't lead you anywhere, but do whatever you want.
Image

Mushroom King
Monty Mole
Monty Mole
Posts: 144
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: 9025
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Core
Panser
Panser
Posts: 1055
Joined: Tue Apr 15, 2014 8:29 am
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!
Join NSMBX's official server! - https://discord.gg/RMYdYfX

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9025
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
LGLMAKING
Ripper II
Ripper II
Posts: 326
Joined: Mon Jun 18, 2018 7:28 am
Flair: There's always another secret.

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
"I am incredibly lucky I know you and im glad I gave you a chance to be a part of this" -Eri7
"I'm going to call these Janksqueaks from now on." -Clearman06
"IT IS A SKYTREE!!!" -Big K
Image
Image
Image
New producer of the Novaverse, after Eri7's departure from the community.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9025
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
LGLMAKING
Ripper II
Ripper II
Posts: 326
Joined: Mon Jun 18, 2018 7:28 am
Flair: There's always another secret.

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
"I am incredibly lucky I know you and im glad I gave you a chance to be a part of this" -Eri7
"I'm going to call these Janksqueaks from now on." -Clearman06
"IT IS A SKYTREE!!!" -Big K
Image
Image
Image
New producer of the Novaverse, after Eri7's departure from the community.

Enzo Ferracini
Cheep-Cheep
Cheep-Cheep
Posts: 10
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

User avatar
ANueUtsuho
Bob-Omb
Bob-Omb
Posts: 22
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: 9025
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests