A new weapon spawn function

Moderator: GZDoom Developers

Post Reply
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

A new weapon spawn function

Post by Ultimate Freedoomer »

Okay, I recently had an idea for a new weapon function: A_SetSpawnState. Basically, this would be a customizable version of A_selectPiece. The parameters would be as follows:
  • spawnstatenumber: this would determine what value to look for in order to carry out the jump
  • Statename: what state to jump to when the "state number" parameter equals the called value
  • Transfer sprite frame: situations where it'd be overlayed would use this. It'd be a boolean value.
  • Weapon.spawnlevel: this actor property is basically used by the 'spawnstatenumber" value of this function in much the same way A_SelectPiece uses the "health" property.
As an example, here's the a proposed recreation of the Vanilla Sigil using a_setSpawnState to recreate A_SelectPiece (thanks to the "modding the Sigil made easy" template for everything else):

Code: Select all

Actor NNSigil : weapon replaces Sigil
{
	Weapon.Kickback 100
	Weapon.SelectionOrder 4000
	+FLOORCLIP
	+WEAPON.CHEATNOTWEAPON
	+WEAPON.NOAUTOAIM
	Inventory.PickupSound "weapons/sigilcharge"
	Weapon.spawnlevel 1
	Tag "$TAG_SIGIL" // "SIGIL"
	Inventory.PickupMessage "$TXT_SIGIL" // "You picked up the SIGIL."
	States
	{
	Deselect:
		"----" A 1 Bright A_Lower(6)
		Loop
	Select:
		TNT1 A 1 Bright
		{
		If(CallACS("NNSigilPieceCount")==5)
		{
		a_overlay(2,"Viewlevel5");
		}
		If(CallACS("NNSigilPieceCount")==4)
		{
		a_overlay(2,"Viewlevel4");
		}
		If(CallACS("NNSigilPieceCount")==3)
		{
		a_overlay(2,"Viewlevel3");
		}
		If(CallACS("NNSigilPieceCount")==2)
		{
		a_overlay(2,"Viewlevel2");
		}
		If(CallACS("NNSigilPieceCount")==1)
		{
		a_overlay(2,"Viewlevel1");
		}
		A_Raise(6);
		}
		goto ready
	Viewlevel1:
		SIGH A -1
		stop
	Viewlevel2:
		SIGH B -1
		stop
	Viewlevel3:
		SIGH C -1
		stop
	Viewlevel4:
		SIGH D -1
		stop
	Viewlevel5:
		SIGH E -1
		stop
	Ready://Well, it seems using "----" A in 'Ready' makes ZDoom refuse to give you the item. Interesting.
		SIGH "#" 1 Bright
		{
		If(CallACS("NNSigilPieceCount")==5)
		{
		a_overlay(2,"Viewlevel5");
		}
		If(CallACS("NNSigilPieceCount")==4)
		{
		a_overlay(2,"Viewlevel4");
		}
		If(CallACS("NNSigilPieceCount")==3)
		{
		a_overlay(2,"Viewlevel3");
		}
		If(CallACS("NNSigilPieceCount")==2)
		{
		a_overlay(2,"Viewlevel2");
		}
		If(CallACS("NNSigilPieceCount")==1)
		{
		a_overlay(2,"Viewlevel1");
		}
		WeaponReady(0);
		}
		Loop
	Fire:
		TNT1 A 18 Bright
		{
		if((CallACS("NNSigilPieceCount")==1)
		{
		a_overlay(2,"Fire1");
		}
		if((CallACS("NNSigilPieceCount")==2)
		{
		a_overlay(2,"Fire2");
		}
		if((CallACS("NNSigilPieceCount")==3)
		{
		a_overlay(2,"Fire3");
		}
		if((CallACS("NNSigilPieceCount")==4)
		{
		a_overlay(2,"Fire4");
		}
		if((CallACS("NNSigilPieceCount")==5)
		{
		a_overlay(2,"Fire5");
		}
		A_PlaySound("weapons/sigilcharge",CHAN_WEAPON,1.0,false,attn_norm,false);
		A_Light(2);
		}
		TNT1 A 3 Bright A_GunFlash("Flash",0)
		TNT1 A 10 A_PlaySound("weapons/sigilcharge",CHAN_WEAPON,1.0,false,attn_norm,false)
		TNT1 A 5
		Goto Ready
	Fire1:
		SIGH A 18
		SIGH A 3
		SIGH A 10
		{
		A_Fireprojectile("NNSigilLightningSpot",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(4,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		}
		SIGH A 5
		stop
	Fire2:
		SIGH B 18
		SIGH B 3
		SIGH B 10
		{
		A_Fireprojectile("NNSpectralLightningH1",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(8,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		}
		SIGH B 5
		stop
	Fire3:
		SIGH C 18
		SIGH C 3
		SIGH C 10
		{
		A_Fireprojectile("NNSigil3AttackCounter",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(12,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		}
		SIGH C 5
		Goto Ready
	Fire4:
		SIGH D 18
		SIGH D 3
		SIGH D 10
		{
		A_Fireprojectile("NNSigilLightningBigV",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(16,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		}
		SIGH D 5
		stop
	Fire5:
		SIGH E 18
		SIGH E 3
		SIGH E 10
		{
		A_Fireprojectile("NNSpectralLightningBigBall1",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(20,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		}
		SIGH E 5
		stop
	Fire6:
		SIGH E 18 Bright
		{
		A_PlaySound("weapons/sigilcharge",CHAN_WEAPON,1.0,false,attn_norm,false);
		A_Light(2);
		}
		SIGH E 3 Bright A_GunFlash("Flash",0)
		SIGH E 10
		{
		A_Fireprojectile("NNSpectralLightningBigBall1",0.0,false,0.0,0.0,0,0.0);
		A_DamageSelf(20,"SIGIL",0,"none","none",aaptr_default,aaptr_null);
		A_PlaySound("weapons/sigilcharge",CHAN_WEAPON,1.0,false,attn_norm,false);
		A_Fireprojectile("NNSigil3AttackCounter",0.0,false,0.0,0.0,0,0.0);
		A_Fireprojectile("NNSpectralLightningH1",0.0,false,0.0,0.0,0,0.0);
		A_Fireprojectile("NNSigilLightningSpot",0.0,false,0.0,0.0,0,0.0);
		A_Fireprojectile("NNSigilLightningBigV",0.0,false,0.0,0.0,0,0.0);
		}
		SIGH E 5
		Goto Ready
	Flash:
		SIGF A 4 Bright A_Light(2)
		SIGF B 6 Bright A_Light(0x80000000)
		SIGF C 4 Bright A_Light(1)
		TNT1 A 0 A_Light(0)
		Stop
	Spawn:
		SIGL "#" -1 nodelay
		{
			return A_SetSpawnState(1,"Spawn1",true);
			return A_SetSpawnState(2,"Spawn2",true);
			return A_SetSpawnState(3,"Spawn3",true);
			return A_SetSpawnState(4,"Spawn4",true);
			return A_SetSpawnState(5,"Spawn5",true);
		}
		Stop
	Spawn1:
		"####" A -1
		Stop
	Spawn2:
		"####" B -1
		Stop
	Spawn3:
		"####" C -1
		Stop
	Spawn4:
		"####" D -1
		Stop
	Spawn5:
		"####" E -1
		Stop
	}
}

ACTOR NNSigil1 : NNSigil replaces sigil1 77
{
	game strife
	Inventory.Icon "I_SGL1"
	Weapon.spawnlevel 1
	ConversationID 196, 190, 194
}

ACTOR NNSigil2 : NNSigil replaces sigil2 78
{
	game strife
	Inventory.Icon "I_SGL2"
	Weapon.spawnlevel 2
	ConversationID 197, 191, 195
}

ACTOR NNSigil3 : NNSigil replaces sigil3 79
{
	game strife
	Inventory.Icon "I_SGL3"
	Weapon.spawnlevel 3
	ConversationID 198, 192, 196
}

ACTOR NNSigil4 : NNSigil replaces sigil4 80
{
	game strife
	Inventory.Icon "I_SGL4"
	Weapon.spawnlevel 4
	ConversationID 199, 193, 197
}

ACTOR NNSigil5 : NNSigil replaces sigil5 81
{
	game strife
	Inventory.Icon "I_SGL5"
	Weapon.spawnlevel 5
	ConversationID 200, 194, 198
}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: A new weapon spawn function

Post by Matt »

What would this do that can't be done in a custom ZScript function?

EDIT: Or even just a few well-placed A_JumpIf* calls... I had to check the date on the OP to make sure this wasn't some kind of forum glitch and I was seeing a post from 5 years ago or something
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

Re: A new weapon spawn function

Post by Ultimate Freedoomer »

Matt wrote:What would this do that can't be done in a custom ZScript function?

EDIT: Or even just a few well-placed A_JumpIf* calls... I had to check the date on the OP to make sure this wasn't some kind of forum glitch and I was seeing a post from 5 years ago or something
This would help in situations where you’d want to make an upgradeable weapon without creating entirely new actors. The main issue is recreating the "health value to determine spawn state" setup.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A new weapon spawn function

Post by Graf Zahl »

This is a hack, nothing more. The answee is 'no'.
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

Re: A new weapon spawn function

Post by Ultimate Freedoomer »

Graf Zahl wrote:This is a hack, nothing more. The answee is 'no'.
In what way is this a "Hack"?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A new weapon spawn function

Post by Graf Zahl »

In the way that it circumvents every established procedure to do such things.
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

Re: A new weapon spawn function

Post by Ultimate Freedoomer »

Graf Zahl wrote:In the way that it circumvents every established procedure to do such things.
Like I said: the main issue is that (as far as I know) no way of recreating the "health value spawn state" element of A_SelectPiece.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: A new weapon spawn function

Post by Nash »

You'll have to do it yourself in ZScript. The engine development's' general direction these days is, DECORATE won't be extended anymore for specific-case function requests like this.

Do note that a ZScript function can be called from DECORATE.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: A new weapon spawn function

Post by Matt »

Ultimate Freedoomer wrote:
Matt wrote:What would this do that can't be done in a custom ZScript function?
This would help in situations where you’d want to make an upgradeable weapon without creating entirely new actors. The main issue is recreating the "health value to determine spawn state" setup.
Searching "health" in the OP and looking more closely I see what the intention is, and I think the answer to my original question is no (scroll down to the cyberdemons).
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”