[No] A new weapon spawn function

Moderator: GZDoom Developers

A new weapon spawn function

Postby Ultimate Freedoomer » Mon Sep 30, 2019 4:13 pm

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 allExpand view
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
}
Ultimate Freedoomer
 
Joined: 30 Jan 2015
Location: Pittman Center
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh

Re: A new weapon spawn function

Postby Matt » Mon Sep 30, 2019 4:35 pm

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
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: A new weapon spawn function

Postby Ultimate Freedoomer » Mon Sep 30, 2019 4:45 pm

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.
Ultimate Freedoomer
 
Joined: 30 Jan 2015
Location: Pittman Center
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh

Re: A new weapon spawn function

Postby Graf Zahl » Tue Oct 01, 2019 12:13 am

This is a hack, nothing more. The answee is 'no'.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A new weapon spawn function

Postby Ultimate Freedoomer » Tue Oct 01, 2019 1:41 am

Graf Zahl wrote:This is a hack, nothing more. The answee is 'no'.
In what way is this a "Hack"?
Ultimate Freedoomer
 
Joined: 30 Jan 2015
Location: Pittman Center
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh

Re: A new weapon spawn function

Postby Graf Zahl » Tue Oct 01, 2019 1:48 am

In the way that it circumvents every established procedure to do such things.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A new weapon spawn function

Postby Ultimate Freedoomer » Tue Oct 01, 2019 2:06 am

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.
Ultimate Freedoomer
 
Joined: 30 Jan 2015
Location: Pittman Center
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh

Re: A new weapon spawn function

Postby Nash » Tue Oct 01, 2019 2:32 am

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
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: A new weapon spawn function

Postby Matt » Tue Oct 01, 2019 6:58 pm

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).
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest