Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
int armoruse;
script 12 (void)
{
int armorspill;
if (CheckInventory("HEVSuit") < 100)
{
armoruse++;
if (armoruse < 6)
{ GiveInventory("HEVCharge", 10);
if (CheckInventory("HEVSuit") > 100)
{
armorspill = CheckInventory("HEVSuit") - 100;
TakeInventory("HEVCharge", armorspill);
}
}
if (armoruse == 5)
{ setlinetexture (5, SIDE_FRONT, TEXTURE_TOP, "XARMOR02");
}
}
}
So, first about the HEVBattery:
1. In its current definition I can pick it up even when I have 100% armor (i.e., I have picked up the HEVSuit before picking up the HEVBattery). -ALWAYSPICKUP doesn't seem to solve the problem.
2. I changed it from BasicArmorBonus to BasicArmorPickup. This only allowed me to pick it up if I did not already have the HEVSuit on. If I had the HEVSuit on, took damage, and tried to pickup up the HEVBattery I wouldn't be able to pick it up. This is obviously working like DooM's hierarchy for blue armor and green armor, but I don't know why.
Now, about the HEVCharge delivered via the script.
1. No matter what I alter and vary, the device will continue to be "used" (i.e., wasted) in a similar fashion to the way the Medic Station would waste health when used by a player with 100% health.
2. I tried the script verbatim from Dark Fox's script, above, but it did not make a difference.
3. I tried changing the HEVCharge type from BasicArmorPickup to BasicArmorBonus, and it gave me 1 unit of armor, then wasted the rest.
Dark Fox, any chance you can work your magic again. [Or HotWax, Isle, and others - work your magic for the first time here.] Thanks.
Right now, I'm just sitting dumbfounded as to why shit's not working. O_o;;
I need to run some tests on my end and see what works and what doesn't. I work a bit better that way; the health station script was a fluke.
EDIT: I found some problems with the DECORATE but I need to confirm my fixes first before bringing it out here.
Project Dark Fox wrote:I need to run some tests on my end and see what works and what doesn't. I work a bit better that way; the health station script was a fluke.
EDIT: I found some problems with the DECORATE but I need to confirm my fixes first before bringing it out here.
Very good. I'll stand by.
Menawhile, I was thinking that such a (IMO) simple thing ought not to require so much trial and error. I am still learning the ropes of DECORATE definitions, but I'm generally not a slow learner and this thing has been plaguing me for a while. Maybe it is meant to be a matter of finding the solution by a fluke. Heh.
actor HEVSuit : BasicArmorPickup 31000
{
inventory.pickupmessage "Picked up the HEV Suit!"
inventory.icon "ARM2A0" // Change your icon here, MegaArmor was used as place-holder.
armor.saveamount 100
armor.savepercent 50
// armor.maxfullabsorb 25
states
{
Spawn:
ARM2 A 3 //Placeholder.
loop
}
}
actor HEVbattery : BasicArmorBonus 31001
{
Radius 4
Height 12
-ALWAYSPICKUP
inventory.pickupmessage "Picked up battery pack for HEV Suit!"
armor.saveamount 15
armor.savepercent 50
armor.maxsaveamount 100 // Here's a change. I thought it was inventory.maxamount, but my own project led me to believe otherwise. This is it.
// inventory.icon "ARM2A0" // Placeholder.
states
{
Spawn:
BON2 ABCDCB 4 // Placeholder.
loop
}
}
actor HEVCharge : HEVBattery // I inherited from the Battery to save us some lines and make things that much easier.
{
armor.maxsaveamount 100
armor.saveamount 1 // Script below works with this as 1.
-ALWAYSPICKUP
}
int armoruse;
script 12 (void)
{
if (CheckInventory("Armor") < 100) // Yeah. Armor. Not HEVSuit. Go figure.
{
armoruse++;
if (armoruse < 6)
GiveInventory("HEVCharge", 10); // Late EDIT: Now that maxes work properly, the spill over removal is not necessary.
if (armoruse == 5)
{ setlinetexture (5, SIDE_FRONT, TEXTURE_TOP, "SP_HOT1"); // Replace the texture with the one you need, this is an artifact of the testing.
}
}
}
ReX wrote:I was thinking that such a (IMO) simple thing ought not to require so much trial and error.
I test the shit out of everything I do. With me around, ANYTHING can break!
EDIT: Changed the script. With the max amounts working properly, the spill-over removal was no longer necessary (And I think that portion of the script wasn't working in the first place!).
EDIT2: Even I learned something out of this. When checking your player's inventory for armor, it's simply CheckInventory("Armor").
One minor point. In my code for the HEVBattery I have a Spawn state for a model, and I notice you've set up HEVCharge to inherit from the HEVBattery (and deleted the TNT1 reference). I'm guessing that this shouldn't make a difference. I'm off to try it out both ways.
Incidentally, I did originally have armor.maxsaveamount 100 in the HEVBattery definition, but when I changed the actor's type from BasicArmorBonus to BasicArmorPickup GZDooM gave me an error message for armor.maxsaveamount so I deleted the line. Then I either forgot to put it back in when I changed the type, or didn't think it was important.
EDIT: Yessss!!!! It workssssss! (Okay, I'll cut out the Gollum-speak now.) But many, many thanks to you, Dark Fox.
ReX wrote:One minor point. In my code for the HEVBattery I have a Spawn state for a model, and I notice you've set up HEVCharge to inherit from the HEVBattery (and deleted the TNT1 reference). I'm guessing that this shouldn't make a difference. I'm off to try it out both ways.
It will not make a difference if it won't be seen. I did take this into account, hence the minimalist approach to the inheritance.
Incidentally, I did originally have armor.maxsaveamount 100 in the HEVBattery definition, but when I changed the actor's type from BasicArmorBonus to BasicArmorPickup GZDooM gave me an error message for armor.maxsaveamount so I deleted the line. Then I either forgot to put it back in when I changed the type, or didn't think it was important.
That explains that...
EDIT: Yessss!!!! It workssssss! (Okay, I'll cut out the Gollum-speak now.) But many, many thanks to you, Dark Fox.