Guest User

Untitled

a guest
Oct 19th, 2025
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. // Force Memao sprite rebuild when event changes page or image
  2. const _Memao_Game_Event_refresh = Game_Event.prototype.refresh;
  3. Game_Event.prototype.refresh = function() {
  4. _Memao_Game_Event_refresh.call(this);
  5.  
  6. const page = this.page();
  7. const image = page ? page.image : null;
  8. const name = image?.characterName || "";
  9. const isMemao = name.toLowerCase().endsWith("_$(memao)");
  10.  
  11. // --- Normal event: do nothing ---
  12. if (!isMemao) return;
  13.  
  14. // --- Handle Memao event logic ---
  15. if (!page || !image.characterName) {
  16. // empty page → hide sprite
  17. this.setTransparent(true);
  18. this._through = true;
  19.  
  20. // Find the sprite and visually hide it
  21. const scene = SceneManager._scene;
  22. if (scene && scene._spriteset) {
  23. const spriteset = scene._spriteset;
  24. for (const spr of spriteset._characterSprites || []) {
  25. if (spr && spr._character === this && spr instanceof Sprite_Memao) {
  26. spr.visible = false;
  27. }
  28. }
  29. }
  30. return;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment