How to make one npc always be drawn on top of another.

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

How to make one npc always be drawn on top of another.

Post by Seamus Moore »

I have an npc in a script that has to walk over another npc. I gave the bottom npc the 'step on' effect, so the top npc can move onto it, but it is drawn underneath the npc that I want to be the bottom. how can I fix this?



also, one more thing; What is a good way to repeatedly trigger a script over and over again at consistent intervals of time?
Last edited by Seamus Moore on Sun Dec 13, 2020 7:18 pm, edited 1 time in total.
dQw4w9WgXcQ
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Controlling NPC sorting is tricky unfortunately
One trick is to move the upper NPC down one tile, but use "set NPC z(n, 20)" on it.

That makes the NPC always drawn on top because it is one tile lower, but it doesn't look one tile lower because of the "set NPC z"

Another trick is to create a slice in place of the NPC, move it, and then remove it

I know both of these methods are a pain. Maybe someone else has a better suggestion?

As for running a script at regular intervals, use the "set timer" command. At the end of the script, use "set timer" again to schedule the next interval
User avatar
Seamus Moore
Slime
Posts: 19
Joined: Mon Mar 16, 2020 9:39 pm
Location: Seamus Moore's House

Post by Seamus Moore »

Bob the Hamster wrote:Controlling NPC sorting is tricky unfortunately
One trick is to move the upper NPC down one tile, but use "set NPC z(n, 20)" on it.

That makes the NPC always drawn on top because it is one tile lower, but it doesn't look one tile lower because of the "set NPC z"

Another trick is to create a slice in place of the NPC, move it, and then remove it

I know both of these methods are a pain. Maybe someone else has a better suggestion?

As for running a script at regular intervals, use the "set timer" command. At the end of the script, use "set timer" again to schedule the next interval
that should work, thanks!
dQw4w9WgXcQ
Post Reply