[reopened] remote detonation weapon (dn3d pipebomb style)

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
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

[reopened] remote detonation weapon (dn3d pipebomb style)

Post by osjclatchford »

Im after ideas on the best way to make a remote detonation weapon akin (in function) to duke 3d pipebombs.
I have been coming and going on this idea for years but have shyed away in fear of the complicated nature. now I really want to do it whats the best way round it? make the item loop in its death state and search for a custominventory then have the detonator give the inventoryitem to the player? if so how would you do the detonator? would it be an alternate ready state that you go to via another custominventory item thats given when a bomb is fired or am making this too complicated here?

I'd like it to work in the duke 3d style but am getting a little lost in code circles. that is to say if you selected another weapon and went back is it another bomb 'launcher' or the detonator. obviously I'd like it to be able to fire more than one bomb prior to detonation ARRRGH! I'm losing it again... I'm asuming its been done already. if so could anyone point me in the right direction of one or give me some example code of whats the best idea here?

Oh and I'm not acs friendly so I'm talking decorate only here...
thanks in advance

latchford
Last edited by osjclatchford on Sun May 22, 2016 2:24 am, edited 2 times in total.
User avatar
HellCattX
Posts: 506
Joined: Thu Feb 26, 2009 2:10 pm

Re: [help!] remote detonation weapon (dn3d pipebomb style)

Post by HellCattX »

Here, This code throws pipe bombs with the primary fire button and uses the alt fire to detonate them, not including the srpites, but altfire would be the black detonator button press animations.

Code: Select all

ACTOR Pipebombs : Weapon
{
	Inventory.PickupSound "misc/ammo_pkup"
	Inventory.PickupMessage "Found a Pipebomb"
	weapon.ammotype "PBPA"
	weapon.ammouse 1
	weapon.ammogive 1
	Weapon.Kickback 1000
	Scale 0.20
        +WEAPON.NOALERT
	Decal Scorch
	States
	{
	Spawn:
		PIPE A -1
		Loop
	Ready:
		PIPG A 1 A_WeaponReady
		Loop
	Deselect:
		PIPG A 1 A_Lower
		loop
	Select:
		PIPG A 1 A_Raise
		loop
	Fire:
		PIPG A 3
		PIPG B 3
		PIPG C 3
		PIPG D 6 
		PIPG D 0 A_Playsound("Duke/Bounce")
		PIPG E 2 A_FireCustomMissile("Pipebomb",0,1,0,0)
		PIPG F 2
		PIPG G 2
		TNT1 A 3
		PIPG C 4
		PIPG B 4
		PIPG A 3
		goto Ready
		PIPG A 1
		goto Ready
	AltFire:
		PIPD A 2
		PIPD B 2
		PIPD A 0 Thing_Destroy(1999)
		PIPD C 2
		PIPD A 6
		PIPG C 2
		PIPG B 2
		goto Ready
	}
}

ACTOR Pipebomb
{ 
    PROJECTILE
    -NOGRAVITY
    +HEXENBOUNCE
    +SHOOTABLE
    -NOBLOCKMAP
    +CORPSE
    +GHOST
    -NOLIFTDROP
    -SOLID
    +THRUGHOST
    +NOBLOOD
    +EXTREMEDEATH
    +BOUNCEONACTORS
    Health 1
    Damage 0
    Speed 20
    Scale 0.20
    BounceFactor 0.6
    Radius 10
    Height 8
    DontHurtShooter
    ExplosionDamage 285
    ExplosionRadius 144
    DeathSound "Duke/Bounce"
    Renderstyle Normal
    States
    {
    Spawn:
      DNPB W 0
      DNPB W 150 Thing_ChangeTid(0,1999)
      DNPB W 1 A_Stop
      DNPB W 0 A_Gravity
      DNPB W 0 Thing_ChangeTid(0,1999)
      goto Spawn+2
    Death:
      DNPB W 1 Thing_ChangeTid(0,1999)
      TNT1 A 0 bright A_Playsound("world/barrelx")
      DNMS B 0 bright A_Explode
      DNMS B 0 bright A_CustomMissile(PipebombExplosion, 8, 0, 0) 
      stop
    }
}

ACTOR PipebombExplosion
{
   RENDERSTYLE ADD
   ExplosionDamage 285
   ExplosionRadius 144	
   Radius 10
   Height 32
   Speed 0
   PROJECTILE
   DontHurtShooter
   +NOCLIP
   +EXTREMEDEATH
   States
   {
   Spawn:
    TNT1 A 0 bright
    TNT1 A 0 bright
    DNMS B 2 bright 
    DNMS C 2 BRIGHT
    DNMS D 2 BRIGHT
    DNMS E 2 BRIGHT
    DNMS F 2 BRIGHT
    DNMS G 2 BRIGHT
    DNMS H 2 BRIGHT 
    DNMS I 2 BRIGHT
    DNMS J 2 BRIGHT
    DNMS K 2 BRIGHT
    DNMS L 2 BRIGHT
    DNMS M 2 BRIGHT          
    DNMS N 2 BRIGHT
    DNMS O 2 BRIGHT
    DNMS P 2 BRIGHT
    DNMS Q 2 BRIGHT
    DNMS R 2 BRIGHT
    DNMS S 2 BRIGHT
    DNMS T 2 BRIGHT
    DNMS U 2 BRIGHT
    DNMS V 2 BRIGHT
    TNT1 A 1 BRIGHT
    Stop
   }
}
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [help!] remote detonation weapon (dn3d pipebomb style)

Post by osjclatchford »

wow! more than I could have possible hoped for. I'll give this a go, you sir are a very nice chap!
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [help!] remote detonation weapon (dn3d pipebomb style)

Post by osjclatchford »

I've done much with this but I'm still stuck on this same old problem: I've added a jumpifnoammo to go to a copy of each of the desired states ( select, deselect, ready, etc...) that uses tnt1a0 as the frame so that it does not show you holding a pipebomb after the last one is fired.
I know i could have just added them in as jumpto lines instead of whole new states but it does the same and I find it easier to spot any mistakes this way...
well, when firing pipebombs under primary fire all is great. the last one fires and it jumps to readydry as it should. groovy.
BUT! if you then use the detonator (altfire) the jumpifnoammo has no effect on it. what should I be putting in its place to make the altfire jump to altfiredry if there are no pipebombs left? here is the code:
Spoiler:
please help...
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: [help!] remote detonation weapon (dn3d pipebomb style)

Post by Accensus »

My suggestion is a little hacky, but it Could work for you or at least give you some fuel for thought.

Replace

Code: Select all

TNT1 A 0 A_jumpifnoammo("readydry")
With

Code: Select all

TNT1 A 0 A_JumpIfInventory("PipeBombAmmo", 1)
Goto ReadyDry
...rest of code...
Of course, if someone else gives you a better code go ahead and use that one.

EDIT: Or add ammotype1 & ammotype2. Might help.
Wiki wrote:It jumps if the carrying player doesn't have enough ammunition for one attack of the currently used attack mode
I suppose this would mean that you have to define altfire ammo type so the game can recognise it.
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [help!] remote detonation weapon (dn3d pipebomb style)

Post by osjclatchford »

sorry but this:
Lud wrote: Replace

Code: Select all

TNT1 A 0 A_jumpifnoammo("readydry")
With

Code: Select all

TNT1 A 0 A_JumpIfInventory("PipeBombAmmo", 1)
Goto ReadyDry
...rest of code...
does nothing and if you put it at the end of altfire instead of the beginning you'd never be able to detonate the last fired pipebomb...

and
Lud wrote: Or add ammotype1 & ammotype2.
is no good as you'd only ever have altfiredry as altfiredry or otherwise you cant have a specific ammo type for the button press. evrytime you press the button you'd loose ammotype2. if you had three pipebombs, threw one pipebomb but then pressed the detonator three times you'd be unable to throw the other two, get me?

this is driving me ,mad. someone must have done this in another mod already!?

*EDIT*

aw shit sorry lud, just figured what you meant. replace ALL jump if no ammos with A_JumpIfInventory("PipeBombAmmo", 1, 1) and add a goto wahatever state you wanna go to directly beneath It sems to be functioning awesome now. many many thanks to you...
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: [solved] remote detonation weapon (dn3d pipebomb style)

Post by Accensus »

You're welcome mate. I forgot to mention the code was supposed to be in the beginning. :P
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by osjclatchford »

ok these are fun but can someone give me a basic yes or no on whether its possible to have the projectile(s) re-pickupable as an ammo item and still work as it does here (I really do miss that from duke, you know, picking it up again cos its not quite where you want it or you've changed your mind)

anyway here's the latest code:
Spoiler:
I don't think it can be done but then I'm often wrong about such things... oh and decorate only please... Thanks
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by Accensus »

Try to add some inheritance to the "ACTOR Pipebomb" such as Ammo or CustomInventory. It know, Ammo doesn't make much sense, but try it anyways. If you use CustomInventory, you might also want to add a Pickup state, too.
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by osjclatchford »

thats a blindin' idea lud...

I'm now thinking do it as a custom inventory, and make it give you a pipebomb ammo (yet to be defined) in its pickup state... thanks again...
I'll have a play about and see how I get on... :D
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by osjclatchford »

OK. Inheritance works but you instantly pick up the projectile when you fire it if you are moving when firing. What should I change in a_firecustommissile to spawn the projectile forward enough away from the player to prevent this. Wiki just confused me when looking this up ...
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by Accensus »

I think it'd be a better idea to spawn a pickable Pipebomb when the rolling one stops in one place. I have no idea how to implement it with your current codebase, though.
osjclatchford
Posts: 2062
Joined: Mon Feb 07, 2011 5:02 am

Re: [reopened] remote detonation weapon (dn3d pipebomb style

Post by osjclatchford »

OK thanks mate. For now I've set the spawn height to 25 and that at least functions for the most part. Its s little buggy as it still does it of you aim real low but I guess I can live with that... thanks again...
Locked

Return to “Editing (Archive)”