Toggle for Making NCPs Solid

darkhog

New member
Yeah, my player going through NPCs like he's a friggin ghost really bothers me. Maybe allow overlap just enough so textboxes can function, but not more.
 

RadJunk

Administrator
Staff member
It doesn't quite work like that. There are MANY ways to make NPC objects. This is just one way, shown in the tutorials. Adding a "checkbox" doesn't do anything inherently. That would just allow us to write a bit. But what should that bit do? If the object became solid, it would then never be colliding. Then it could never see a collision, and could never register to show the NPC text. So that wouldn't work.

So one could, upon collision detection, do a check for a LARGER area than the collision data, but then you'd have to only use that data if it's an NPC type (otherwise monsters would register a collision using that data), which would be a LOT of wasted ROM space just to track that special case, and a lot of extra cycles, which would make the game slow down faster to do all those checks (welcome to NES).

You could include in collision with NPCs a routine that sets the player speed to 0 and player acceleration to 0, however you'd also have to set the npc's speed and acceleration to zero, and set them both to the previous position...but again, then you have that problem of them not actually colliding in order to enact the NPC dialog. So you could have a bit flip after collision for a handful of seconds that would be active and let the game know npc dialog is to happen, but then you'd have to also keep track of the last object you ran into, so you'd also need a variable for that.

You could use the object's melee - space to actually do the collision check for NPC rather than the object itself, since that space is already calculated and is tied to facing direction...essentially, when you *hit an NPC with a melee*, rather than hurting him, it does the NPC, and then you can use the above solution to make them solid...you'd also have to probably set it so an NPC changed direction during that step so that they don't get *stuck together*.

These are just some ideas. There are literally a thousand others. Just like there are a thousand other ideas for the HUD, or movement scripts, or collision scripts, or powerups, or weapon usage...etc etc etc. Game by game, the solutions and best way to handle these things will be different. These modules are just a starting point, and intentionally so. As time goes on, more and more ideas will be exposed on how to do things, by us, by other users, here on the forums...

If you guys are 1 day into NES development, and already have working NPCs that give you selected messages...just understand you've just gone through lightspeed to get to this point. Haha
 

stevenshepherd

New member
Mystic uses the strat of using the melee weapon right (based on my memory or the Origins demo)? I am making an rpg, thus no melee, so i am thinking that i could use this melee strategy but just have the melee weapon invisible and with no character animation. Not sure if that makes sense though.
 

RadJunk

Administrator
Staff member
You got it. And we’ll show that trick a bit more when we show rpg module eventually. But if you’re strong in the ways of the code, you could save a copy of the handleobjectcollisions script to your user scripts folder, set your module to point to it, and make some small edits to check if the player weapon is colliding with the npc rather than the player when you hit b. ;-)
 

stevenshepherd

New member
Cool! My strategy so far has been to not hit my head against the wall trying to make nesmaker do things it cant yet, only for it to be fixed or added in updates. Before mucking with code too much, there are a lot things to still do like tiles, sprites, etc :)
 

Orkzilla

New member
I have a (potentially dumb) idea. Would it be possible to just create a solid background tile and place your NPC on/in front of it? Obviously it would only work for a static NPC, but it would be a really simple solution for the issue. You could have your regular grass block tile asset that's walkable, then just have an exact copy of that asset that's solid. I'm not able to test it in my game right now or else I would.
 

dale_coop

Moderator
Staff member
It could work yes, just be sure that your player make to collision with the npc.
- Making your npc (& his collision box) bigger then your solid tile...
- or maybe with the player weapon (invisible) should work too.
 
I actually did the "solid grass thing" to make my npc that does Not move seem solid, there is one problem I noticed with it. I had to stretch out the npc's bounding box a little outside of the 16x16 box that it stands in, and I could only stretch that bounding box down and right(if theres a way to stretch it left and up outside the box I'd like to know), so facing the npc left and up I could Not interact with it.
 

mouse spirit

Well-known member
Does anyone know a good way to make a monster solid?I would want to do it so i can make "blocks"appear when the area is triggered.those blocks would be solid monsters that dont move so i can now get to a different path in a previous area.i would use tiles but tiles dont seem to be changable in triggered areas unless im missing something.
 
Top Bottom