Jump to content

Decorate grenade launcher issue (SOLVED)


Recommended Posts

i creaded a grenade launcher thet uses custom grenades in brutal doom fashion but it seams im having truble with the normal grenade toss function

at first i can use grenades normaly and use the grenade launcher without issuses but once i run out of grenades i can no longer use the grenade toss only the grenade launcher, im not sure what i did wrong.

 

This is the grenade launcher code

 

ACTOR BTGrenadeLauncher : BlackTemplarWeapon
{
    SpawnID 1120
    Weapon.SelectionOrder 8500
    Weapon.AmmoGive2 6
    Weapon.AmmoType1 "GrenadeAmmoLoaded"
    Weapon.AmmoType2 "GrenadeLauncherAmmo"	
    Weapon.SlotNumber 7
    Inventory.PickupSound "weapons/GrenadeLauncher/pickup"
    Inventory.PickupMessage "$GOT GRENADELAUNCHER"
	Inventory.ForbiddenTo BloodAngel

    States
    {
    Spawn:
        GBTN A -1 
        Stop
    Ready:
        TNT1 A 2 A_PlaySound("weapons/GrenadeLauncher/pickup")
        GRLS ABC 1
    ReadyLoop:
        GRLG A 1 A_WeaponReady(WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
        Goto ReadyLoop
    Deselect:
        GRLS CBA 1
        TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
        TNT1 A 1
        Wait
    Fire:
        TNT1 A 0 A_JumpIfInventory("GrenadeAmmoLoaded",1,1)
        Goto Reload

        TNT1 A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
        TNT1 A 0 A_PlaySound ("weapons/GrenadeLauncher/fire")
        TNT1 A 0 A_AlertMonsters
        GRLF A 2 BRIGHT A_FireCustomMissile("BdGrenadeMissile", 0, 1, 13, 9)
        TNT1 A 0 A_Takeinventory("GrenadeAmmoLoaded",1)
        GRLF BCD 2 BRIGHT
        GRLF E 2 A_SetPitch(-6.0 + pitch)
        GRLG A 2 A_SetPitch(2.0 + pitch)
        TNT1 A 0
        TNT1 A 0 A_Refire
        Goto ReadyLoop

    Reload:
        GRLG A 1 A_WeaponReady
        GRLG A 6
        TNT1 A 0 A_JumpIfInventory("GrenadeAmmoLoaded", 0,"ReadyLoop")
        TNT1 A 0 A_JumpIfInventory("GrenadeLauncherAmmo",1, "ReloadAnimate")
        Goto ReadyLoop
    ReloadAnimate:
        TNT1 A 0 A_PlaySound("weapons/GrenadeLauncher/reload")
        GRLR ABCDE 3 
        TNT1 A 0 A_SpawnItemEx("EmptyRocketChamber", 17, 2, 35, 0, random(3,6), 4)
        GRLR FGHI 3
        GRLR JK 3
    ReloadAmmo:
        //This continuously subtracts from stock and adds to the amount in the weapon until we either run out of stock or fill the weapon.
        TNT1 A 0 A_JumpIfInventory("GrenadeAmmoLoaded", 0,"ReadyLoop")
        TNT1 A 0 A_JumpIfInventory("GrenadeLauncherAmmo",1, 1)
        Goto ReadyLoop
        TNT1 A 0 A_Giveinventory("GrenadeAmmoLoaded", 1)
        TNT1 A 0 A_Takeinventory("GrenadeLauncherAmmo", 1)
        Goto ReloadAmmo
    }
}

the grenade toss code (Wich comes with the player class code)

 

ACTOR BlackTemplarWeapon : DoomWeapon
{   
    //$Category Weapons
    Game Doom
    Weapon.AmmoUse1 0
    Weapon.AmmoUse2 0
    Weapon.AmmoGive1 0
    Weapon.AmmoGive2 0
    +WEAPON.NOAUTOAIM
    +FORCEXYBILLBOARD
    +WEAPON.NOALERT
	States
    {
    Ready:
	ReadyLoop:
    Deselect:
    Fire:
    Flash:
	Spawn:
	    TNT1 A 0 A_Print("??? Weapon reached unimplemented state ???")
        Stop
    Select:
		TNT1 A 0 A_WeaponOffset(0.0, 32.0)
        TNT1 A 0 A_Raise(60)
        Wait
    AltFire: //Actually kick
        TNT1 A 0 A_PlaySound("weapons/melee/kick")
        TNT1 A 0 SetPlayerProperty(0, 1, PROP_FROZEN)
		//If the player has been punching, end the combo here
        TNT1 A 0 A_TakeInventory("PSeq1", 2)
        TNT1 A 0 A_TakeInventory("PSeq2", 1)
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
        STKI ABCDEF 1
        TNT1 A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        STKI G 4
        STKI HIJK 2
        TNT1 A 0 A_Jump(256, "FinishKick")

    BerserkerKick:
        BTKI ABCDEFG 1
        TNT1 A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        BTKI H 3
        BTKI IGFEDCBA 1

    FinishKick:
        TNT1 A 0 SetPlayerProperty(0,0, PROP_FROZEN)
        TNT1 A 0 A_TakeInventory("KickHasHit", 1)
        TNT1 A 0 A_Jump(256, "ReadyLoop")
		
		Zoom: //Actually grenade
        TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
        Goto NoGrenade
        BRTH ABCD 1
        TNT1 A 0 A_PlaySound("weapons/grenade/pin")
        BRTH EEFG 1
        TNT1 A 0 A_PlaySound("weapons/grenade/toss")
        BRTH HI 1
        TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
        TNT1 A 0 A_FireCustomMissile("BdGrenade", random(-2,2), 0, 0, 0, 0, 0)
        BRTH JKLM 1
        TNT1 A 1 
        TNT1 A 0 A_Jump(256, "Ready")

    NoGrenade:
        TNT1 A 0 A_Print("No Grenades Left")
        TNT1 A 0 A_Jump(256, "ReadyLoop")

    }
}

and the grenade ammo

 

//Grenades aren't really a weapon, but they're added on to all weapons by default

/** This weapon is given to the player on start and acts as a placeholder to allow grenades to appear in the GZDoom alt hud. It's bumped to an absurd SelectionOrder so that it doesn't get selected automatically. */
ACTOR BdGrenades : BdLiteWeapon
{
	Weapon.SelectionOrder 99999999
    Weapon.AmmoType GrenadeAmmo
	States
	{
		Ready:
		ReadyLoop:
		Fire:
		Flash:
			TNT1 A 1 A_WeaponReady
			Wait
		Deselect:
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1
			Wait
	}
}

/** Small ammo for grenades */
ACTOR GrenadeAmmo : Ammo
{
    //$Category Ammunition
    Game Doom
    SpawnID 11
    Inventory.PickupMessage "You got a grenade!"
    Inventory.PickupSound "weapons/rifle/clip"
    Inventory.Amount 1
    Inventory.MaxAmount 6
    Ammo.BackpackAmount 5
    Ammo.BackpackMaxAmount 20
    Inventory.Icon "GRNDA"
    Scale 0.8
    States
    {
    Spawn:
        PGRN AB 10
        Loop
    }
}

/** Large ammo for grenades */
ACTOR GrenadeBox : GrenadeAmmo
{
    Game Doom
    SpawnID 139
    Inventory.PickupMessage "Picked up a box of grenades."
    Inventory.PickupSound "weapons/rifle/clip"
    Inventory.Amount 3
    States
    {
    Spawn:
        PGRN CD 10
        Loop
    }
}

   /** Represents ammo loaded into the GrenadeLauncher */
ACTOR GrenadeAmmoLoaded : Ammo
{
   Inventory.Amount 20
   Inventory.MaxAmount 20
   Ammo.BackpackAmount 5
   Ammo.BackpackMaxAmount 40
   Inventory.Icon "GRNDA"
}

ACTOR GrenadeLauncherAmmo : Ammo
{
    Inventory.Amount 6
    Inventory.MaxAmount 30
    Ammo.BackpackAmount 5
    Ammo.BackpackMaxAmount 40
    Inventory.Icon "GRNDA"
    States
    {
    Spawn:
        PGRN A -1
        Stop
    }
}

also the grenade projectiles

 

/** Inventory class used to count up the time until a grenade explodes */
Actor GrenadeTime : Inventory
{
inventory.maxamount 6
}

/** Grenades aren't really implemented as weapons, but they can be used with the Zoom function on weapons. They're projectiles that bounce and are affected by gravity. */
ACTOR BdGrenade
{
    Radius 4
    Height 4
    Projectile
    Speed 30
    Damage 0
    Gravity 0.7
    Scale 0.2
    +MISSILE
    -NOGRAVITY
    -BLOODSPLATTER
    -EXTREMEDEATH
    +EXPLODEONWATER
    +SKYEXPLODE
    +DOOMBOUNCE
    BounceFactor 0.5
    WallBounceFactor 0.25
    Health 5
    SeeSound "weapons/grenade/bounce"
    DeathSound "none"
    Obituary "%o ate %k grenade."
    States
    {
    Spawn:
        GRND ABCDEFGH 2
        TNT1 A 0 A_GiveInventory("GrenadeTime", 1)
        TNT1 A 0 A_JumpIfInventory("GrenadeTime", 3, "Explode")
        Loop
    Death:
        TNT1 A 0
        GRND H 16
        TNT1 A 0 A_GiveInventory("GrenadeTime", 1)
        TNT1 A 0 A_JumpIfInventory("GrenadeTime", 3, "Explode")
        Loop
        
        
        
    Explode:
        TNT1 A 0 A_NoBlocking
        TNT1 A 0 A_SpawnItem("FragGrenadeExplosion")
        Stop
    }
}

Actor GrenadeMissleTime : Inventory
{
+ACTIVATEIMPACT
inventory.maxamount 3
}

ACTOR BdGrenadeMissile
{
    Radius 4
    Height 4
    Projectile
    Speed 30
    Damage 0
    Gravity 0.7
    Scale 0.9
    +MISSILE
    -NOGRAVITY
    -BLOODSPLATTER
    -EXTREMEDEATH
    +EXPLODEONWATER
    +SKYEXPLODE
    +DOOMBOUNCE
    BounceFactor 0.5
    WallBounceFactor 0.25
    Health 5
    SeeSound "weapons/grenade/bounce"
    DeathSound "none"
    Obituary "%o ate %k grenade."
    States
    {
    Spawn:
       Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_GiveInventory("GrenadeMissleTime", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeMissleTime", 3, "Explode")
		TNT1 A 0 A_CheckFloor("Death")
		GBPJ AAABBBCCCDDD 1 A_CustomMissile ("SmokeTrail", 2, 0, random (70, 110), 2, random (0, 360))
		TNT1 A 0 A_JumpIfInventory("GrenadeMissleTime", 3, "Explode")
		TNT1 A 0 A_GiveInventory("GrenadeMissleTime", 1)
		GBPJ EEEFFFGGGHHH 1 A_CustomMissile ("SmokeTrail", 2, 0, random (70, 110), 2, random (0, 360))
		TNT1 A 0 A_JumpIfInventory("GrenadeMissleTime", 3, "Explode")
		
		Loop
		
   Death:
	    TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("GrenadeMissleTime", 3, "Explode")
		GBPJ AAAA 3 A_CustomMissile ("SmokeTrail", 2, 0, random (70, 110), 2, random (0, 360))
		TNT1 A 0 A_GiveInventory("GrenadeMissleTime", 1)
		Loop
        
        
        
    Explode:
        TNT1 A 0 A_NoBlocking
        TNT1 A 0 A_SpawnItem("FragGrenadeExplosion")
        Stop
    }
}

 

Edited by nekostuffing
forgot to add something

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...