Zulk RS Posted December 31, 2016 I'm trying to make two custom armors; Grand Armor and Dark Armor to add to a wad. The grand armor is supposed to be a simply stronger version of the Blue armor. The dark armor is what's causing the problems. I want it work in this way: -It will give you 50 armor points on top of whatever you have like the armor bonuses. -If you have 200 armor, it will give you 250 armor. But if you pick it up first and have less than 200 armor, you won't be able to reach over 200 points without picking up another one. Picking up a normal (blue)armor will just get you up to 200. -It will replace whatever armor you're wearing. This is the code: Spoiler Actor GrandArmor : BlueArmor 20051 { Inventory.Pickupmessage "Picked up Grand Armor" Armor.SavePercent 70 Inventory.Icon "GARMA0" states { spawn: GARM A 6 GARM B 6 Bright Loop } } Actor DarkArmor : BasicArmorBonus 20052 { Inventory.Pickupmessage "Picked up Dark Armor" Armor.MaxSaveAmount 250 Armor.MaxBonus 50 Armor.MaxBonusMax 200 Armor.SavePercent 95 Armor.SaveAmount 50 Inventory.Icon "DARMA0" states { spawn: DARM A 6 DARM B 6 Bright Loop } } What happens is that when I pick up the dark armor, I can reach 250 by picking up blue armor. If I'm already wearing armor, the dark armor does not replace it. Can anyone help me implement this? 0 Share this post Link to post
scifista42 Posted December 31, 2016 Actor DarkArmor : CustomInventory 20052 { Inventory.Pickupmessage "Picked up Dark Armor" Inventory.Icon "DARMA0" states { spawn: DARM A 6 DARM B 6 Bright Loop pickup: TNT1 A 0 A_JumpIfInventory("BasicArmor",200,"pickup250") TNT1 A 0 A_GiveInventory("DarkArmorBonus") stop pickup250: TNT1 A 0 A_GiveInventory("DarkArmorPickup") stop } } Actor DarkArmorBonus : BasicArmorBonus { Armor.SavePercent 95.0 Armor.SaveAmount 50 Armor.MaxSaveAmount 200 } Actor DarkArmorPickup : BasicArmorPickup { Armor.SavePercent 95.0 Armor.SaveAmount 250 } 0 Share this post Link to post
Zulk RS Posted December 31, 2016 What does this part mean? pickup: TNT1 A 0 A_JumpIfInventory("BasicArmor",200,"pickup250") TNT1 A 0 A_GiveInventory("DarkArmorBonus") stop pickup250: TNT1 A 0 A_GiveInventory("DarkArmorPickup") stop 0 Share this post Link to post
scifista42 Posted December 31, 2016 Conditional branching, based on the player's current amount of armor points. Either, if the player had less than 200 armor points, the pickup would give him DarkArmorBonus but not DarkArmorPickup, or, if the player had 200 or more armor points, the pickup would give him DarkArmorPickup but not DarkArmorBonus. DarkArmorBonus would give him 50 points of the dark armor up to 200 armor points, and DarkArmorPickup would give him all dark armor up to 250 armor points. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 Okay. And what does the "TNT1 A 0" Stuff mean? 0 Share this post Link to post
scifista42 Posted December 31, 2016 "TNT1" is a special sprite name such that "TNT1 A" displays no sprite. "TNT1 A 0" displays no sprite for zero duration. The "pickup" states exist only to perform their action functions (A_JumpIfInventory / A_GiveInventory), not to display a visible animation. It's a sort of convention to use "TNT A 0" on such frames, but not a necessity. If a state has duration 0, it never displays any visible sprite anyway (so it doesn't matter which sprite name and letter you use), and the CustomInventory class is hardcoded to ignore state durations in its "pickup" state (behave as if they were 0 even if they're not 0), too. As I said, it's just a convention that, when a DECORATE modder defines states in which sprite names and letters don't matter, he typically sets the sprite names and letters to "TNT1 A" by default, simply because it's a generic name and possibly also because it makes these states stand out among normal animation frames whose appearance does matter. The engine certainly doesn't require "TNT1 A" to be used on those frames. Whether you use them or not, the actor's behavior in the game will be the same. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 I used the code and two problems occurred: When I pick it up, it just gives me full 250 instead of (50+whatever I have) dark armor. The sprite, once picked, up shows the blue armor instead of the dark armor 0 Share this post Link to post
scifista42 Posted December 31, 2016 Make sure to summon / spawn / give the player the item called just "DarkArmor", not DarkArmorBonus or DarkArmorPickup. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 I put the item DarkArmor in a test map. When I picked it up, it gave me 250 Dark Armor (It was working like that) but showed the sprite of the Blue Armor. It didn't give me (Whatever + 50) Dark Armor but straight up 250 Dark Armor. How do I do that? 0 Share this post Link to post
scifista42 Posted December 31, 2016 I've tested my code in both ZDoom and Zandronum and it behaves exactly as you described the intended behavior in the OP. Did you remove your previous definition of DarkArmor before pasting my definition of DarkArmor into your DECORATE? Are you using an up-to-date version of ZDoom? 0 Share this post Link to post
Zulk RS Posted December 31, 2016 scifista42 said:Did you remove your previous definition of DarkArmor before pasting my definition of DarkArmor into your DECORATE? Yes. 0 Share this post Link to post
scifista42 Posted December 31, 2016 Here is my own functional test wad. Start MAP01 and type "summon darkarmor" into the console, pick it up and see what happens. The armor pickup will look like an idling Imp because I didn't have your "DARM" sprites, and the armor icon will also be missing, but otherwise it should behave according to your description - it did so on my side. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 You're wad runs perfectly. I deleted the dark armor decorate and re-wrote it and it behaves properly now. However, when I pick it up, the inventory icon still looks like a mega armor even though it functions like the dark armor. 0 Share this post Link to post
scifista42 Posted December 31, 2016 My mistake. Move this line from the definition of DarkArmor:Inventory.Icon "DARMA0" Into the definitions of DarkArmorBonus and DarkArmorPickup. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 It now functions almost as it should. However, picking up the dark armor with armor points less than 200 results in getting more 50 points of existing armor but not dark armor. 0 Share this post Link to post
scifista42 Posted December 31, 2016 I see, it happens when the player already has another type of armor before picking up the dark armor. Unfortunately, it seems that armor bonuses are unable to replace armor type, and I could not find a way to work around that. 0 Share this post Link to post
Zulk RS Posted December 31, 2016 Interesting. Maybe I can just make it the most overpowered armor by giving it a fixed 250 armor points. It wasn't supposed to be found by the player outside of secrets. Is this a good idea? 0 Share this post Link to post
scifista42 Posted January 1, 2017 I think an armor with 250 points of 95% protection probably wouldn't be appropriate as a secret item, as the game's difficulty would change drastically depending on whether the player found it or not. I personally prefer maps with consistent medium difficulty, neither trivial nor impossible. If you could balance the map in such a way that its difficulty would become neither trivial nor impossible no matter if the player found the armor or not, it'd work well, otherwise almost certainly not. 0 Share this post Link to post
Empyre Posted January 1, 2017 To that end, how about making the dark armor absorb 66%? That would as much stronger than blue armor (50%) as blue armor is stronger than green armor (33%). The 250 points is fine. 0 Share this post Link to post
Zulk RS Posted January 2, 2017 The grand Armor already does something similar to that. It absorbs 70% damage and has 200 points What about reducing the dark armor to around 150? 0 Share this post Link to post
scifista42 Posted January 2, 2017 As I said, depends on the usage of the item more than its stats themselves. 0 Share this post Link to post