Armor Regenerating Sector?
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.
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.
Armor Regenerating Sector?
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...
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...
Re: Armor Regenerating Sector?
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.]:
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:
Re: Armor Regenerating Sector?
Thanks. I've tweaked your code a bit and after a lot of trial and error came up with the following:
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?
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;
}
}
Re: Armor Regenerating Sector?
You need only an ACS solution?
Re: Armor Regenerating Sector?
I prefer to keep in in ACS, yes. Unless there's a simpler alternative.
Re: Armor Regenerating Sector?
I have a feeling this statement is what is causing you the problem:
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:
Code: Select all
if(GetArmorInfo(ARMORINFO_SAVEAMOUNT)<100
And here is the ACS code:
Spoiler:
Re: Armor Regenerating Sector?
Nope. I tested your map as well as your script on my map. In both cases I still got only one armor point.
Re: Armor Regenerating Sector?
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.P.Rex wrote:I tested your map .... I still got only one armor point.
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?
- 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?
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.ReX wrote:Would someone else test my map to ensure the scripts are working as intended?
Spoiler:Your map works as advertised.
Re: Armor Regenerating Sector?
Thanks for checking the map, KB.Kappes Buur wrote:Your map works as advertised.
Any theories why P.Rex is unable to see the effect at work, even while playing my example map?
- 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?
I cannot think of any reason at all.ReX wrote: Any theories why P.Rex is unable to see the effect at work, even while playing my example map?
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.
Re: Armor Regenerating Sector?
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.
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.
- 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?
Are you now using the latest official GZDoom v4.4.2 ?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...
Can you upload your map?P.Rex wrote:At any rate, I'm still gonna use ReX's script for my map since it would still work for players.
Your are out of luck on that point. GZDoom Builder has not been worked on in years. The latest iteration is Ultimate Doom Builder.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.
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?