stealing life with radius damage.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Ultimate Freedoomer
Posts: 223
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

stealing life with radius damage.

Post by Ultimate Freedoomer »

Hi. In this mod I'm working on, the Scepter of Souls replaces the Pistol (in homage to Strange Aeons). For my version, there are no "weapon level 2" powerup items in the mod, so the Scepter's powered mode serves as its alternate fire here. For the sake of gameplay, I changed the life-stealing function to use a_custompunch's life-stealing (the death state setup is otherwise unchanged). The issue that I'm having is that secondary's life-stealing function & damage dealing isn't working. Here's the code:

Code: Select all

Actor ScepterOfSouls : DoomWeapon replaces pistol 11111
{
	//$Category Weapons
	Inventory.PickupMessage "$PICKUP_SOULSCEPTER"
	Inventory.PickupSound "Misc/W_PkUp"
	Weapon.SelectionOrder 2400
	Weapon.AmmoGive 0
	Weapon.AmmoType "SoulScepterammoicon" // I use ammo icons without ammo usage as visual shorthand for "this is a ranged weapon that doesn't use ammo"
	Weapon.AmmoUse 0
	Weapon.KickBack 0
	+weapon.noautoaim
	+INVENTORY.UNDROPPABLE
	+NOALERT
	-WEAPON.WIMPY_WEAPON
	Tag "$TAG_SOULSCEPTER"
	attacksound "Weapons/SoulScepter/Hit"
	States
	{
	Spawn:
		SLSP A -1
		Stop
	Ready:
		SLSP BCDE 5 Bright A_WeaponReady(WRF_ALLOWUSER1|WRF_ALLOWUSER2)
		Loop
	Deselect:
		SLSP B 1 A_Lower
		Loop
	Select:
		SLSP B 1 A_Raise
		Loop
	Fire:
		TNT1 A 0 A_JumpIfCloser(64,"User1") // used for automatically going into quick melee when a target is in range. Fist is primary quick melee, chainsaw kick is secondary quick melee
		SLSP F 0 Bright A_PlaySound("Weapons/SoulScepter/Fire1",CHAN_6, 1.0,0,0,false)
		SLSP F 4 Bright
		SLSP F 0 Bright A_PlaySound("Weapons/SoulScepter/Loop",CHAN_7,1.0,1,0,false)
		Hold:
		TNT1 A 0 A_JumpIfCloser(64,"User1")
		SLSP G 2 Bright A_CustomPunch(Random(9, 18), 1, 0, "SoulScepterPuff", 256.0,1.0,300,"armorbonus",none,none)
		SLSP H 2 Bright
		SLSP I 2 Bright A_CustomPunch(Random(9, 18), 1, 0, "SoulScepterPuff", 256.0,1.0,300,"armorbonus",none,none)
		SLSP J 2 Bright
		SLSP K 2 Bright A_CustomPunch(Random(9, 18), 1, 0, "SoulScepterPuff", 256.0,1.0,300,"armorbonus",none,none)
		TNT1 A 0 A_ReFire
		SLSP L 4 Bright
		{
		A_StopSound(CHAN_7);
		A_PlaySound("Weapons/SoulScepter/Stop",CHAN_6,1.0,0,0,false);
		}
		SLSP M 4 Bright
		Goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfCloser(64,"User2")
		SLSP F 0 Bright A_PlaySound("Weapons/SoulScepter/Fire1",CHAN_6, 1.0,0,0,false)
		SLSP F 4 Bright
		SLSP F 0 Bright A_PlaySound("Weapons/SoulScepter/Loop",CHAN_7,1.0,1,0,false)
		AltHold:
		TNT1 A 0 A_JumpIfCloser(64,"User2")
		SLSP G 2 Bright A_CustomPunch(0, 1, 0, "SoulScepterPowerPuff", 256.0,1.0,300,"armorbonus",none,none)
		SLSP H 2 Bright
		SLSP I 2 Bright A_CustomPunch(0, 1, 0, "SoulScepterPowerPuff", 256.0,1.0,300,"armorbonus",none,none)
		SLSP J 2 Bright
		SLSP K 2 Bright A_CustomPunch(0, 1, 0, "SoulScepterPowerPuff", 256.0,1.0,300,"armorbonus",none,none)
		TNT1 A 0 A_ReFire
		SLSP L 4 Bright
		{
		A_StopSound(CHAN_7);
		A_PlaySound("Weapons/SoulScepter/Stop",CHAN_6,1.0,0,0,false);
		}
		SLSP M 4 Bright
		Goto Ready
	User1:
		TNT1 A 0 A_JumpIfInventory("PowerStrength", 1, "User1Strong",AAPTR_DEFAULT)
		PUNG BCDE 1
		PUNG F 1 A_CustomPunch(6*random(1, 10),TRUE,0,“PunchPuffNoBerserk”,64.0,0.0,0,“armorbonus”,"fistswing/impactnoberserk","fistswing/missnoberserk")
		PUNG GHGFEDCB 1
		TNT1 A 0 A_ReFire("User1")
		Goto Ready
	User1Strong:
		PUNG B 1
		PUNG CDE 1
		PUNG F 1 A_CustomPunch(60*random(1, 10),TRUE,0,“PunchPuffYesBerserk”,64.0,0.0,0,“armorbonus”,"fistswing/impactyesberserk","fistswing/missyesberserk")
		PUNG GHGFEDCB 1
		TNT1 A 0 A_ReFire("User1Strong")
		Goto Ready
	User2:
		TNT1 A 0 A_JumpIfInventory(“PowerStrength”,1,”KickFireStrong”,AAPTR_DEFAULT)
		RIKI Q 1 A_PlaySound("Ripkick/start",CHAN_BODY,1.0,0,0,false) // used to simulate the chainsaw selection state
		RIKI RSTUV 1
		RIKI I 1 A_PlaySound("Ripkick/Ready",CHAN_BODY,1.0,0,0,false) // used to simulate the idle state
		RIKI JKLMNOP 1
		User2hold: // used for the fire state
		RIKI A 1 A_Saw("ripkick/miss","ripkick/hit",2,”ripkickPuff”,0,65,2.8125,0,0.0,0,”ArmorBonus”)
		RIKI BCD 1
		RIKI E 1 A_Saw("ripkick/miss","ripkick/hit",2,”ripkickPuff”,0,65,2.8125,0,0.0,0,”ArmorBonus”)
		RIKI FGH 1
		TNT1 A 0 A_Refire(“User2Hold”)
		Goto User2Cooldown
	User2Cooldown:
		RIKI P 1 A_PlaySound("Ripkick/Ready",CHAN_BODY,1.0,0,0,false)//used to simulate the chainsaw going back to "ready"
		RIKI ONMLKJI 1
		RIKI V 1 A_PlaySound("Ripkick/down",CHAN_BODY,1.0,0,0,false)//used to simulate the deselect
		RIKI UTSRQ 1
		Goto Ready
	KickFireStrong:
		RIKI Q 1 A_PlaySound("Ripkick/start",CHAN_BODY,1.0,0,0,false)
		RIKI RSTUV 1
		RIKI I 1 A_PlaySound("Ripkick/Ready",CHAN_BODY,1.0,0,0,false)
		RIKI JKLMNOP 1
		User2HoldStrong:
		RIKI A 1 A_Saw("ripkick/miss","ripkick/hit",20,”ripkickPuff”,0,65,2.8125,0,0.0,0,”ArmorBonus”)
		RIKI BCD 1
		RIKI E 1 A_Saw("ripkick/miss","ripkick/hit",20,”ripkickPuff”,0,65,2.8125,0,0.0,0,”ArmorBonus”)
		RIKI FGH
		TNT1 A 0 A_Refire(“User2HoldStrong”)
		Goto User2Cooldown
	}
}

Actor SoulScepterammoicon : Ammo
{
	Inventory.PickupMessage ""
	Inventory.Amount 0
	Inventory.MaxAmount 0
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 0
	Inventory.Icon "SSPAA0"
	States
	{
	Spawn:
		TNT1 A 1
		Fail
	}
}

Actor SoulScepterPuff
{
	Radius 3
	Height 3
	+NoClip
	+AlwaysPuff
	+PuffOnActors
	+NOBLOCKMAP
	+NoGravity
	+ALLOWPARTICLES
	+RANDOMIZE
	+BloodlessImpact
	-BloodSplatter
	+DontSplash
	DamageType "SoulScepter"
	Obituary "$OB_MPSOULSCEPTERPRIMARY"
	RenderStyle Translucent
	Alpha 0.5
	VSpeed 1
	Mass 5
	States
	{
	Spawn:
	Melee:
		SSPF ABCD 3 Bright
		Stop
	Crash:
		TNT1 A 1
		Stop
	}
}

Actor SoulScepterPuff2 : SoulScepterPuff
{
	Radius 1
	Height 1
	+NoInteraction
	States
	{
	Spawn:
		SSPF A 3 bright
		{
		ThrustThingZ(0, Random(2, 6), 0, 0);
		}
		SSPF BCD 3 Bright
		Stop
	}
}

Actor SoulScepterPowerPuff
{
	Radius 3
	Height 3
	+Noclip
	+AlwaysPuff
	+PuffOnActors
	+NoGravity
	+BloodlessImpact
	-BloodSplatter
	+DontSplash
	+PuffGetsOwner
	DamageType "SoulScepter"
	Obituary "$OB_MPSOULSCEPTERSECONDARY"
	States
	{
	Spawn:
		TNT1 A 1
		{
		A_SpawnItemEx("SoulScepterPuff2", Random(0, 72), 0, 0, 0, 0, 0, Random(0, 360), 128,0,0);
		A_SpawnItemEx("SoulScepterPuff2", Random(0, 72), 0, 0, 0, 0, 0, Random(0, 360), 128,0,0);
		A_SpawnItemEx("SoulScepterPuff2", Random(0, 72), 0, 0, 0, 0, 0, Random(0, 360), 128,0,0);
		A_SpawnItemEx("SoulScepterPuff2", Random(0, 72), 0, 0, 0, 0, 0, Random(0, 360), 128,0,0);
		A_Explode(Random(9, 18), 128, 0, 0, 128, 10, 0, "enbulletpuff", "Soulscepter");
		}
		Stop
	Crash:
		TNT1 A 1
		Stop
	}
}

Actor SoulFragment
{
	Radius 1
	Height 1
	Damage (0)
	Projectile
	+DontSplash
	+NoClip
	RenderStyle Add
	Alpha 0.15
	Scale 0.7
	States
	{
	Spawn:
		SSPS AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 Bright A_SpawnItemEx("SoulFragmentTrail", 0, Random(-1, 1), Random(1, -1), 0, 0, 0, 0, 128,0,0)
		FadeOut:
		SSPS A 1
		{
		A_SpawnItemEx("SoulFragmentTrail", 0, Random(-1, 1), Random(1, -1), 0, 0, 0, 0, 128,0,0);
		A_FadeOut(0.02,FTF_REMOVE|0);
		}
		Loop
	Death:
		TNT1 A 1
		Stop
	}
}

Actor SoulFragmentTrail
{
	Radius 1
	Height 1
	Damage (0)
	Projectile
	+DontSplash
	+NoClip
	RenderStyle Add
	Alpha 0.15
	Scale 0.7
	States
	{
	Spawn:
		SSPS BCD 3 Bright
		Stop
	}
}

Return to “Scripting”