ZScript Documentation

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Documentation

Post by Graf Zahl »

For that you need to call self.AngleTo(X).
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: ZScript Documentation

Post by kodi »

Is there a way to make pitch and yaw input not affect the playerpawn in szcript? Other than constantly turning "against" it with getplayerinput.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Documentation

Post by Major Cooke »

You'd have to basically freeze the player and rely solely on GetPlayerInput in that regard. Two of them: one for pitch and one for yaw.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: ZScript Documentation

Post by kodi »

So I'd have to freeze the player completely and re-implement all movement, shooting, reloading etc. with GetPlayerInput then? Would be inconvenient, but should at least solve the rendering interpolation issues with the "turn-against" method.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Documentation

Post by Major Cooke »

Just dont expect it to be very compatible with mods that rely on PROP_(TOTALLY)FROZEN.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: ZScript Documentation

Post by kodi »

Major Cooke wrote:Just dont expect it to be very compatible with mods that rely on PROP_(TOTALLY)FROZEN.
Well it's for improving the custom movement system in a gameplay mod (doomshock), so support for heavily scripted maps is not something I'm particularly concerned about :) Thanks for the help.

By the way, could there be a zscript topic on the wiki where people can post general code examples (experimental or not)?
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: ZScript Documentation

Post by D2JK »

double AngleTo(Actor target, bool absolute = false);

What is the boolean option supposed to do here? I tried enabling and disabling it, but couldn't notice any difference.

I was hoping unsetting it would make the function return the relative angle towards the target:
Spoiler:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Documentation

Post by Graf Zahl »

These functions are portal-aware. If you set absolute to true it won't factor in portal offsets. In some cases this may be necessary.
User avatar
Matt
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: ZScript Documentation

Post by Matt »

I've been staring at the Structs page for a while now and I am still completely baffled as to what use it could possibly have. The example shows the grammar but it is completely useless in demonstrating its significance. (The one thing I could imagine doing, setting virtual functions across actors that do not inherit from a common custom actor, cannot be done.)

A lot of the DECORATE examples are really good about this: "this function causes this to happen. Here's an example of an imp that calls it twice to spin around on the spot 3 times before exploding..." You didn't even need to look at the description, the example alone could show what it could do and why.

It would be great if someone could add something like that to this page.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Documentation

Post by Major Cooke »

Ya know, it'd be a real lovely treat if other people could work on helping out... I have very little time to work on the documentation right now.

That example was written before functions could be inserted.

Also, it wouldn't hurt to learn a bit of C++/Java, Vaecrius. That'll teach you how to use structs. There's a link right on that wiki page.
User avatar
Caligari87
Admin
Posts: 6191
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him

Re: ZScript Documentation

Post by Caligari87 »

https://zdoom.org/wiki/Controlling_dynamic_lights

There's something on this page I really don't get:
The MISSILEEVENMORE flag has a special use for dynamic lights. When present, it enables the subtractive mode.
I mean, what the hell? How does that make any sense?

8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Documentation

Post by Graf Zahl »

Remember, this is from a time when DECORATE wasn't that configurable, roughly 2006 or so. So I chose 3 flags that had no meaning for dynamic lights and repurposed them for some features I wanted settable in DECORATE.
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: ZScript Documentation

Post by Gez »

Are you going to try to make dynamic lights that attack players? Because that'd be weird (and honestly you could have that effect by attaching a dynamic light to an invisible actor).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Documentation

Post by Graf Zahl »

Dynamic lights cannot act as regular actors because they adjust their radius to their light size. Don't even try. In fact, ADynamicLight should proably demoted to a thinker instead of a real actor and also use attachment to handle the light map things.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Documentation

Post by Major Cooke »

If you change it, can you give us an example on how to attach it, please?

Return to “Tutorials”