ZScript Discussion
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!)
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
The slope setter should set a new plane equation for a sector, how this is derived should be up to the script programmer, as there's a vast possibility of how this can be done. You already have full access to the vertex and linedef data, so a lot should be doable, aside from making a controlled update to the sector. That part will require a native function. And for gradually altering slopes it will also require a slope interpolation object so that it gets smoothed for high FPS.
-
Major Cooke
- Posts: 8221
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Ah, is that the opengl renderer update function that needs the native function?
Because I have no idea what else I'm supposed to do to make those two functions...
Because I have no idea what else I'm supposed to do to make those two functions...
-
Nash
-

- Posts: 17512
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
I just used this feature - actually I don't even consider this hacky, I happened to run into a situation where I wanted an actor to run some functions every single time the level is re-entered and checking against a transient bool at the very start of their Tick() is perfect for my needs. Thanks for this feature, Graf!ZZYZX wrote:So we can now detect savegame loading by transient variable suddenly becoming null :twisted:
-
NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
Re: ZScript Discussion
IOW I'd have to use a workaround. Personally, if I'm going to do that, I'd rather set default SpawnHealth absurdly high and manage the cap manually. (Probably via a local property and a quick check inside its think routine.) That way I can at least use HealThing et al.Major Cooke wrote:You'll have to set that up in PostBeginPlay. Currently you cannot change the spawn health.
A "fire and forget" method to modify its SpawnHealth would still be preferable.
-
Nash
-

- Posts: 17512
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
Graf: I know you already explained why extending Actor is impossible at the moment but is there any plan to make this possible eventually... even if it's of low priority?
I'm already running into situations where the only sane way is to extend Actor. For example, to add functionality to every monster with minimal workarounds.
I'm already running into situations where the only sane way is to extend Actor. For example, to add functionality to every monster with minimal workarounds.
-
Major Cooke
- Posts: 8221
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
@Neural: I have yet to hear from Graf himself if that even will become a thing, but I doubt it will happen since that could cause issues.
@Nash: "For the moment" being the key word. He never said it was out the door.
@Nash: "For the moment" being the key word. He never said it was out the door.
-
ZzZombo
- Posts: 333
- Joined: Mon Jul 16, 2012 2:02 am
Re: ZScript Discussion
You can use subclasses of PlayerPawn for monsters with dynamic health pool. Just never let players spawn as one such class.
Last edited by ZzZombo on Wed Jan 18, 2017 9:16 pm, edited 1 time in total.
-
Agentbromsnor
- Posts: 265
- Joined: Wed Mar 28, 2012 2:27 am
Re: ZScript Discussion
I have the same issue with my player class in ZScript; it looks jittery ever since I added a Y restriction using "override void Tick(void)".Xaser wrote:Tick() only gets called 35 times a second (it's one Tick per Tic); from a quick look through Major Cooke's fixed version of TZK's camera stuff,my guess is that you can achieve smoothness by updating the spawned object's 'vel' (velocity) property to get it to move between tics. MC would be the best confirminator here; can't really play with it myself at present.
Will this perhaps get changed later on in ZScript's development?
-
Major Cooke
- Posts: 8221
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Right here, Agent.The Zombie Killer wrote:Already available hereMajor Cooke wrote:However, I suggest you drag TheZombieKiller in here to post his even more recently revised one as that one takes care of some further issues which mine had.
-
Nash
-

- Posts: 17512
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
To elaborate and with minimal example:
You have to apply the velocity of the positioner's (player) to the positionee (thing to attach to the player), PLUS some buffer velocity (offset) to compensate for the player's velocity; without the latter, the positionee will appear to "lag" or "move forward" in the positioner's direction (even though it will be smooth and won't jitter anymore).
I'll see if I can put together a minimal demo later when I have time.
You have to apply the velocity of the positioner's (player) to the positionee (thing to attach to the player), PLUS some buffer velocity (offset) to compensate for the player's velocity; without the latter, the positionee will appear to "lag" or "move forward" in the positioner's direction (even though it will be smooth and won't jitter anymore).
I'll see if I can put together a minimal demo later when I have time.
-
ZZYZX
-

- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: ZScript Discussion
https://github.com/coelckers/gzdoom/pull/223 this regarding the discussion few pages ago on GL structures and actors not updating properly after a slope change. Posting here so I don't have to check github for Graf's comments 
(edit: had to check anyway. zzz)
(edit: had to check anyway. zzz)
-
Major Cooke
- Posts: 8221
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Speaking of these changes... Perhaps it might be a good time to look into allowing overlays on actors other than player pawns? Nothing to deal with weapons per se -- if you look at Zombie's mod, that crosshair is an overlay with the player being the actual camera, a rather severe hack at that...
He can't open doors for example.
He can't open doors for example.
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Bad timing for that.
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Here's a number some may find interesting. After scriptifying much of the Inventory class, I added a scripted method of Inventory.tick, to see how much the VM would cost if called frequently.
I chose ZDCMP2 as a test map because it has roughly 1000 placed inventory items. The scripted Tick function didn't do anything except calling the super method.
This increased per-frame execution time by 0.15 milliseconds on my 3.4 GHz Core i7, adding 750 VM calls. What's also interesting is that running the VM isn't much of a problem, but function calls cost a lot of time. Well, at the moment this needs huge maps to cause an issue, for ZDCMP the increase was less than 3% of the entire time spent in the playsim, so it wasn't particularly troubling.
And if all else fails using aJIT compiler may always remain an option.
I chose ZDCMP2 as a test map because it has roughly 1000 placed inventory items. The scripted Tick function didn't do anything except calling the super method.
This increased per-frame execution time by 0.15 milliseconds on my 3.4 GHz Core i7, adding 750 VM calls. What's also interesting is that running the VM isn't much of a problem, but function calls cost a lot of time. Well, at the moment this needs huge maps to cause an issue, for ZDCMP the increase was less than 3% of the entire time spent in the playsim, so it wasn't particularly troubling.
And if all else fails using aJIT compiler may always remain an option.
-
Xaser
-

- Posts: 10774
- Joined: Sun Jul 20, 2003 12:15 pm
Re: ZScript Discussion
Well, that doesn't suck at all. 
A second stress test may be putting together a wad which Replaces all Doom monsters with ones which override Tick() and then load up a slaughtermap. I bring this up because I'm planning on doing exactly that for a thing. Welp.
A second stress test may be putting together a wad which Replaces all Doom monsters with ones which override Tick() and then load up a slaughtermap. I bring this up because I'm planning on doing exactly that for a thing. Welp.