Armor dont protect after "repairing"

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
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Armor dont protect after "repairing"

Post by Apeirogon »

I create starting armor which give very little protections, but "repair" itself.
But after completely destroing such armor, and when it repair itself back, it stop allow any protections. This happens only with armor.savepercent and only if armor was depleted by attack, not taken from console.

Summon monya. Use only with budda cheats.
zscript.txt
(1.7 KiB) Downloaded 31 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Armor dont protect after "repairing"

Post by Graf Zahl »

Moving to the "scripting" forum.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Armor dont protect after "repairing"

Post by Apeirogon »

I didnt express myself well. This definitely a bug.

Because after depleting, and adding to this depleted armor some numbers of "durability" in way

Code: Select all

		let first = Owner.FindInventory("BasicArmor", true); console.printf("assigned");
		if (first != null)
		{
			let armor = BasicArmor(first); console.printf("found");
			if (armor != null)
				{
					armor.amount += 1; console.printf("add");
				}
		}

armor dont work properly, if it using armor.savepercent property. It still exist in inventory, can be increased with armor bonus, but it dont absorb any damage.
Kotti
Posts: 86
Joined: Tue Dec 27, 2016 4:08 am

Re: Armor dont protect after "repairing"

Post by Kotti »

If I understand this correctly, depleted armor does not have any SavePercent. You are just adding to the amount but fail to validate the SavePercent setting. If you pick up some armor bonus while the armor has been depleted it will completely reinitialize the BasicArmor. You should do the same.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Armor dont protect after "repairing"

Post by Apeirogon »

But it work if armor use armor.maxfullabsorb, or how there name?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Armor dont protect after "repairing"

Post by Graf Zahl »

Sorry, it looks like my initial response got lost somehow.

I moved this to "Editing" because this isn't a bug. You are not supposed to manipulate the BasicArmor item yourself, the expected mode of operation is that it gets replenished by BasicArmorPickup and BasicArmorBonus items.
Post Reply

Return to “Scripting”