How to destroy projectile?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

How to destroy projectile?

Post by rico345 »

Code: Select all

actor "C-4_10sec"
{
	obituary "%k [C-4] %o"
	Projectile
	Scale 0.04
	-NOGRAVITY
	+FLOORHUGGER
	+CEILINGHUGGER
	+NOEXPLODEFLOOR
	
	+SHOOTABLE
	+NOBLOOD
	Health 500
	
	States
	{
		Spawn :
			C4PL A 0
			C4PL A 350
		Death :
			TNT1 A 0
           	 	TNT1 A 0 A_PlaySound("EFT/GRNEXP", CHAN_WEAPON, 5)
           		TNT1 A 0 A_Explode(1000,1400)
			...
	}
}
I added +SHOOTABLE flag in my custom projectile(named C-4_10sec), but still cannot destroy it.
Why is it not working?
User avatar
DBThanatos
Posts: 3101
Joined: Fri Apr 14, 2006 3:17 pm
Location: in "the darkness that lurks in our mind"

Re: How to destroy projectile?

Post by DBThanatos »

Also put this there

Code: Select all

-NOBLOCKMAP
NOBLOCKMAP

This object is excluded from passive collision detection. Nothing else can run into a NOBLOCKMAP object but the object itself can run into others.
Automatically given by the Projectile combo
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

Re: How to destroy projectile?

Post by rico345 »

Thank you, DBThanatos! Working!
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: How to destroy projectile?

Post by NeuralStunner »

A little something you should be aware of: If your projectile "dies" by impact, the A_Explode can re-kill it, effectively exploding twice. Regardless of health. It can also still attract fire while "dying".

This helps avoid that:

Code: Select all

Death:
	TNT1 A 0 A_JumpIfHealthLower (1, 2)
	TNT1 A 0 A_Die
	Loop
	// Normal Death sequence here.
User avatar
Ethril
Posts: 2677
Joined: Sun Nov 16, 2008 2:59 am
Location: with you in the dark

Re: How to destroy projectile?

Post by Ethril »

NeuralStunner wrote:the A_Explode can re-kill it, effectively exploding twice.
Can you do that? Can you explode tw-
...
You know what? Nevermind.
User avatar
Spottswoode
Posts: 18
Joined: Tue Jan 17, 2012 8:41 pm

Re: How to destroy projectile?

Post by Spottswoode »

Hmm...could a shootable projectile say...be used to "combined projectiles"?

Like for instance,

Code: Select all

actor DoomImpBall
{
  Game Doom
  SpawnID 10
  Radius 6
  Height 8
  Speed 10
  DamageFactor "Imp", 100
  DamageFactor 1
  FastSpeed 20
  Damage 3
  DamageType "Imp"
  Projectile
  +RANDOMIZE
  +SHOOTABLE
  +NOBLOOD
  -NOBLOCKMAP
  RenderStyle Add
  Alpha 1
  SeeSound "imp/attack"
  DeathSound "imp/shotx"
  States
  {
  Spawn:
    BAL1 AB 4 bright
    loop
  Death:
    BAL1 CDE 6 bright
    stop
  Death.Imp:
    TNT1 A 0 A_CustomMissile ("SuperImpBall") 
    stop
  }
}
Specifically I want to know if there is some way I could use DamageType to create combination projectiles. Answer is yes...now I just need to make it where the second projectile determines the direction of the new one.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: How to destroy projectile?

Post by FDARI »

NeuralStunner wrote:A little something you should be aware of: If your projectile "dies" by impact, the A_Explode can re-kill it, effectively exploding twice. Regardless of health. It can also still attract fire while "dying".

This helps avoid that:

Code: Select all

Death:
	TNT1 A 0 A_JumpIfHealthLower (1, 2)
	TNT1 A 0 A_Die
	Loop
	// Normal Death sequence here.
Would this be about the same?

Code: Select all

Death:
    "####" "#" 0 A_ChangeFlag("NOBLOCKMAP", true) // You can stop detecting colission after impact, can't you?
    // Normal Death sequence here
now I just need to make it where the second projectile determines the direction of the new one.
CMF_AIMDIRECTION for [wiki]A_CustomMissile[/wiki]? A_CustomMissile (<missile type here>, 0, 0, 0, CMF_AIMDIRECTION)
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: How to destroy projectile?

Post by NeuralStunner »

FDARI wrote:[/code]
Would this be about the same?[/quote]Actually it probably would.

Also, [wiki]A_SpawnItemEx[/wiki] ("NewMissile", 0, 0, 0, VelX, VelY, VelZ, 0, SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION|SXF_TRANSFERPOINTERS)

Sends off a new projectile with all the needed chartacteristics of the old one.

*Crosses fingers and hopes it isn't a Skulltag question*
User avatar
Spottswoode
Posts: 18
Joined: Tue Jan 17, 2012 8:41 pm

Re: How to destroy projectile?

Post by Spottswoode »

Code: Select all

Actor TestPistol : Pistol replaces Pistol
{
States
{ 
Fire:
 PISG A 4
    PISG B 6 A_FireCustomMissile ("DoomImpBall2")
    PISG C 4
    PISG B 5 A_ReFire
    Goto Ready
}
}



actor DoomImpBall2 : DoomImpBall replaces DoomImpBall
{
  Game Doom
  SpawnID 10
  Radius 6
  Height 8
  Health 100
  Speed 10
  DamageFactor Imp, 100
  DamageFactor 0
  FastSpeed 20
  Damage 3
  DamageType "Imp"
  Projectile
  +RANDOMIZE
  +SHOOTABLE
  +NOBLOOD
  -NOBLOCKMAP
  RenderStyle Add
  Alpha 1
  SeeSound "imp/attack"
  DeathSound "imp/shotx"
  States
  {
  Spawn:
    BAL1 AB 4 bright
    loop
  Death:
    TNT1 A 0 A_JumpIfHealthLower (1, 2)
    BAL1 CDE 6 bright
    stop
  Death.Imp:
    TNT1 A 0 A_SpawnItemEx ("SuperImpBall", 0, 0, 0, Velx, VelY, VelZ, 0, SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION|SXF_TRANSFERPOINTERS)
    BAL1 CDE 6 bright
    TNT1 A 0 A_ChangeFlag ("NOBLOCKMAP", true)
    stop
  }
}

Actor SuperImpBall : FatShot
{
Speed 50
Damage 30
DamageFactor 0
Projectile
-SHOOTABLE
-NOBLOCKMAP
States
{
   Death:
    MISL B 8 bright
    MISL C 6 bright
    MISL D 4 bright A_Explode (100, 100, 0)
    stop
    
}
}
This isn't working but when I use my original code for the imp ball it fires the superimpball.
Last edited by Spottswoode on Tue May 29, 2012 6:53 pm, edited 1 time in total.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: How to destroy projectile?

Post by amv2k9 »

Spottswoode wrote:This isn't working but when I use my original code for the imp ball it fires the superimpball.
Use code tags.

Code: Select all

Like this.
It makes your code easier to read.
As for your code...

First off, you can ditch that Death.Imp state, since it's the actor the projectile hits that needs the custom death state, not the projectile itself. Unless you want this projectile to be destroyable by other attacks that do "Imp" DamageType.
User avatar
Spottswoode
Posts: 18
Joined: Tue Jan 17, 2012 8:41 pm

Re: How to destroy projectile?

Post by Spottswoode »

That was the idea. Damage Type was the idea so I could create several types of combinating projectiles this way. Also you could use similar projectiles for defense in this way.
Locked

Return to “Editing (Archive)”