"How do I ZScript?"
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!)
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!)
-
- Posts: 1183
- Joined: Tue Jun 02, 2015 7:54 am
Re: "How do I ZScript?"
That seems like it would take a lot of time but still it is really amazing.
-
- 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: "How do I ZScript?"
Nobody said it was an example on ZScript's ease-of-use.ZZYZX wrote:Mmm, 1138 line tada... I wouldn't use that to persuade people into using ZScript really.
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
That thing is a really bad example because it had to replicate some shitty coding by Raven that was compounded by a horrendous conversion into classes by Randi. The ZScript version is just a 1:1 translation of the old C++ code with no attempt to make it easier to use (as that would most likely have broken the whole thing.)
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
How can I check, for example, if FastMonsters is currently in play? I see there's a SKILLP_FastMonsters constant, but I don't know how or where to apply this.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Did you manage to get this to work? If not, can you make a bug report, please? I don't have time to take a look at this currently and I feel this should be reported if it isn't workingVaecrius wrote: +usespecial does nothing whether I enable it or not.Code: Select all
class usetest:actor{ default{ +usespecial; +solid; } override bool used(actor user){ A_Log("YAY"); return false; } states{ spawn: BEXP B -1; stop; } }
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Code: Select all
class UseZombieMan : ZombieMan replaces ZombieMan
{
override bool Used(Actor user)
{
// supposed to kill the zombieman and give you health bonus
user.A_GiveInventory("HealthBonus", 1);
A_Die();
return true;
}
}
ALSO Vaecrius, I don't know if you practice this but I saw semicolons on your flags in the Default block. You don't need those. If you've been doing those, I'd remove them, they might break in future. Nothing in GZDoom uses semicolons for flags.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Bug has been fixed in c150f9d have fun stealth-killing the first 2 zombiemen in Doom 2 map01!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 5032
- Joined: Sun Nov 14, 2010 12:59 am
Re: "How do I ZScript?"
Unless I'm wrong, The SKILLP_* constants are used with the G_SkillProperty* functions, which return info about the skill property you pass.Ed the Bat wrote:How can I check, for example, if FastMonsters is currently in play? I see there's a SKILLP_FastMonsters constant, but I don't know how or where to apply this.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
Looks like you've got it, Blue Shadow. returns true if FastMonsters is in play. Simple as that! Thank you!
Code: Select all
G_SkillPropertyInt(SKILLP_FastMonsters)
-
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: "How do I ZScript?"
I gave up on it shortly after because what I wanted to use it for had some unfortunate side effects (e.g., the thing in question could be in front of a switch or door, preventing the player from using said switch/door).Nash wrote:Spoiler:Did you manage to get this to work? If not, can you make a bug report, please? I don't have time to take a look at this currently and I feel this should be reported if it isn't working
Major Cooke:
ZZYX suggested it and the wiki does occasionally contain wrong information.+usespecial does nothing whether I enable it or not.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
Well Nash found out it was completely broken from the getgo. Also, I wrote that wiki part. It actually does work. The function simply wasn't triggering like it was supposed to due to a bug in the engine.
-
-
- Posts: 10773
- Joined: Sun Jul 20, 2003 12:15 pm
Re: "How do I ZScript?"
So, it worked except for the fact that it didn't?
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
Meh, time contexts. Back then it didn't, it does now. I'm just pointing out that +USESPECIAL must not be on an actor if the Used function is to be utilized. I was also making sure everyone saw what the wiki on it, and I know it's correct because Graf's commit message said so.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
In case anyone's interested, I found a solution for my question from Page 1:
By giving A_RailAttack the RGF_EXPLICITANGLE flag, and setting the spread_z parameter to BulletSlope()-pitch, I now have a railgun that respects autoaim.
By giving A_RailAttack the RGF_EXPLICITANGLE flag, and setting the spread_z parameter to BulletSlope()-pitch, I now have a railgun that respects autoaim.