"How do I ZScript?"

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)

Re: "How do I ZScript?"

Postby Graf Zahl » Tue Oct 10, 2017 1:52 am

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: "How do I ZScript?"

Postby Nash » Tue Oct 10, 2017 2:08 am

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.


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.

"human - caucasian - body - walking001 - 0.png" is much easier to identify than "HCBAA0.png". :P
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: "How do I ZScript?"

Postby kodi » Tue Oct 10, 2017 2:43 am

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 :)
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: "How do I ZScript?"

Postby Graf Zahl » Tue Oct 10, 2017 3:21 am

Sorry, but the sprite system is not fixable without breaking it.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: "How do I ZScript?"

Postby Rachael » Tue Oct 10, 2017 3:24 am

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... >_>
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: "How do I ZScript?"

Postby Graf Zahl » Tue Oct 10, 2017 4:16 am

I didn't want to explicitly state the conundrum here... :mrgreen:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: "How do I ZScript?"

Postby zrrion the insect » Tue Oct 10, 2017 7:51 am

If you really need long filenames you could use TEXTURES
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

Re: "How do I ZScript?"

Postby Matt » Tue Oct 10, 2017 5:14 pm

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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "How do I ZScript?"

Postby kodi » Tue Oct 10, 2017 5:24 pm

Since I'm setting the sprites with zscript functions anyway, I'll be using some form of nicer name reference/lookup table or whatever.
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: "How do I ZScript?"

Postby ZoDX32 » Sat Oct 14, 2017 6:08 pm

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?
Code: Select allExpand view
projectile.angle //works
projectile.pitch //equals to 0
User avatar
ZoDX32
 
Joined: 14 Oct 2017

Re: "How do I ZScript?"

Postby kodi » Sun Oct 15, 2017 1:08 am

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 allExpand view
override void PostBeginPlay()
   {
      A_SetPitch(-atan2(vel.z,sqrt((vel.x*vel.x) + (vel.y*vel.y))));
      Super.PostBeginPlay();
   }

You can also use A_FaceMovementDirection, but it doesn't work in PostBeginPlay so is unusable for some particular things. Or at least was a few months ago.
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: "How do I ZScript?"

Postby ZoDX32 » Sun Oct 15, 2017 1:59 am

OMG Big Thanks!!! I wanna say this is i do for collision code with CanCollideWith()
here PRE-Results:
Image
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.
User avatar
ZoDX32
 
Joined: 14 Oct 2017

Re: "How do I ZScript?"

Postby ZoDX32 » Sun Oct 15, 2017 2:30 am

Also how to find vector pitch from invoker actor to another actor?
User avatar
ZoDX32
 
Joined: 14 Oct 2017

Re: "How do I ZScript?"

Postby Accensus » Sun Oct 15, 2017 2:56 am

Please read this. Thank you.
Accensus
 
Joined: 11 Feb 2016

Re: "How do I ZScript?"

Postby ramon.dexter » Wed Oct 18, 2017 7:25 am

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 :(
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest