Armor Regenerating Sector?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, 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.
Post Reply
User avatar
P.Rex
Posts: 54
Joined: Sun May 15, 2016 12:32 pm
Preferred Pronouns: She/Her
Contact:

Armor Regenerating Sector?

Post by P.Rex »

I'm trying to have a certain sector on a map that functions similarly to the "healing sector", but with armor. i.e: When the player stands inside this sector, armor will regenerate at a rate of 1 unit per second until reaching 100%, and only when inside said sector.
How do I pull this off? I couldn't find a way to attach an ACS script to a sector like you can to a linedef...
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Armor Regenerating Sector?

Post by ReX »

1. Use a ZDooM thing known as "Actor Enters Sector".
2. Assign an ACS script to that thing.
3. Set up your script to give the player armor while s/he is in the sector.
4. Set up your script to keep giving armor points until the player has reached the max.
5. Set up another script for the lines that surround the sector.
6. Set up that script to suspend the first script when the player leaves the sector.

Here is an example for health, but you can easily replace the health parameters for armor. [Please note that this example requires the player's feet to touch the ground in the relevant sector. You can set yours up differently.]:
Spoiler:
User avatar
P.Rex
Posts: 54
Joined: Sun May 15, 2016 12:32 pm
Preferred Pronouns: She/Her
Contact:

Re: Armor Regenerating Sector?

Post by P.Rex »

Thanks. I've tweaked your code a bit and after a lot of trial and error came up with the following:

Code: Select all

int maxhealth1=100;
int ExitPool1;
Script 9 (void)

{
      if(GetArmorInfo(ARMORINFO_SAVEAMOUNT)<100 && !ExitPool1)
      {   GiveInventory("ArmorBonus", 1);
         delay(5);
         maxhealth1-=1;
      }
      delay(5);
      restart;
}

Script 10 (void)   //Armor Regeneration stops when player "exits" pool & resumes when player "re-enters" pool

{
   if(LineSide() == LINE_FRONT)
   {   ExitPool1 = 1;
      ACS_Suspend(9, 0);      //Ensures regen effect doesn't start when player simply re-crosses the line
                        //I.e., it requires player to step into pool, feet touch bottom for regen
   }
   else
   {   ExitPool1 = 0;
   }
}
There is a problem, though. When the player enters the sector, one armor point is given, and nothing more. The process does not repeat. Exiting and reentering the sector doesn't retrigger the script, either. What am I doing wrong here?
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Armor Regenerating Sector?

Post by Apeirogon »

You need only an ACS solution?
User avatar
P.Rex
Posts: 54
Joined: Sun May 15, 2016 12:32 pm
Preferred Pronouns: She/Her
Contact:

Re: Armor Regenerating Sector?

Post by P.Rex »

I prefer to keep in in ACS, yes. Unless there's a simpler alternative.
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Armor Regenerating Sector?

Post by ReX »

I have a feeling this statement is what is causing you the problem:

Code: Select all

if(GetArmorInfo(ARMORINFO_SAVEAMOUNT)<100
At any rate, I have created and attached an example wad that works in the way you described you wanted.

And here is the ACS code:
Spoiler:
ArrmorTst.wad
Example wad: Give Armor
(1.58 KiB) Downloaded 56 times
User avatar
P.Rex
Posts: 54
Joined: Sun May 15, 2016 12:32 pm
Preferred Pronouns: She/Her
Contact:

Re: Armor Regenerating Sector?

Post by P.Rex »

Nope. I tested your map as well as your script on my map. In both cases I still got only one armor point.
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Armor Regenerating Sector?

Post by ReX »

P.Rex wrote:I tested your map .... I still got only one armor point.
I've tested the map with GZDooM, LZDooM, and ZDooM. In each case the scripts work just as intended. So I'm not sure why it doesn't work when you test my map.

As for why the scripts don't work in your map, I couldn't tell you without checking your map. [But, to be honest, I doubt I'll be able to figure things out, considering that you're implementing scripts that work for me.]

Are you using any DECORATE/ZScript actors or functions that could be over-riding the armor scripts? [But that wouldn't explain why you can't get the scripts to work when you test my map.]

Would someone else test my map to ensure the scripts are working as intended?
User avatar
Kappes Buur
 
 
Posts: 4166
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Armor Regenerating Sector?

Post by Kappes Buur »

ReX wrote:Would someone else test my map to ensure the scripts are working as intended?
I added a green armor to the map so that I could see the regeneration happening and a rocket launcher to easily inflict splash damage.
Spoiler:
Your map works as advertised.
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Armor Regenerating Sector?

Post by ReX »

Kappes Buur wrote:Your map works as advertised.
Thanks for checking the map, KB.

Any theories why P.Rex is unable to see the effect at work, even while playing my example map?
User avatar
Kappes Buur
 
 
Posts: 4166
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Armor Regenerating Sector?

Post by Kappes Buur »

ReX wrote: Any theories why P.Rex is unable to see the effect at work, even while playing my example map?
I cannot think of any reason at all.

I had no problem seeing the counter in any of the G/ZDoom versions, or playing the map from within a few editors, DB1, DB2 to UDB, Eureka, Deepsea.
User avatar
P.Rex
Posts: 54
Joined: Sun May 15, 2016 12:32 pm
Preferred Pronouns: She/Her
Contact:

Re: Armor Regenerating Sector?

Post by P.Rex »

This is getting creepy. I've even tried updating my GZDoom to the latest version (it was 3.7.2. previously) and still no change in performance. I have no idea why it would happen...
At any rate, I'm still gonna use ReX's script for my map since it would still work for players. I do hope at some point in the future GZDoom Builder would have a dedicated sector type for armor regen similar to the healing sector, to make things easier.
User avatar
Kappes Buur
 
 
Posts: 4166
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Armor Regenerating Sector?

Post by Kappes Buur »

P.Rex wrote:This is getting creepy. I've even tried updating my GZDoom to the latest version (it was 3.7.2. previously) and still no change in performance. I have no idea why it would happen...
Are you now using the latest official GZDoom v4.4.2 ?

P.Rex wrote:At any rate, I'm still gonna use ReX's script for my map since it would still work for players.
Can you upload your map?

P.Rex wrote:I do hope at some point in the future GZDoom Builder would have a dedicated sector type for armor regen similar to the healing sector, to make things easier.
Your are out of luck on that point. GZDoom Builder has not been worked on in years. The latest iteration is Ultimate Doom Builder.

2 questions, out of curiosity:

1. Are you sure that you do not activate the counter when you step into that sector?

[imgur]https://i.imgur.com/VSd3R57[/imgur] or [imgur]https://i.imgur.com/YyMRSm1[/imgur]

depending on the hud chosen. The armor count will go up to 100.

2. When you updated GZDoom, did you let GZDoom generate a new ini file by either installing into a new folder or by deleting the old ini file first?
Post Reply

Return to “Mapping”