[XP] Monster Event Deletion

Started by mad.array, March 13, 2013, 09:00:37 am

Previous topic - Next topic

mad.array

March 13, 2013, 09:00:37 am Last Edit: March 13, 2013, 04:37:32 pm by mad.array
Monster Event Deletion
Authors: mad.array
Version: 1.0
Type: Snippet
Key Term: Misc Add-on



Introduction

Just a little fix up for a common problem in RMXP. When you erase an event just after a battle, it always appears for a frame before being deleted. WELL NO MORE! With this script you can erase specific events during the battle scene and they will be gone as soon as the battle is over. Please note that you should still set a switch or something else to make sure they don't come back when you re-enter the map though!


Features


  • Monsters be-gone!

  • People be-gone!

  • Any event be-gone!

  • Simple Call Script command




Screenshots

How do you show an erased event?


Script

Insert somewhere above Main.
Spoiler: ShowHide

class Game_Temp
 
 attr_accessor :battle_ids
 
 alias init_battle_ids initialize
 def initialize
   init_battle_ids
   @battle_ids = []
 end
end

class Scene_Map
 
 alias call_battle_ids call_battle
 def call_battle
   call_battle_ids
   for i in 0...$game_temp.battle_ids.length
     $game_map.events[$game_temp.battle_ids[i]].erase
   end
   $game_temp.battle_ids = []
   $game_map.need_refresh = true
 end
 
end



Instructions

To use, simply set up a Call Script before your battle. Inside the script put:

$game_temp.battle_ids =[1,2,3]

Replacing the 1,2 & 3 with the event ids that need deleting. Again, make sure you still set up another, more permanent, method to make sure the event doesn't reappear.



Compatibility

I don't think there will be any compatability issues. Aliases call_battle from Scene_Map and Initialize from Game_Temp.


Credits and Thanks

I did it all by my self. Yaaaaay!


Author's Notes

Credit if you so wish, but it's 24 lines of code... several of which are blank. So feel free to just use it. Just don't claim it as your own!
"To walk at speed, manage or oversee..."

"RUN!"

KK20

I remember making it more interesting by playing a disappearing animation when the troop is defeated or, if you ran away, it would flash the event and stop its movement for a few seconds. Perhaps if you added features like that, this could be a helpful, and database-worthy, script.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20

But of course!

In its current state, it is not database-worthy :D

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

mad.array

I think I've fixed the header issue. I'm not sure what to add to the script. Perhaps automatically switching events to the 'down' pose instead of erasing the event? I know it's in one of the add-on packs so I might take a gander and see what I can see. Any other suggestions, let me know.
"To walk at speed, manage or oversee..."

"RUN!"

mad.array

Actually, I might combine this with some other actor/event related scripts to give devs a bit more control. Should I post a new topic or alter this one?
"To walk at speed, manage or oversee..."

"RUN!"

ThallionDarkshine

I could write an addon to this script using my transitions module to allow users to specify a disappearance animation for the events that would disappear with this script.

mad.array

I've been giving this some thought.As the whole point of the script is to make events disappear during the battle, rather than before or after, I'm going to forego the disappear animation/effect.

@ThallionDarkshine: The thought is still very much appreciated and if you want to add this feature then feel free.

I should also point out that this feature is included in the mad.array Mini Add-on pack. Could I request that this thread be closed? I won't be updating it and if there were any need for updates, I would put them on the add-on page. Thanks.
"To walk at speed, manage or oversee..."

"RUN!"