How to make the world freeze during the fire state?

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!)
Post Reply
PeanutButterJelyJam
Posts: 10
Joined: Fri May 01, 2020 5:08 am

How to make the world freeze during the fire state?

Post by PeanutButterJelyJam »

I found this code from universal glory kill mod on youtube made by redzone.
https://www.youtube.com/watch?v=hQ0Fq6Ea1i4

While the fist is in the firing state I want the world to freeze and unfreeze after the firing state

Code: Select all

// Glory kill fist


class GloryFist : Weapon
{	
	Default
	{
		AttackSound "weapon/getskull";
	}
	
	Weapon prevWeapon;
	Actor ptarget; 
	int ptics;
	float vbob;
	
	action void A_ResetWeapon()
	{
		PlayerInfo plr = PlayerPawn(self).player;

		if(invoker.ptarget) 
		{
			if(sv_glorykilldrops)
			{
				int drops = ceil((80-plr.health)/3)+1;
				if(drops <= 0) drops = random(1,6);
				for(int i = 0; i < drops; i++)
				{	
					float xoffs = cos(invoker.ptarget.angle)*frandom(-10,10);
					float yoffs = sin(invoker.ptarget.angle)*frandom(-10,10);
					float zoffs = frandom(5,invoker.ptarget.height);
					let hpup = SuperHealthBonus(Spawn("SuperHealthBonus",(invoker.ptarget.pos.x,invoker.ptarget.pos.y,invoker.ptarget.pos.z-zoffs)));
					if(hpup)
					{
						hpup.plr = plr.mo;
						hpup.vel.x = xoffs;
						hpup.vel.y = yoffs;
					}
				}
			}
			invoker.ptarget.tics = invoker.ptics;
		}
		plr.cheats &= ~(CF_TOTALLYFROZEN|CF_NOTARGET|CF_GODMODE|CF_GODMODE2|CF_INSTANTWEAPSWITCH|CF_DOUBLEFIRINGSPEED);
		plr.mo.ViewBob = invoker.vbob;
		
		if(plr) plr.PendingWeapon = invoker.prevWeapon;
		RemoveInventory(invoker); 
		PSprite pweapon = plr.GetPSprite(PSP_WEAPON);
		pweapon.x -= 130;
		//pweapon.y = WEAPONTOP;
		pweapon.ResetInterpolation();
	}
	
	action void A_ToggleFlip()
	{
		PlayerInfo plr = PlayerPawn(self).player;
		PSprite pweapon = plr.GetPSprite(PSP_WEAPON);
		if(pweapon) 
		{
			pweapon.bFlip = !pweapon.bFlip;	
			pweapon.x -= 130 * (pweapon.bFlip*-1);
			pweapon.ResetInterpolation();
		}
	}
	
	override void DoEffect()
	{		
		if(!PlayerPawn(Owner)) 
		{
			super.DoEffect();
			return;
		}
		if(ptarget && ptarget.health >= 0) 
		{
			if(ptarget.tics != -1) 
			{
				ptics = ptarget.tics;
				ptarget.tics = -1;
			}
			PlayerInfo plr = PlayerPawn(Owner).player;
			plr.mo.vel *= 0;
			if(!vbob) 
			{	
				vbob = plr.mo.ViewBob;
				plr.mo.ViewBob *= 0;
			}
			plr.cheats |= CF_TOTALLYFROZEN|CF_NOTARGET|CF_GODMODE2|CF_GODMODE|CF_DOUBLEFIRINGSPEED|CF_INSTANTWEAPSWITCH;
			if(!prevWeapon) prevWeapon = plr.ReadyWeapon;
		}
		super.DoEffect();
	}
	
	action void A_GloryPunch(bool kill = false)
	{	
		A_Quake(3,3,0,10,"");
		A_CustomPunch(6*Random(11,20),TRUE,96);
		if(invoker.ptarget && kill) invoker.ptarget.A_Die("GloryKill");
	}
	
	States
	{
		Ready:
			PUNG B 1 A_WeaponReady();
		goto Fire;
		Done:
			PUNG B 1 A_ResetWeapon();
		Deselect:
			PUNG B 1 A_Lower(WEAPONBOTTOM);
		Loop;
		Select:
			PUNG B 1 A_Raise(WEAPONTOP);
		Loop;
		Fire:
			TNT1 A 0 A_WeaponOffset(-20,60);
			PUNG BCC 1;
			PUNG D 1 A_GloryPunch();
			PUNG D 1 
			{	
				A_WeaponOffset(30/2,-32/2,WOF_ADD | WOF_INTERPOLATE);
				A_SetRoll(roll+1.25,SPF_INTERPOLATE);
			}
			PUNG D 1
			{
				A_WeaponOffset(-30/5,32/5,WOF_ADD | WOF_INTERPOLATE);
				A_SetRoll(roll-1.25,SPF_INTERPOLATE);
			}
			TNT1 A 0 A_WeaponOffset(-20,60);
			PUNG CCB 1;
			TNT1 A 0 A_ToggleFlip();
			PUNG BCC 1;
			PUNG D 1 A_GloryPunch(true);
			PUNG D 1 
			{	
				A_WeaponOffset(-30/2,-32/2,WOF_ADD | WOF_INTERPOLATE);
				A_SetRoll(roll-1.25,SPF_INTERPOLATE);
			}
			PUNG D 1 
			{
				A_WeaponOffset(30/5,32/5,WOF_ADD | WOF_INTERPOLATE);
				A_SetRoll(roll+1.25,SPF_INTERPOLATE);
			}
			PUNG CCB 1;
			
		Goto Done;
	}
}

PeanutButterJelyJam
Posts: 10
Joined: Fri May 01, 2020 5:08 am

Re: How to make the world freeze during the fire state?

Post by PeanutButterJelyJam »

Also,using the glory kill mod with the universal gibs mod makes the health from performing the glory kill not appear.
Kind of ironic since the fact that they both have universal in their names.
Post Reply

Return to “Scripting”