Modify A_BrainExplode/A_BrainScream?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Modify A_BrainExplode/A_BrainScream?

Post by Jekyll Grim Payne »

I'd like to use custom explosions but can't figure out a way to do so. I guess in a way A_SpawnItemEx could work, but I'm not sure what the position parameters should be, because the BossBrain actos is positioned at different angles in different versions of Icon of Sin (e.g. in Doom 2 it's facing 90 degrees away from the face wall, while in Plutonia they're facing the same direction, and in Evilution it's again 90 degrees, but in different direction).
Any advice would be appreciated.
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

Re: Modify A_BrainExplode/A_BrainScream?

Post by Mikk- »

The only way I could think would be to replace the BossBrain and its functions using ZScript. You could rewrite your own A_BrainScream, BrainishExplosion and A_BrainExplode - take a look at gzdoom.pk3's zscript/doom/bossbrain.txt
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Modify A_BrainExplode/A_BrainScream?

Post by Jekyll Grim Payne »

Mikk- wrote:The only way I could think would be to replace the BossBrain and its functions using ZScript. You could rewrite your own A_BrainScream, BrainishExplosion and A_BrainExplode - take a look at gzdoom.pk3's zscript/doom/bossbrain.txt
I assumed so, but frankly I can't figure out what to change there. Zscript is still too confusing for me.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Modify A_BrainExplode/A_BrainScream?

Post by Apeirogon »

Mikk- wrote:replace the BossBrain and its functions using ZScript
Functions cant be replaced. Only way, change it in gzdoom.pk3
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Modify A_BrainExplode/A_BrainScream?

Post by Jekyll Grim Payne »

Apeirogon wrote:
Mikk- wrote:replace the BossBrain and its functions using ZScript
Functions cant be replaced. Only way, change it in gzdoom.pk3
Um, surely I can (could, if I knew the script better) write my own version of the function, then replace BossBrain and make it use that new function?

Code: Select all

	private static void BrainishExplosion(vector3 pos)
	{
		Actor boom = Actor.Spawn("Rocket", pos, NO_REPLACE);
		if (boom)
		{
			boom.DeathSound = "misc/brainexplode";
			boom.Vel.z = random[BrainScream](0, 255)/128.;

			boom.SetStateLabel ("Brainexplode");
			boom.bRocketTrail = false;
			boom.SetDamage(0);	// disables collision detection which is not wanted here
			boom.tics -= random[BrainScream](0, 7);
			if (boom.tics < 1) boom.tics = 1;
		}
	}
This part of extend class Actor should control which actor is used as the base for the explosion. However, I don't really understand how this extend thing works, or what does "boom" mean here, and how I should modify it to just spawn something like a simple NOINTERACTION explosion actor.
Blue Shadow
Posts: 5038
Joined: Sun Nov 14, 2010 12:59 am

Re: Modify A_BrainExplode/A_BrainScream?

Post by Blue Shadow »

Jekyll Grim Payne wrote:or what does "boom" mean here
boom is a pointer to the rocket which was spawned by the function. This pointer gives you access to that rocket actor to do whatever you want with it, like changing its variables, making it call functions on itself, and so on.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Modify A_BrainExplode/A_BrainScream?

Post by Jekyll Grim Payne »

Blue Shadow wrote:
Jekyll Grim Payne wrote:or what does "boom" mean here
boom is a pointer to the rocket which was spawned by the function. This pointer gives you access to that rocket actor to do whatever you want with it, like changing its variables, making it call functions on itself, and so on.
So, how can I replace just this part of A_BrainExplode so that it spawns a different object?
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Modify A_BrainExplode/A_BrainScream?

Post by Apeirogon »

"Boom" is means "spawn original doom rocket, which cant be replaced like 'new rocket:rocket replace rocket' ".

"boom.%_something_%" means "rocket part of a code with name %_something_%"

Like

Code: Select all

boom.DeathSound = "misc/brainexplode";
Means "rocket death sound eqaul, change to, misc/brainexplode, sound what you hear when romero head leave this better of the worlds"

Code: Select all

boom.bRocketTrail = false;
means "disable rocket trail for this rocket, more preciesly remove rockettreail flag"

Other lines means same as write after dot. Experiment with that, but if you want replace something provide something for replacing, since when engine reading zscript code and if they dong found thing for replace, it count it as critical error and refuses load furter.

Return to “Scripting”