Jump to content

Self-damage punching walls?


rabidrage

Recommended Posts

Supposing I want Doomguy to get hurt if he punches the wall.  How would I implement that in good old Decorate?  I haven't had a ton of time to figure it out, but I want this for my Rabid Fist mod.

Share this post


Link to post

I've done a ton to make this work.  It's a modification of the BD64 Fist.  Heavy modification, but that's the template I chose to work with.  So the following code looks ridiculous, but I have to show it to get help.  See, I've gotten it to damage me when I strike the wall (except that's randomly broken again and the meleepuff isn't puffing right).  But now I seem to be punching multiple times in one swing when I hit monsters (if the sounds are any indication).  Is there any chance anyone can find the reason for this?  And yes, I'm still using Decorate even though it's apparently deprecated.  Decorate is what I know.

ACTOR GBADoomPlayer : DoomPlayer Replaces DoomPlayer
{
	Player.StartItem "Clip", 50
  Player.StartItem "Pistol"
  Player.StartItem "64Fist"
  DamageFactor "Playtastic", 1.0
	}

Actor 64Fist : Fist Replaces Fist
{
	AttackSound "Player/Cyborg/Fist"
	-PUFFONACTORS
	States
	{
	Ready:
	PUN1 A 1 A_WeaponReady
	Loop
	
  Select:
	TNT1 AAAAA 1 A_Raise
	TNT1 AAAAAAAAAA 0 A_Raise
	Goto SelectAnimation

 SelectAnimation:
	PUN1 A 3
	Goto Ready
	
 Deselect:
	PUN1 A 3
	TNT1 AAAAAAAAAA 0 A_Lower
	TNT1 A 1 A_Lower
	Wait
	
	Fire:
		PUN1 A 1
		TNT1 A 0 A_Jump(255, "Punch1", "Punch2")
	
	Punch1:
		PUN1 A 1
		TNT1 A 0 A_JumpIfInventory("powerstrength", 1, "BerserkPunch1")
		PUN1 BCD 1 A_CustomPunch(1*Random(5,10),TRUE,"MeleePuff",64)
		PUN1 E 3 Radius_Quake (2, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
		PUN1 FGHI 1
		PUN1 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready
	Punch2:
	    PUN1 A 1
		TNT1 A 0 A_JumpIfInventory("powerstrength", 1, "BerserkPunch2")
		PUN2 BCD 1 A_CustomPunch(1*Random(5,10),TRUE,"MeleePuff",64)
		PUN2 E 3 Radius_Quake (2, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
		PUN2 FGHI 1
		PUN2 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready	
		
	
	BerserkPunch1:
		PUN4 BD 1
		PUN1 E 6 A_CustomPunch(1*Random(60,80),TRUE,0,"MeleePuff",64)//("SuperPunchAttack", 0, 0, 0, -7)
		PUN1 FGHI 1
		PUN1 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready
	BerserkPunch2:
		PUN5 BD 1
		PUN2 E 6 A_CustomPunch(1*Random(60,80),TRUE,0,"MeleePuff",64)//("SuperPunchAttack", 0, 0, 0, -7)
		PUN2 FGHI 1
		PUN2 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready
		
		Death:
		PUFF A 0 A_PlaySound("Player/Cyborg/Fist", 3)
		
		XDeath:
		PUFF A 0 A_PlaySound("SUPERFIST", 3)
		Stop
	}
}

ACTOR ExplosionSmoke
{
    +NOBLOCKMAP
    +NOTELEPORT
	+NOINTERACTION
    +DONTSPLASH
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
	+NOGRAVITY
	+DOOMBOUNCE
	+THRUACTORS
	-PUFFONACTORS
	Health 99999
	BounceFactor 0.5
	Radius 5
	Height 5
	Alpha 0.1
	RenderStyle Translucent
	Scale 1.1
	Speed 1
    States
    {
    Spawn:
	TNT1 A 0
	
	TNT1 A 0 A_JumpIf(waterlevel > 1, "Stap")
	SMK3 BBB 2 A_FadeIn(0.1)
	SMK3 B 20
	TNT1 A 0 A_JumpIf(waterlevel > 1, "Stap")
	SMK3 CDEFGHIJKLM 3
	Goto Death
	Death:
	    TNT1 A 0
    Stop
Stap:		
TNT1 A 0
Stop
    }
}

ACTOR MeleePuff: ExplosionSmoke
{
Speed 1
Alpha 0.15
Scale 0.2
-PUFFONACTORS
damagetype Playtastic
States
{
Spawn:
TNT1 A 0
SMK3 B 4 A_Explode(random(1,2), XF_NOSPLASH, XF_HURTSOURCE, 32, 1)
SMK3 CDEFGHIJKLM 2
Stop
}
}

 

 

Edited by rabidrage

Share this post


Link to post

you should move Death/XDeath into the actor which inflicts the damage and dies, it's `MeleePuff` in this case i guess. that A_CustomPunch probably a shortcut function (which wraps FastProjectile or something).. also you can use A_Log("this is XDeath state") to dump logs onto screen while debugging your stuff

 

 

Share this post


Link to post

I've been hard at work since I posted that.  So...MeleePuff does the damage to the Player, and it was 64Fist that damaged monsters, but now it's back to being PunchAttack (added back from BD64 to make some of the things work).  The only thing that's not working now is the sounds.  I mean, they work, but I want a different sound for punching walls vs. punching monsters.  With the code I'm about to share, it plays both sounds when I punch the wall.  If I can fix that, I will have this mod complete!  So please share your thoughts.

 

ACTOR GBADoomPlayer : DoomPlayer Replaces DoomPlayer
{
	Player.StartItem "Clip", 50
  Player.StartItem "Pistol"
  Player.StartItem "64Fist"
	}

Actor 64Fist : Fist Replaces Fist
{
	-PUFFONACTORS
	States
	{
	Ready:
	PUN1 A 1 A_WeaponReady
	Loop
	
  Select:
	TNT1 AAAAA 1 A_Raise
	TNT1 AAAAAAAAAA 0 A_Raise
	Goto SelectAnimation

 SelectAnimation:
	PUN1 A 3
	Goto Ready
	
 Deselect:
	PUN1 A 3
	TNT1 AAAAAAAAAA 0 A_Lower
	TNT1 A 1 A_Lower
	Wait
	
	Fire:
		TNT1 A 0 A_Jump(127, "Punch2")
		PUN1 A 1
		TNT1 A 0 A_JumpIfInventory("powerstrength", 1, "BerserkPunch1")
		PUN1 BCD 1 A_Custompunch(0,0,1,"MeleePuff")
		PUN1 E 3 A_FireCustomMissile ("PunchAttack", 0, 0, 0, -7)
		PUN1 FGHI 1
		PUN1 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		goto Ready
	Punch2:
	    PUN1 A 1
		TNT1 A 0 A_JumpIfInventory("powerstrength", 1, "BerserkPunch2")
		PUN2 BCD 1 A_Custompunch(0,0,1,"MeleePuff")
		PUN2 E 3 A_FireCustomMissile ("PunchAttack", 0, 0, 0, -7)
		PUN2 FGHI 1
		PUN2 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		goto Ready	
		
	
	BerserkPunch1:
		PUN4 BD 1
		PUN1 E 6 A_FireCustomMissile("SuperPunchAttack", 0, 0, 0, -7)
		PUN1 FGHI 1 A_Custompunch(0,0,1,"MeleePuff")
		PUN1 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready
	BerserkPunch2:
		PUN5 BD 1 A_Custompunch(0,0,1,"MeleePuff")
		PUN2 E 6 A_FireCustomMissile("SuperPunchAttack", 0, 0, 0, -7)
		PUN2 FGHI 1
		PUN2 JKA 1 A_WeaponReady(1)
		PUN1 A 4 A_WeaponReady(1)
		TNT1 A 0  A_ReFire
		goto Ready
	}
}

ACTOR PunchAttack: FastProjectile
{
	Radius 18
	Height 6
	DamageType Melee
	Projectile 
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	RenderStyle Add
	Damage (random(5,10))
	Alpha 0.6
    Speed 30
	//HitObituary "$OB_IMPHIT"
	DeathSound "Player/Cyborg/Fist"
	Decal "none"
	States
	{
	Spawn:
		TNT1 A 1
        TNT1 A 1 A_PlaySound("VUP")
		Stop
	Death:
		    PUFF A 0
			TNT1 A 0 Radius_Quake (2, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
			TNT1 A 10
		Stop
	}
}

ACTOR SuperPunchAttack: PunchAttack
{
	DamageType SuperFists
    Damage (random(60,80))
	States
	{
	Spawn:
		TNT1 A 1
		Stop
	Death:
	        TNT1 A 0
		    PUFF A 0 A_PlaySound("FOOTWALL", 3)
			TNT1 A 0 Radius_Quake (4, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
			TNT1 A 15
		Stop
	
	XDeath:
			PUFF A 0 A_PlaySound("FOOTWALL", 4)
		   PUFF A 0 A_PlaySound("SUPERFIST", 3)
			TNT1 A 0 Radius_Quake (4, 6, 0, 5, 0)//(intensity, duration, damrad, tremrad, tid)
			TNT1 A 15
		Stop
	}
}



ACTOR MeleePuff
{
Speed 1
Alpha 0.15
Scale 0.2
 +NOBLOCKMAP
    +NOTELEPORT
	+NOINTERACTION
    +DONTSPLASH
	+FORCEXYBILLBOARD
	+NOGRAVITY
	+DOOMBOUNCE
	+THRUACTORS
-PUFFONACTORS
Health 99999
	BounceFactor 0.5
	Radius 5
	Height 5
	RenderStyle Translucent
States
{
Spawn:
TNT1 A 0
SMK3 B 4 A_Explode(random(1,2), XF_NOSPLASH, XF_HURTSOURCE, 32, 1)
SMK3 CDEFGHIJKLM 1
Stop
Crash:
TNT1 A 0 A_Playsound ("player/wall/fist")
SMK3 B 4 A_Explode(random(1,2), XF_NOSPLASH, XF_HURTSOURCE, 32, 1)
}
}

 

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...