destroy npc command

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

TMC wrote:Whoa, slow down. Lifting the 300 NPC limit won't be hard, just need to replace one simple file format with another. Could be less work than scripting an elaborate workaround like that (which is frequently the case. Wouldn't it be nice f users could implement their own features? :)
I'm not sure I follow you. How would I do this?
Spoonweaver wrote:if sounds like you'd be better off faking the map being continuous then you would faking hundreds of npcs.
With the fade taken out of doors it shouldn't be too hard.
Pokemon fakes 1 big map with a bunch of smaller ones seemlessly connected.
Explain this in more detail. Even if the doors didn't fade, the screen still wouldn't scroll. What was your plan?
Mogri wrote:Watch out for performance issues. It might not be as big an issue as it was in the day, but Scary Game 2's town map got a lot of lag when it was released.
I'm on a really old PC so I'll be the first to notice if there is a huge performance problem.
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Willy Elektrix wrote:I'm not sure I follow you. How would I do this?
I meant that it could be added in the next version, not necessarily by you.
Willy Elektrix wrote: Explain this in more detail. Even if the doors didn't fade, the screen still wouldn't scroll. What was your plan?
You would have to place the doors away from the edges of the maps, leaving at least half a screen's distance so that the camera keeps scrolling.
Mogri wrote:Watch out for performance issues. It might not be as big an issue as it was in the day, but Scary Game 2's town map got a lot of lag when it was released.
Things got far far faster when we moved from 16 bit QuickBasic to 32 bit FreeBASIC. I haven't tried it, but I think that 300 NPCs wouldn't be much of a problem now, even on hardware from 2000.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

How can I tell how many NPCs I have on a map other than counting them by hand?
Last edited by Willy Elektrix on Mon Aug 19, 2013 3:27 pm, edited 1 time in total.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Willy Elektrix wrote:How can I tell how many NPCs I have on a map other than counting them by hand?
If you want to count all copies of all NPCs on the map, there are two ways to do it.

Code: Select all

plotscript, count NPCs by ID, begin
  variable(ID, total)
  for(ID, 0, 500) do(
    total += NPC copy count(ID)
  )
  show value(total)
end

plotscript, count NPCs by reference, begin
  variable(ref, total)
  for(ref, -1, -300, -1) do(
    if(get NPC ID(ref) >= 0) then(
      total += 1
    )
  )
end
I don't have any recommendations about which of those two methods to use-- they should both work equally well. I just provided both of them because it might be helpful for understanding how NPC ID numbers and NPC references work

One thing to remember about both of these methods is that they will only count currently visible NPCs. If an NPC is hidden by a tag, or is an already-used one-time-use NPC then it will not be included in the count.
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Oh, actually raising the NPC limit isn't as straightforward as I thought, as evidenced by the second script that James posted. I wrote some thoughts about that on the wiki.

Anyway, to provide an alternative answer to Willy's question, which was aimed at the map editor, I think the easiest way to accurately check the number of NPCs is actually to use the in-game NPC debugger (Ctrl+F11). It will show the reference number of each NPC on the map. So look at the reference number the last NPC that you placed in the map editor. Note that NPCs created with "create npc" get assigned reference numbers going from -300 (displayed as 300) up (down), while ones places in Custom go from -1 down (up). And that if you remove an NPC there will be a gap in the numbers.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Thanks for your answers, both of you. I use a lot of NPCs that are disabled by tags so I think I will end up using TMCs method more.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Another question. Is there an easy way to dump of all my text boxes to a text file? The reason I ask is because it would be much easier for me to proofread and edit them this way. However, I do not need to import them back into OHR.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Willy Elektrix wrote:Another question. Is there an easy way to dump of all my text boxes to a text file? The reason I ask is because it would be much easier for me to proofread and edit them this way. However, I do not need to import them back into OHR.
I am pleased to say, this is indeed possible, and rather easy! Just look in the text box editor for "Export text boxes"
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Tell me if this is possible. I want to write an on-step script that reads what zone the PC is currently in and then randomly displays thematic text boxes based on this zone.

I'm pretty sure it could be done and I think I can figure out how. However, I'm not at a good point in development to begin experimenting with it. So for now I just want to make sure it is possible.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

it's very possible.
User avatar
BMR
Metal King Slime
Posts: 3310
Joined: Mon Feb 27, 2012 2:46 pm
Location: The Philippines
Contact:

Post by BMR »

Not only very possible, I think it would be pretty easy to implement.
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Post Reply