ZScript: Make monster give item to player. [UNRESOLVED/WIP]
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!)
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!)
-
Psychojack88
- Posts: 54
- Joined: Sat May 07, 2022 10:12 pm
- Graphics Processor: nVidia (Modern GZDoom)
ZScript: Make monster give item to player. [UNRESOLVED/WIP]
I am trying to make a monster give an item to the player during a state. Specifically an armor or health item. I know that I can make an item with A_HealThing to provide health but how do I make a monster "give" the player an item within ZScript? Anyone know how? Any help would be greatly appreciated. Thank you for any advice you can offer.
Last edited by Psychojack88 on Thu Oct 30, 2025 6:52 am, edited 1 time in total.
-
fakemai
- Posts: 419
- Joined: Mon Feb 12, 2018 12:26 am
- Location: Australia
Re: ZScript: Make monster give item to player. [UNRESOLVE/WIP]
There is a function GiveInventoryType that you can call for an actor or player unless you mean something like the Animal Crossing mod where she throws stuff at you in that case you can look at other stuff. I suggest rather than ask everything in here though that you look over the ZDoom wiki and other mods and see how different things work, and just play around with it a bunch. It will sometimes get frustrating admittedly but learning it is part of the fun. The other thing that helps a lot if keeping a copy of the GZDoom/UZDoom source code, in particular wadsrc/static/zscript has all of the actor definitions for everything in the game and also quite a few of the functions of more fundamental objects like actor and thinker, and even if it's a "native" one that's baked into GZDoom's engine it'll at least indicate what's available and what arguments it needs and you can look in src for how those work. A text search utility like grep is invaluable here.
-
Psychojack88
- Posts: 54
- Joined: Sat May 07, 2022 10:12 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: ZScript: Make monster give item to player. [UNRESOLVE/WIP]
Hey there FakeMai. Ah, I see. I'm pretty much going for GiveInventoryType, at least for now at my level, based on its wiki description. From the ZDoom wiki it sounds simple and straightforward which is what I'm looking for at this time. I can always upgrade later as I go and get better with the Zscript Syntax to fine-tune things up more.
The Isabelle mod is Decorate oriented and is indeed more specific, but at the moment I'm just trying to see how to simply get a monster to give the player health or amor via a state in Zscript for future proofing.
But it's true what you said, I have been recently taking a look at ZDoom wiki a bit more for Zscript specific syntax and have checked on the unofficial documentation on GitHub for more help. (This was because of a "Zscript command monster" feature I was looking into trying to put in. A lot of it seems very complex at the moment due to still being a starter with my first mod and not understanding all the proper combinations of special words, thinkers and event handlers, but I checked on DavidXNewton on YouTube and I think something like his basic tutorials sheds a much needed "Beginners Guide" that I was really lacking when it came to Zscript.
Thank you so much for telling me about the Greg utility and the wadsrc/static/zscript in the source code though. I think that alone would really help in general for working with this particular code and having a reference when actively experimenting with syntax.
Sorry if I seem to ask too many questions, there's just so much I want to do with this and I got a little excited.
Thank you again FakeMai though for your help and advice. I really appreciate it and I'll try to engage more with the wiki/mods/source code from here on.
The Isabelle mod is Decorate oriented and is indeed more specific, but at the moment I'm just trying to see how to simply get a monster to give the player health or amor via a state in Zscript for future proofing.
But it's true what you said, I have been recently taking a look at ZDoom wiki a bit more for Zscript specific syntax and have checked on the unofficial documentation on GitHub for more help. (This was because of a "Zscript command monster" feature I was looking into trying to put in. A lot of it seems very complex at the moment due to still being a starter with my first mod and not understanding all the proper combinations of special words, thinkers and event handlers, but I checked on DavidXNewton on YouTube and I think something like his basic tutorials sheds a much needed "Beginners Guide" that I was really lacking when it came to Zscript.
Thank you so much for telling me about the Greg utility and the wadsrc/static/zscript in the source code though. I think that alone would really help in general for working with this particular code and having a reference when actively experimenting with syntax.
Sorry if I seem to ask too many questions, there's just so much I want to do with this and I got a little excited.
Thank you again FakeMai though for your help and advice. I really appreciate it and I'll try to engage more with the wiki/mods/source code from here on.
-
fakemai
- Posts: 419
- Joined: Mon Feb 12, 2018 12:26 am
- Location: Australia
Re: ZScript: Make monster give item to player. [UNRESOLVED/WIP]
The DavidXNewton videos are a nice introduction, particularly if you might know a bit of coding but aren't familiar with OOP, it'll at least put a name to the important concepts that are the big draw of using ZScript over DECORATE. The HUD stuff might not be but on the other hand it'd be cute to display her status on the HUD, maybe even give different expressions depending on what she's doing. Just a thought! Where the ZDoom wiki and unofficial documentation is great is for the main ZScript pages since a short video tutorial series can't possbily go over all the exotic things in the language. It also has good albeit incomplete info on what flags and properties exist, as well as many of the more common functions, just make sure it's for ZScript and not ACS as some of the names overlap. Again, you will want to look at how some of the original virtuals are implemented.
All that said, there is no avoiding that it can often feel like dancing through a field of rakes, GZDoom is complex and all of the games it supports come with dozens of fun edge cases.
All that said, there is no avoiding that it can often feel like dancing through a field of rakes, GZDoom is complex and all of the games it supports come with dozens of fun edge cases.