SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 02-18-2020   #1
Icezer
 
Icezer's Avatar
Default How do I avoid general slowdown with a colorized boss script?

Hey there, everyone. Recently I got an idea from playing as Eggpack to make a script just for fun that turns all the Eggman bosses (and their associated objects) monochrome, much like the Metal Sonic and Fang clones in the base game. Then I actually got the idea to refine this script to get it ready for a release.

All works as intended in the actual boss levels. However, in some non-boss levels such as Deep Sea Act 1 or Arid Canyon Act 2, the game chugs very badly. I have tried changing what objects get colorized with little to no luck, and I can confirm it only occurs when the script is added.


At the moment, the script checks if you are playing as Eggpack to colorize the bosses/boss objects. Maybe a way to make it map dependent exists, but I digress.

Whether it has to do with the amount of objects colorized or something else, help would be greatly appreciated at this point. Files can be attached in replies if necessary, as well.
__________________
That guy who likes King Dedede.
Icezer is offline   Reply With Quote
Old 02-18-2020   #2
Lach
nanananananananananananan a
Developer
 
Lach's Avatar
Default

My guess is perhaps that you are performing searches for these boss objects on a per-frame basis? I would recommend hooking a MobjSpawn function to the object types you wish to adjust; I don't think any of the vanilla bosses recolor themselves so you should be safe to set their color and colorization values upon spawn.
Lach is offline   Reply With Quote
Old 02-18-2020   #3
Icezer
 
Icezer's Avatar
Default

Quote:
Originally Posted by Lach View Post
My guess is perhaps that you are performing searches for these boss objects on a per-frame basis? I would recommend hooking a MobjSpawn function to the object types you wish to adjust; I don't think any of the vanilla bosses recolor themselves so you should be safe to set their color and colorization values upon spawn.

Just tried using MobjSpawn and everything works except the actual bosses. Trying to colorize them with MobjSpawn yields no changes, while something like MobjThinker works. However, when using MobjThinker in the script, the game lags like before.
EDIT: Tried using BossThinker instead of MobjThinker for the boss portion of the script and it works perfectly. Help has been appreciated since MobjSpawn did wonders for all the extra objects :)
__________________
That guy who likes King Dedede.

Last edited by Icezer; 02-19-2020 at 12:38 AM.
Icezer is offline   Reply With Quote
Old 02-19-2020   #4
Lach
nanananananananananananan a
Developer
 
Lach's Avatar
Default

Ah, you might not be aware that you can hook MobjThinkers to specific object types with the third argument to addHook—for instance:

Code:
addHook("MobjThinker", function(mo)
    print("Hello, I am a blue crawla!")
end, MT_BLUECRAWLA)
This will only call the function for blue crawlas in the level, rather than every thinking object in the level.
Lach is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:51 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.