Let's see whether I can understand what exactly it is you want...
If you only ever needed
one of NPC that's supposed to be surrounded by glows in each room, then having it set global vars that the glows follow along with would work just fine. So I guess you're saying that you want to be able to have as many as you like?
I would guess that since what you're after is basically
graphical in nature and not actually related to the
gameplay behavior, the "
easiest"
solution might be using Image Overlays all managed by the actual character. But I can't help you with that because I've never really understood them.
If you want to definitely use characters then..well, maybe you could have the "
glow"
characters read off their orientation (there's one in each of the 8 directions, make its orientation the same as the direction it's in) and from that calculate where the "
center"
of the glows should be (where the actual character would be if it hadn't moved). Then, if the character is still there, great! If not, scan the 3x3 block within which it could possibly have moved to for an instance of that entity to determine
where it moved to, and then have the glow move that way too. Just make sure that the glows have a processing order
after the central entity. The only problem then is that if two of this central entity are
ever standing next to each other and both move, the glows will behave pretty much chaotically and probably at least half will lose their "
target"
in favor of following the wrong guy, depending on the order in which the 3x3 block is processed.
Likely the only way to get truly, totally consistent behavior out of an implementation involving a bunch of characters is to do something like what I did for water barrel/oil barrel tracking in S A N D and Immolation, where you designate a "
first"
, "
second"
, "
third"
, and so on and give each entity its own individual copy of the script along with its own individual variables ("
centralguy1X"
, "
centralguy1Y"
; "
centralguy2X"
, etc.), and have the glows that are supposed to be associated with the entity read off the correctly-numbered variables. This
works and it becomes easy to copy up to the number of guys you put in a previous room and paste into the next one, and at least reasonably straightforward to add another, but it is admittedly kind of janky in nature and far less convenient than just plopping down a thing with a default script that always does what you want. The only thing this probably can't do is give some third entity the ability to generate arbitrarily many of the central guy/glow pairs, but it seems unlikely that any reasonable puzzle you could use that for couldn't be built in a way that doesn't require it.
____________________________
109th Skywatcher
Here are some links to Things!
Click here to view the secret text
[Last edited by Xindaris at 12-07-2018 08:32 PM]