How to Swap Projectile Animation if Mod is Loaded

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
Ligmatism
Posts: 21
Joined: Sat Feb 03, 2018 1:15 pm

How to Swap Projectile Animation if Mod is Loaded

Post by Ligmatism »

I've been working on customized versions of the Freedoom beastiary for a while now, and I would like to implement a script that causes my Battle Slug projectile to use the Brutal Doom small explosion effect instead of the default animation, when loaded with Brutal Doom. This is the code I've been using so far:


Battle Slug code (DECORATE):

Code: Select all

ACTOR BattleSlug
{
  Tag "Battle Slug"
  Scale 1.5
  Health 900
  Radius 60
  Height 70
  Mass 1000
  Speed 8
  PainChance 80
  Monster
  +FLOORCLIP
  +BOSSDEATH
  SeeSound "slug/sight"
  PainSound "slug/pain"
  DeathSound "slug/death"
  ActiveSound "slug/active"
  Obituary "%o was fried by a Battle Slug"
  States
  {
  Spawn:
    SLUG AB 15 A_Look
    Loop
  See:
    SLUG AABBCCDDEEFF 4 A_Chase
    Loop
  Missile:
    SLUG G 20 A_FaceTarget
	TNT1 A 0 A_PlaySound("slug/attack")
    SLUG H 10 Bright A_FatAttack1("SlugBall")
    SLUG IG 5 A_FaceTarget
    SLUG H 10 Bright A_FatAttack2("SlugBall")
    SLUG IG 5 A_FaceTarget
    SLUG H 10 Bright A_FatAttack3("SlugBall")
    SLUG IG 5 A_FaceTarget
    Goto See
  Pain:
    SLUG J 3
    SLUG J 3 A_Pain
    Goto See
  Death:
    SLUG K 6
    SLUG L 6 A_Scream
    SLUG M 6 A_NoBlocking
    SLUG NOPQRS 6
    SLUG T -1 A_BossDeath
    Stop
  Raise:
    SLUG R 5
    SLUG QPONMLK 5
    Goto See
  }
//$Category Monsters
}

Projectile code (DECORATE):

Code: Select all

ACTOR SlugBall
{
  Scale 1.3
  Radius 6
  Height 8
  Speed 25
  Damage 15
  Projectile 
  +RANDOMIZE
  +ROCKETTRAIL
  RenderStyle Normal
  Damagetype Rocket
  Alpha 1
  SeeSound "slugball/shoot"
  DeathSound "slugball/explode"
  States
  {
  Spawn:
    SLOT AB 4 Bright
    Loop
  Death:
    SLEX B 8 Bright A_SpawnItem("SmallExplosionSpawner")
	TNT1 A 0 A_PlaySound("Explosion")
    SLEX C 6 Bright
    SLEX D 4 Bright
    Stop
  }
}
it works pretty well as it is now, yet instead of replacing the default explosion graphics, it shows both effects at once. This looks and sounds pretty ugly; here's a video showing it in action:
https://youtu.be/NJBAmDwm1qo
Any help is appreciated!
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1116
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: How to Swap Projectile Animation if Mod is Loaded

Post by Jekyll Grim Payne »

I think the important part (and where the issue is probably at) is that SmallExplosionSpawner. Post that code, please.
User avatar
Ligmatism
Posts: 21
Joined: Sat Feb 03, 2018 1:15 pm

Re: Re: How to Swap Projectile Animation if Mod is Loaded

Post by Ligmatism »

Here's the code for the small explosion spawner,

Code: Select all

Actor SmallExplosionSpawner: ExplosionSpawner
{
Speed 30
states
	{
	Spawn:
		TNT1 AAA 2 A_SpawnItem("SpawnedExplosionSmall")
		Stop
	}
}
and here, sequentially, is the code for the small explosion:

Code: Select all

Actor SpawnedExplosion
{
+NOCLIP
+NOGRAVITY
states
	{
	Spawn:
 TNT1 A 0
 TNT1 A 2 A_PlaySound("FAREXPL")
TNT1 A 0 A_CustomMissile ("HighExplosiveFlamesSmall", 0, 0, random (0, 360), 2, random (0, 90))
		Stop
	}
}
Both of which are included in Brutal Doom.

Return to “Scripting”