ZScript Discussion
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!)
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
Do weapons and/or custominventory have their own internal Tick function when being used on the player?
I know for weapons, it's basically overlays in a nutshell that can act just like Tick.
I know for weapons, it's basically overlays in a nutshell that can act just like Tick.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
They have a Tick function but you shouldn't use it.
The correct place to let an item do an effect on the player is the DoEffect method.
The correct place to let an item do an effect on the player is the DoEffect method.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
Is Vec3Angle a relative version of Vec3Offset? I.e.
Vec3Offset is like A_Warp with WARPF_ABSOLUTEANGLE, and the absolute boolean is equivalent to adding WARPF_ABSOLUTEPOSITION.
Vec3Angle is like A_Warp without those flags (moves the actor relatively forward with x, sideways with y), though the boolean would be like adding WARPF_ABSOLUTEANGLE.
Is this correct?
Vec3Offset is like A_Warp with WARPF_ABSOLUTEANGLE, and the absolute boolean is equivalent to adding WARPF_ABSOLUTEPOSITION.
Vec3Angle is like A_Warp without those flags (moves the actor relatively forward with x, sideways with y), though the boolean would be like adding WARPF_ABSOLUTEANGLE.
Is this correct?
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
No. Vec3Angle calculates a position by adding a directional vector calculated from a given angle and a distance.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
If I have an array of colors like this:
Do I need to do any sort of casting in order to pass them around from one actor to another?
Code: Select all
static const Color PrimaryColor[] =
{
"Red",
"AELimeGreen",
"AEDarkRed",
"AEGreenYellow",
"AEPoo",
"AEPutridGreen",
"Black",
"Blue",
"Brown",
"DarkGreen",
"DimGray",
"Gold", //11
"Green",
"Grey",
"LightSlateGray",
"Purple",
"Seashell2",
"Snow3",
"White",
"Yellow" // 19
};
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
The static array contains colors, not strings. The initialization and conversion will occur at compile time.
Just: Where are AELimeGreen etx defined? Are you including a replacement for x11r6rgb.txt?
Just: Where are AELimeGreen etx defined? Are you including a replacement for x11r6rgb.txt?
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
Yes. Inside the X11R6RGB file.
Code: Select all
0 175 0 AELimeGreen
67 0 0 AEDarkRed
222 254 114 AEGreenYellow
135 087 051 AEPoo
67 147 55 AEPutridGreen
0 88 0 AELimeGreenD2
34 0 0 AEDarkRedD2
111 127 57 AEGreenYellowD2
68 44 26 AEPooD2
17 74 28 AEPutridGreenD2
0 50 0 AEDarkGreenD2
50 0 0 AEDarkRedD2
53 53 53 AEDimGreyD2
128 108 0 AEGoldD2
87 128 24 AEGreenYellowD2
119 115 111 AESeaShell2D2
255 255 0 AEYellowD2
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: ZScript Discussion
Had a quick question that I forgot to ask weeks ago. For the heck of it, I was converting some DECORATE in an old project (not one of mine -- NeoDoom Gold and Final NeoDoom, to be specific) to ZScript as a learning exercise, and an actor used the Teleport thing special. ZScript doesn't like this, as it has its own Teleport function with completely different parameters. Is there a simple way to convert that old DECORATE actor, or it is something that should just be redone from scratch? I always felt using the thing special was kinda hacky, anyway.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Damnit, another one I did not catch. Best wait with this, I'll have to rename the internal function then.
In general, if something clashes with an action special name, report as a bug, that isn't supposed to happen.
In general, if something clashes with an action special name, report as a bug, that isn't supposed to happen.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: ZScript Discussion
I'll keep that in mind from now on. Thanks. And for the record, leaving it in DECORATE still works, so the official versions of those projects still operate as well as they ever did.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Even weirder. It looks like the DECORATE code resolves the names differently then.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
Is Touch() supposed to rely upon PICKUP and SPECIAL flags, along with health > 0? Because that's what it's doing now, and I feel this can only be useful for items.
But...
Elsewhere...
Code: Select all
//============================================================================
//
// AActor :: Touch
//
// Something just touched this actor. Normally used only for inventory items,
// but some Strife monsters also use it.
//
//============================================================================
Code: Select all
// Check for special pickup
if ((thing->flags & MF_SPECIAL) && (tm.thing->flags & MF_PICKUP)
// [RH] The next condition is to compensate for the extra height
// that gets added by P_CheckPosition() so that you cannot pick
// up things that are above your true height.
&& thing->Z() < tm.thing->Top() - tm.thing->MaxStepHeight)
{ // Can be picked up by tmthing
P_TouchSpecialThing(thing, tm.thing); // can remove thing
}
Code: Select all
void P_TouchSpecialThing (AActor *special, AActor *toucher)
{
double delta = special->Z() - toucher->Z();
// The pickup is at or above the toucher's feet OR
// The pickup is below the toucher.
if (delta > toucher->Height || delta < MIN(-32., -special->Height))
{ // out of reach
return;
}
// Dead thing touching.
// Can happen with a sliding player corpse.
if (toucher->health <= 0)
return;
//Added by MC: Finished with this destination.
if (toucher->player != NULL && toucher->player->Bot != NULL && special == toucher->player->Bot->dest)
{
toucher->player->Bot->prev = toucher->player->Bot->dest;
toucher->player->Bot->dest = NULL;
}
special->CallTouch (toucher);
}
Last edited by Major Cooke on Sun Dec 11, 2016 2:29 pm, edited 1 time in total.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Yes. And this cannot be changed because it'd break the entire system.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Discussion
Perhaps a different Touch then, like TouchActor that's called within PIT_CheckThing? But I suppose that too might not be doable when coming to performance.
-
- Lead GZDoom+Raze Developer
- Posts: 49183
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
No, that was precisely what I was trying to avoid with CanCollideWith.