How to destroy projectile?

Discuss all aspects of editing for ZDoom.
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.

How to destroy projectile?

Postby rico345 » Mon May 28, 2012 2:24 am

Code: Select allExpand view
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?
rico345
 
Joined: 08 Sep 2008
Location: Gimhae City, Republic Of Korea

Re: How to destroy projectile?

Postby DBThanatos » Mon May 28, 2012 2:35 am

Also put this there
Code: Select allExpand view
-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
User avatar
DBThanatos
Guns, explosions, gore.
 
Joined: 14 Apr 2006
Location: in "the darkness that lurks in our mind"

Re: How to destroy projectile?

Postby rico345 » Mon May 28, 2012 3:56 am

Thank you, DBThanatos! Working!
rico345
 
Joined: 08 Sep 2008
Location: Gimhae City, Republic Of Korea

Re: How to destroy projectile?

Postby NeuralStunner » Mon May 28, 2012 1:43 pm

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 allExpand view
Death:
   TNT1 A 0 A_JumpIfHealthLower (1, 2)
   TNT1 A 0 A_Die
   Loop
   // Normal Death sequence here.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: How to destroy projectile?

Postby Ethril » Mon May 28, 2012 2:01 pm

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
Ethril
+666 Orange Robe of Bruising
 
Joined: 16 Nov 2008
Location: MAP34

Re: How to destroy projectile?

Postby Spottswoode » Mon May 28, 2012 6:29 pm

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

Like for instance,

Code: Select allExpand view
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
Spottswoode
 
Joined: 17 Jan 2012

Re: How to destroy projectile?

Postby FDARI » Tue May 29, 2012 3:13 am

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 allExpand view
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 allExpand view
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 A_CustomMissile? A_CustomMissile (<missile type here>, 0, 0, 0, CMF_AIMDIRECTION)
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: How to destroy projectile?

Postby NeuralStunner » Tue May 29, 2012 1:48 pm

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

Also, A_SpawnItemEx ("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
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: How to destroy projectile?

Postby Spottswoode » Tue May 29, 2012 7:35 pm

Code: Select allExpand view
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 7:53 pm, edited 1 time in total.
User avatar
Spottswoode
 
Joined: 17 Jan 2012

Re: How to destroy projectile?

Postby amv2k9 » Tue May 29, 2012 7:50 pm

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 allExpand view
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
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: How to destroy projectile?

Postby Spottswoode » Tue May 29, 2012 7:52 pm

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.
User avatar
Spottswoode
 
Joined: 17 Jan 2012


Return to Editing

Who is online

Users browsing this forum: Andie, Bing [Bot] and 2 guests