Npc Dmg and Npc scaling

Need help with any SMBX game-related issues? Ask your questions here.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on-topic/appropriate?
-Are you posting in the right forum/following the forum rules?
User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Npc Dmg and Npc scaling

Postby Cigarettes » Thu Nov 07, 2019 6:37 pm

Having a hard time try to figure out how to make my npc take no hits and be friendly... Is there a way? Can i increase npc size using smbx 1.3? I have made alot of sprites for this project so far but for remaining sprites i need to upscale them.

User avatar
LGLMAKING
Mega Mole
Mega Mole
Posts: 271
Joined: Mon Jun 18, 2018 7:28 am
Flair: B ready, MK7, Imma hack you soon!!!
Current Project: See 'Flair'

Re: Npc Dmg and Npc scaling

Postby LGLMAKING » Fri Nov 08, 2019 6:48 am

Cigarettes wrote:
Thu Nov 07, 2019 6:37 pm
Having a hard time try to figure out how to make my npc take no hits and be friendly... Is there a way? Can i increase npc size using smbx 1.3? I have made alot of sprites for this project so far but for remaining sprites i need to upscale them.
There is an option called "friendly". It makes npc's invulnerable and let's you use the message option. In fact, you can tie events to this. For your second question, you'll need custom graphics. Once you got those, check the dimensions of the image files. Pay attention to the size on the y-axis. Divide this number by the number of frames to get the graphicsheight. The graphicswidth can be read simply by clicking on the image in the same way you found the height of your gfx. Create a .txt document named after the npc you want to resprite (for example the name for the smb3 goomba used by SMBX is npc-1).

Write the following lines for the hitboxes and gfxsize:
gfxwidth=width of your sprites
gfxheight=well, you read how to calculate graphicsheight above, right?
width=width of your enemy's hitbox
height=height of your enemy's hitbox

Hope that helps
Collab leader of:
Image

I support
Image
Image

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 12:33 pm

LGLMAKING wrote:
Fri Nov 08, 2019 6:48 am
Cigarettes wrote:
Thu Nov 07, 2019 6:37 pm
Having a hard time try to figure out how to make my npc take no hits and be friendly... Is there a way? Can i increase npc size using smbx 1.3? I have made alot of sprites for this project so far but for remaining sprites i need to upscale them.
There is an option called "friendly". It makes npc's invulnerable and let's you use the message option. In fact, you can tie events to this. For your second question, you'll need custom graphics. Once you got those, check the dimensions of the image files. Pay attention to the size on the y-axis. Divide this number by the number of frames to get the graphicsheight. The graphicswidth can be read simply by clicking on the image in the same way you found the height of your gfx. Create a .txt document named after the npc you want to resprite (for example the name for the smb3 goomba used by SMBX is npc-1).

Write the following lines for the hitboxes and gfxsize:
gfxwidth=width of your sprites
gfxheight=well, you read how to calculate graphicsheight above, right?
width=width of your enemy's hitbox
height=height of your enemy's hitbox

Hope that helps
Very helpful but...
So Friendly npcs can still take dmg if you make them enemy npc...so enemy npcs can be set to friendly but you can still jump on them and kill them with turtle shells =( i replaced my koopas with my custom npcs works perfect but i can kill them when set to friendly =( i need to switch my koopas because i need that behavor for the npc .because i don't know how to create one from scratch. I don't know how to check dimensions and height other than right click properties and it will tell but i have no option to change it. If i make this text document how do i attach it to the image?

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Fri Nov 08, 2019 1:24 pm

friendly npcs are, by definition, immune to interaction from any other npc. you cannot jump on them or kill them. if you find yourself able to do so, maybe you didn't actually set them friendly or forgot to save the level & refresh the tester.

npc txt files are attached to the npc by the filename. the npc-1.txt file will apply to npc 1, which uses npc-1.png. to edit images, download an image editing software like gimp or paint.net.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 1:56 pm

Enjl wrote:
Fri Nov 08, 2019 1:24 pm
friendly npcs are, by definition, immune to interaction from any other npc. you cannot jump on them or kill them. if you find yourself able to do so, maybe you didn't actually set them friendly or forgot to save the level & refresh the tester.

npc txt files are attached to the npc by the filename. the npc-1.txt file will apply to npc 1, which uses npc-1.png. to edit images, download an image editing software like gimp or paint.net.
ok so if i have my image file set npc-1 gif....i can make a text doc with name put it the same folder and it will auto attach basiclly?

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Fri Nov 08, 2019 1:57 pm

yes
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 2:05 pm

Enjl wrote:
Fri Nov 08, 2019 1:57 pm
yes

Sounds good will the image auto stretch?

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Fri Nov 08, 2019 2:09 pm

Cigarettes wrote:
Fri Nov 08, 2019 2:05 pm
Enjl wrote:
Fri Nov 08, 2019 1:57 pm
yes

Sounds good will the image auto stretch?
No. The default renderer has no stretching capabilities. the gfxwidth/gfxheight properties merely tell smbx how much space to allocate for one frame of the image to draw from the spritesheet.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 2:17 pm

Enjl wrote:
Fri Nov 08, 2019 2:09 pm
Cigarettes wrote:
Fri Nov 08, 2019 2:05 pm
Enjl wrote:
Fri Nov 08, 2019 1:57 pm
yes

Sounds good will the image auto stretch?
No. The default renderer has no stretching capabilities. the gfxwidth/gfxheight properties merely tell smbx how much space to allocate for one frame of the image to draw from the spritesheet.
Ok so make the text doc first then make the npc gif got it you have been real helpful.

Added in 11 minutes 22 seconds:
Enjl wrote:
Fri Nov 08, 2019 2:09 pm
Cigarettes wrote:
Fri Nov 08, 2019 2:05 pm
Enjl wrote:
Fri Nov 08, 2019 1:57 pm
yes

Sounds good will the image auto stretch?
No. The default renderer has no stretching capabilities. the gfxwidth/gfxheight properties merely tell smbx how much space to allocate for one frame of the image to draw from the spritesheet.
One more question if i make the text doc do you need to put in every single code? or just the ones i need?

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Fri Nov 08, 2019 2:31 pm

Just the ones you need. I usually make the images first, because when I have the image done I know what to write into the txt files (dimensions, number of frames, etc). Either works, though.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 2:52 pm

LGLMAKING wrote:
Fri Nov 08, 2019 6:48 am
Cigarettes wrote:
Thu Nov 07, 2019 6:37 pm
Having a hard time try to figure out how to make my npc take no hits and be friendly... Is there a way? Can i increase npc size using smbx 1.3? I have made alot of sprites for this project so far but for remaining sprites i need to upscale them.
There is an option called "friendly". It makes npc's invulnerable and let's you use the message option. In fact, you can tie events to this. For your second question, you'll need custom graphics. Once you got those, check the dimensions of the image files. Pay attention to the size on the y-axis. Divide this number by the number of frames to get the graphicsheight. The graphicswidth can be read simply by clicking on the image in the same way you found the height of your gfx. Create a .txt document named after the npc you want to resprite (for example the name for the smb3 goomba used by SMBX is npc-1).

Write the following lines for the hitboxes and gfxsize:
gfxwidth=width of your sprites
gfxheight=well, you read how to calculate graphicsheight above, right?
width=width of your enemy's hitbox
height=height of your enemy's hitbox

Hope that helps
Where do i find out how many frames an npc uses? to get my Gfxheight?

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Fri Nov 08, 2019 3:04 pm

gfxheight is height of one frame. frames is number of frames per facing direction on the sprite sheet. that number depends on how you choose to arrange the sprite sheet. a goomba has 2 frames on framestyle 0, a koopa has 2 frames on framestyle 1, and a shy guy has 2 frames on framestyle 2.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Cigarettes
Koopa Troopa
Koopa Troopa
Posts: 21
Joined: Fri Oct 25, 2019 9:15 am
Chat Username: Cigs

Re: Npc Dmg and Npc scaling

Postby Cigarettes » Fri Nov 08, 2019 3:56 pm

ok so each picture in the the sprite sheet is a frame. so goombas have 2 frames and if i take the width of it and divide it by 2 i get my new height?

User avatar
Hoeloe
Grinder
Grinder
Posts: 1040
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Npc Dmg and Npc scaling

Postby Hoeloe » Fri Nov 08, 2019 8:38 pm

Not the width. Take the height of the entire image file and divide it by two to get the height of a single frame. Also you should be using .png files rather than .gif files if you're using SMBX2 (and I would strongly suggest using SMBX2 over 1.3).

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Sat Nov 09, 2019 1:59 am

To illustrate:
Image
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
LGLMAKING
Mega Mole
Mega Mole
Posts: 271
Joined: Mon Jun 18, 2018 7:28 am
Flair: B ready, MK7, Imma hack you soon!!!
Current Project: See 'Flair'

Re: Npc Dmg and Npc scaling

Postby LGLMAKING » Wed Nov 13, 2019 5:54 am

Oh yeah, there's a setting for your specified "friendliness". Simply use this npc code:

nohurt=1

and if you want to prevent the player from simply jumping on it combine that with this:

jumphurt=1

Note it doesn't work with spinjumps
Collab leader of:
Image

I support
Image
Image

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

Re: Npc Dmg and Npc scaling

Postby Enjl » Wed Nov 13, 2019 11:54 am

LGLMAKING wrote:
Wed Nov 13, 2019 5:54 am
Oh yeah, there's a setting for your specified "friendliness". Simply use this npc code:

nohurt=1

and if you want to prevent the player from simply jumping on it combine that with this:

jumphurt=1

Note it doesn't work with spinjumps
Does not simulate friendliness, enemies can still die to other enemies. Using a mix of nohurt=true jumphurt=true spinjumpsafe=false nogravity=true noblockcollision=true CAN be useful for making wacky intangible npcs for decoration, but that's far from the topic at hand and fairly cumbersome in general.
ImageImageImageImage
ImageImageImageImageImageImage


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 1 guest