I noticed in the dictionary that "wait for all" doesn't properly wait for all NPCs. After testing this I realized that this is still true so I attempted to make my own wait for all command but I'm having mass slow downs because the way I've coded it checks through all NPCs 0-300. Is there a simpler way to wait for all NPCs with less slowdown?
For the time being I've replaced all my "wait for all npcs" commands with "wait(1)" and this seems to be sufficient time to allow for all NPCs to reach their destinations. I fear that this method of coding will break depending on how many NPCs I have on the map though and could lead to further problems.
How to wait for all NPCs on map without slow down?
Moderators: marionline, SDHawk
- sheamkennedy
- Liquid Metal Slime
- Posts: 1110
- Joined: Mon Sep 16, 2013 9:29 pm
- Location: Tama-shi, Tokyo, Japan
- Contact:
How to wait for all NPCs on map without slow down?
Last edited by sheamkennedy on Fri Feb 23, 2018 6:54 am, edited 1 time in total.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
â� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
â� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
So, you want to wait for all NPCs but you don't want to use 'suspend npcs'? That's fair enough, if you want to do something like wait for all 'Chase' NPCs to reach the hero.'wait for all' wrote: if 'suspend npcs' is active, waits for all NPCs to stop walking
Looping through all 300 NPC references and checking whether they're moving won't cause a slowdown. Maybe the mistake you made was to loop through NPC IDs instead of NPC references, if you looped from 0 to 300 instead of from -1 to -300. That is a bit slower because for each NPC ID it needs to search for an NPC instance matching that ID. If you have 300 NPCs, that's roughly 300*300/2 = 45,000 steps. But that should definitely still not be enough to make the game run slower.
The best and most efficient way to loop through NPC instances is using the "next npc reference" command.
Edit:
After reading your other thread, I realise that what you want is this:
Code: Select all
resume npcs
wait(1) # Let NPCs start moving
suspend npcs
wait for all # Get the NPCs to stop
Last edited by TMC on Fri Feb 23, 2018 7:17 am, edited 4 times in total.
- sheamkennedy
- Liquid Metal Slime
- Posts: 1110
- Joined: Mon Sep 16, 2013 9:29 pm
- Location: Tama-shi, Tokyo, Japan
- Contact:
Thanks this seems to be working.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
â� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
â� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases