ZScript Discussion

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!)
Locked
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Discussion

Post by Major Cooke »

Cherepoc wrote:How can I check if an actor is standing on floor or on another actor? I did not dig deep into the sources, but I see there are P_CheckOnmobj function and MF2_ONMOBJ flag, but can't find such things in zscript files.
Because they weren't exported. You can do a check for bONMOBJ though. A_CheckFloor, but know this, actors one is standing upon are also counted as the 'floor' sometime, I think. Easiest way to tell is if they have no Z velocity.
Cherepoc wrote:Also, I want to make projectiles transform into non-projectiles if they hit anything they cannot damage (floors, walls, solid decorations, actors of same species as the shooter). Is there a function I can override and do the checks?
No. But there is the HIT<TARGET/MASTER/TRACER> flags. I suggest just using HITTRACER though because 'target' keeps track of the owner (explosion damage comes to mind.)

Code: Select all

TNT1 A 0
{
    if (tracer)
    {
    }
    else
    {
        //Didn't hit anything.
    }
}
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: ZScript Discussion

Post by ZZYZX »

Major Cooke wrote:Easiest way to tell is if they have no Z velocity.
Elevator. Slope.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Discussion

Post by Major Cooke »

Major Cooke wrote:A_CheckFloor, but know this, actors one is standing upon are also counted as the 'floor' sometime, I think. Easiest way to tell is if they have no Z velocity.
User avatar
Cherepoc
Posts: 60
Joined: Wed Sep 08, 2004 1:26 pm
Location: Russia

Re: ZScript Discussion

Post by Cherepoc »

Major Cooke wrote:You can do a check for bONMOBJ though.
Can't find it, seems like it was not exported either. The z velocity check is how I was always making the check for actor standing on something, but it's complex and unreliable, thought zscript gives better options.
Thanks for the hittracer suggestion, will try it. Although. I think, virtual function will be a better option.
EDIT: Interestingly enough there's ExplodeMissile(line lin = null, Actor target = null) function, which seems to be exactly what I want, but it's not virtual.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

ZZYZX wrote:
Major Cooke wrote:Easiest way to tell is if they have no Z velocity.
Elevator. Slope.

Both apply no velocity to an actor.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Cherepoc wrote:
Major Cooke wrote:You can do a check for bONMOBJ though.
Can't find it, seems like it was not exported either.
Have you tried? This flag is not exported to DECORATE because it has no use there, but it needs to exist as a scripted variable to check these things.
User avatar
Cherepoc
Posts: 60
Joined: Wed Sep 08, 2004 1:26 pm
Location: Russia

Re: ZScript Discussion

Post by Cherepoc »

Graf Zahl wrote: Have you tried? This flag is not exported to DECORATE because it has no use there, but it needs to exist as a scripted variable to check these things.
I searched that in zscript txt files, but only now realized that flags are not declared there, sorry for trouble.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: ZScript Discussion

Post by ZZYZX »

Graf Zahl wrote:
ZZYZX wrote:
Major Cooke wrote:Easiest way to tell is if they have no Z velocity.
Elevator. Slope.

Both apply no velocity to an actor.
Elevator moves vertically. This means the actor will have nonzero velz.
Player running on a slope results in nonzero velz as well.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: ZScript Discussion

Post by Gez »

Velocity and movement are two different things in Doom. A player has vertical velocity when they jump, fall, or are blown away by an arch-vile's explosion. Riding an elevator or climbing up a slope doesn't give you vertical velocity, it just moves you upward.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: ZScript Discussion

Post by Ed the Bat »

I am able to check how much of an item is in a pickup (to see if it's not full, thanks to being tossed by a monster, for example) thusly:

Code: Select all

inventory me=inventory(self);
amt=me.Amount;
But is there a way to check what the item's default full amount would be? For example, if we're looking at Clip, and it was dropped by a vanilla ZombieMan, Amount is 5, and the other value I want to find is 10. Can this be retrieved, or do I have to manually put in 10 for this?
User avatar
cambertian
Posts: 344
Joined: Thu May 07, 2015 4:24 pm
Graphics Processor: nVidia with Vulkan support
Location: New England Area, USA

Re: ZScript Discussion

Post by cambertian »

Did ZScript finally clear up the whole "Players can't have animations for both melee and ranged attacks" thing that bugged me so much back in the days of DECORATE? Like how Quake's Ranger switches to an axe in both first AND third person?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Ed the Bat wrote:But is there a way to check what the item's default full amount would be? For example, if we're looking at Clip, and it was dropped by a vanilla ZombieMan, Amount is 5, and the other value I want to find is 10. Can this be retrieved, or do I have to manually put in 10 for this?
Those other properties only exist for Ammo so you will find them in the Ammo class, not Inventory.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: ZScript Discussion

Post by Ed the Bat »

The only properties I see in Ammo are BackpackAmount and BackpackMaxAmount. But I figured out what I needed.
What I wanted was something like:

Code: Select all

BaseAmt=GetDefaultByType("Clip").Amount
Problem was that I was pulling from an array of strings, so GetDefaultByType was casting them as Actor, when I needed to first cast them as Inventory.
Last edited by Ed the Bat on Fri Dec 16, 2016 1:49 am, edited 1 time in total.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ZScript Discussion

Post by Kinsie »

Major Cooke wrote:Easiest way to tell is if they have no Z velocity.
In my past experiences with Reelism, actors can hit the point of having 0 Z velocity in mid-air for a frame or so when at the peak of their arc of upward momentum (ie. when thrusted into the air).
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: ZScript Discussion

Post by Arctangent »

cambertian wrote:Did ZScript finally clear up the whole "Players can't have animations for both melee and ranged attacks" thing that bugged me so much back in the days of DECORATE? Like how Quake's Ranger switches to an axe in both first AND third person?
I mean, there were ways to do that in Decorate.

Mind, I'm talking about attacks. As far as changing the entire sprite set based on the used weapon, that was kinda finicky in Decorate iirc and I'm not sure if ZScript's done anything about it.
Locked

Return to “Scripting”