Again, I need you guys to try and help me out with a little issue.
I have most of a custom armor system done, and there is only a small nitpick that I have to do:
Picking up an armor results in it giving the player an item, the player is triggering a script all the time. The script checks for the item and acts accordingly. However, for certain conditions (IE - you have three great armors and find one weak armor), you're still able to pick up the weak armor, even if it gives you nothing, practically wasting it. What I intend instead is that, somehow, the weak armor is left alone and you retain your greater armors. However, one of the methods I thought about solving is practically like an infinite loop - you keep collecting the inferior armor and it drops said armor again.
Is there any way I could have the inferior armor stay where it is and not be wasted, besides storing it in the player's inventory?
GS Elemental Armor system
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.
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.
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
GS Elemental Armor system
Last edited by Ryan Cordell on Sun Jan 25, 2009 9:16 am, edited 1 time in total.
Re: Armor System a-go.
I think this needs to take advantage of the pickup state return value, where if the credentials are not met (meaning the script executed with pickup can return a value of false), it drops through to the drop state and leaves the armor where it lies. All the script has to do is use SetResultValue. The specifics of it are all going to depend on how your internal system is built. However, I'd start by looking in this direction.
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: Armor System a-go.
Actually, I do have ACS_ExecuteWithResult (It's however executed in the player actor.) and SetResultValue is set in the ACS script itself. I actually have it set that within the script, if the value is NOT met, SetResultValue sets out a FALSE value. However, I'm not sure how the actor itself would check for that value. Does DECORATE have such a method?
Re: Armor System a-go.
From the wiki:
It looks like if you put ACS_Executewithresult in the pickup state and have the SetResultvalue return 0, the pickup state will be marked as unsuccessful. However, I;m a little unsure of how to handle thing from there. I recommend an a_JumpIf statement where you can evaluate the result and make state modifications accordingly.All code pointers in the Pickup state sequence are called when the item is being picked up. The sequence is successful when either a function is called which doesn't return success or a function which is capable returns successful execution is called (you can also use ACS_ExecuteWithResult to set the result from ACS). Success can be overridden by terminating the state sequence with fail instead of stop.
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: Armor System a-go.
Okay, I have the items use ACS_Execute, and I can have GiveActorInventory be used instead of GiveInventory. However, now with A_JumpIf(ACS_Execute(265,0) == 0, "Spawn") being used in the Pickup state, eh.. I dunno. Kind of frustrating, but still fun.
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
Re: Armor System a-go.
Okay, an update..
I got the script working almost 100%, except for one detail:
If you pick up, say, the Fire Armor before you pick up the Super Armor, then you can't pickup the Super Armor and are stuck with the Fire Armor until you deplete it. (And making all those armors act like ZDoom's? Well, that's another challenge. ;P)
Elemental armors code -
I got the script working almost 100%, except for one detail:
If you pick up, say, the Fire Armor before you pick up the Super Armor, then you can't pickup the Super Armor and are stuck with the Fire Armor until you deplete it. (And making all those armors act like ZDoom's? Well, that's another challenge. ;P)
Elemental armors code -
Spoiler:Armor system ACS code -
Spoiler: