Post new topic    
Metal King Slime
Send private message
Each Step script for NPCs? 
 PostMon May 13, 2013 6:05 pm
Send private message Reply with quote
So I was twiddling around with some scripts, and thought how useful it would be to be able to set an On Each Step script for NPCs the way you can for heroes. Then I thought to myself, "Hold on, BMR, that's madness! With the number of NPCs a map can have running around, and the script firing each step, the game would soon crawl to a halt!" So the question then is, what's a good alternative? Using timers? Perhaps scripting my own algorithm to move npcs around?

It's a purely theoretical question, as I'm not really tying to accomplish anything at the moment. Just wondering if it's possible/feasible to code.

Anyways, it's 2 in the morning, and I have to get up early tomor...err...later. Cheers!
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
Slime Knight
Send private message
Re: Each Step script for NPCs? 
 PostMon May 13, 2013 6:23 pm
Send private message Reply with quote
BMR wrote:
So I was twiddling around with some scripts, and thought how useful it would be to be able to set an On Each Step script for NPCs the way you can for heroes. Then I thought to myself, "Hold on, BMR, that's madness! With the number of NPCs a map can have running around, and the script firing each step, the game would soon crawl to a halt!" So the question then is, what's a good alternative? Using timers? Perhaps scripting my own algorithm to move npcs around?

That sounds like a great idea! The game won't slow to a crawl unless all the NPCs have such a script. So if it is used wisely, it shouldn't impact the game's performance.

I can see this being used for lots of interesting things. Although, I believe you can script a Zone to run a script when stepped on, this might be better for some things where you only want to see if an NPC steps on a specific section of the map.
Liquid Metal King Slime
Send private message
 
 PostMon May 13, 2013 7:04 pm
Send private message Reply with quote
Yes, an each-step for NPCs is actually something we have been planning. I think it was on hold waiting for another feature, but I admit I don't remember what that was. :)

Calling an each step for every NPC on a map with many NPCs could result in a tiny bit of slowdown, but I don't think it would be any worse than if you accomplished the same thing with while loops or timers.
Display posts from previous: