"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!)
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
Why do you feel the need to cheat with sprite names? Even when using just letters and numbers you have 1679616 distinct sprite names available.
There's just no need to add such hacks to the engine.
There's just no need to add such hacks to the engine.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
While I am not justifying kodi's hack attempt, the answer to that question is simple, really: for organizing and readability purposes, using long filenames is 100000x easier to work with than cryptic 4-letter abbreviations.Graf Zahl wrote:Why do you feel the need to cheat with sprite names? Even when using just letters and numbers you have 1679616 distinct sprite names available.
There's just no need to add such hacks to the engine.
"human - caucasian - body - walking001 - 0.png" is much easier to identify than "HCBAA0.png". :P
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: "How do I ZScript?"
Everything in the project is animated in 35 fps to allow walking-while-firing frames in a custom chase state, and also to govern frame duration for everything with A_SetTics and time factor lookup. Sprite names and frame numbers are chosen from an array each tick as well depending on a variable that represents where the character is in a particular frame cycle, so everything is primed for global or localized speeding up or slowing down of time.
TL;DR: lots of frames, lots of four letter words abbreviations. Nevermind the proposed hack, I'll manage with aspirin
TL;DR: lots of frames, lots of four letter words abbreviations. Nevermind the proposed hack, I'll manage with aspirin
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
Sorry, but the sprite system is not fixable without breaking it.
-
- Posts: 13791
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: "How do I ZScript?"
And breaking it certainly would not be fixing it, in the strictest sense of the word.
Sorry, I just had to put that in there... don't mind me... >_>
Sorry, I just had to put that in there... don't mind me... >_>
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
I didn't want to explicitly state the conundrum here...
-
- Posts: 2432
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: "How do I ZScript?"
If you really need long filenames you could use TEXTURES
-
- 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?"
Saving everything as sprite sheets and then parsing them with TEXTURES [EDIT: and realizing I can (a) add comments to my TEXTURES lump and (b) leave TEXTURES open in a background window that stays visible next to my working ZScript file] has been such a headache-saver for me...
Last edited by Matt on Tue Oct 10, 2017 5:40 pm, edited 1 time in total.
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: "How do I ZScript?"
Since I'm setting the sprites with zscript functions anyway, I'll be using some form of nicer name reference/lookup table or whatever.
-
- Posts: 20
- Joined: Sat Oct 14, 2017 5:49 pm
Re: "How do I ZScript?"
It seems the projectile pitch doesn't change while flying, but only angle. So i want to know how to find projectile's momentum pitch in zscript?
I saw flag PITCHFROMMOMENTUM from modeldef, it actually find pitch of projectile, but how get that pitch in zscript?
I saw flag PITCHFROMMOMENTUM from modeldef, it actually find pitch of projectile, but how get that pitch in zscript?
Code: Select all
projectile.angle //works
projectile.pitch //equals to 0
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: "How do I ZScript?"
ZoDX32 wrote:It seems the projectile pitch doesn't change while flying, but only angle. So i want to know how to find projectile's momentum pitch in zscript?
Code: Select all
override void PostBeginPlay()
{
A_SetPitch(-atan2(vel.z,sqrt((vel.x*vel.x) + (vel.y*vel.y))));
Super.PostBeginPlay();
}
-
- Posts: 20
- Joined: Sat Oct 14, 2017 5:49 pm
Re: "How do I ZScript?"
OMG Big Thanks!!! I wanna say this is i do for collision code with CanCollideWith()
here PRE-Results:
with your pitch find algorythm, i think i can do precise collision of Sphere(basketball) with Circle(ring) in zscript!
p.s.:sry for img size, i thought i sent small size when i saw img post on discord(
here PRE-Results:
with your pitch find algorythm, i think i can do precise collision of Sphere(basketball) with Circle(ring) in zscript!
p.s.:sry for img size, i thought i sent small size when i saw img post on discord(
Last edited by ZoDX32 on Sun Oct 15, 2017 3:23 am, edited 2 times in total.
-
- Posts: 20
- Joined: Sat Oct 14, 2017 5:49 pm
Re: "How do I ZScript?"
Also how to find vector pitch from invoker actor to another actor?
-
- Posts: 2383
- Joined: Thu Feb 11, 2016 9:59 am
Re: "How do I ZScript?"
Please read this. Thank you.
-
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: "How do I ZScript?"
How do I use random number in Damage property of projectile? When i put in 'random(1,10);', it returns error, that even numbers has to be used