ZScript Documentation
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.
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.
-
- Posts: 60
- Joined: Wed Sep 08, 2004 1:26 pm
- Location: Russia
Re: ZScript Documentation
It probably should be mentioned in PostBeginPlay description that it is not always executed before state functions, so in some cases can not be used for one-time setups. See this.
-
- Lead GZDoom+Raze Developer
- Posts: 49140
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Documentation
You should use BeginPlay for those anyway because it is guaranteed to be called before the newly spawed actor is starting to interact with the world.
-
- Posts: 60
- Joined: Wed Sep 08, 2004 1:26 pm
- Location: Russia
Re: ZScript Documentation
Unfortunately, it's called before target pointer is assigned for the projectile, and I want to assign it's value to master. Neither function work in this case.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
Try giving it NOINTERACTION and NOBLOCKMAP, then have it turn off those flags in (Post)BeginPlay before calling the super function. That could at least ensure those processing things aren't interrupted at the very least.
-
- Lead GZDoom+Raze Developer
- Posts: 49140
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Documentation
That won't help much. CheckMissileSpawn, which explodes a projectile without space does not care about those flags at all.
If you absolutely need to modify a projectile after spawn, the only way to do it is using the low level interface to spawn it and modify it on the spawner's side.
If you absolutely need to modify a projectile after spawn, the only way to do it is using the low level interface to spawn it and modify it on the spawner's side.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
-
- Posts: 545
- Joined: Sat Aug 30, 2014 8:21 am
Re: ZScript Documentation
That reminds me: is there a function that takes a classname, and counts the total number of them at the time of the call?
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
You can use a ThinkerIterator for that.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
Added ZScript variables, but it could use some validation as I'm not sure what all is actually correct.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
With GZDoom 2.3's release, I think it's time to redouble the efforts on documenting all this. Graf has removed the -zscript requirement, so it's official now.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
Wiki updated.
- Added the two remaining iterators.
- Added information about extending classes inside ZScript classes.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript Documentation
Added a warning about overriding a player's Tick function. See here for details.
-
- Posts: 545
- Joined: Sat Aug 30, 2014 8:21 am
Re: ZScript Documentation
I was wondering: if I have a known actor such as "Actor X", is it somehow possible to call GetAngle() using X in it directly, instead of having to first assign eg. "tracer = X;", then followed by GetAngle(1, AAPTR_TRACER)?
For example, GetAngle(1, X) doesn't work (expects a numeric type).
For example, GetAngle(1, X) doesn't work (expects a numeric type).
-
- Lead GZDoom+Raze Developer
- Posts: 49140
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Documentation
X.GetAngle(1)
-
- Posts: 545
- Joined: Sat Aug 30, 2014 8:21 am
Re: ZScript Documentation
Hmm, no, that should be equivalent to "Get X's (relative) angle to its current target", which isn't what I'm after here.
Let me post some code illustrating what I'm trying to do for now:
This is called by a projectile, and actor X has no knowledge of the said projectile at the time of the call. I want to get the projectile's relative angle to X, so is my only option to simply use the commented-out lines of code?
Let me post some code illustrating what I'm trying to do for now:
Code: Select all
ThinkerIterator Searcher = ThinkerIterator.Create("MonsterBase");
Actor X;
while (X = MonsterBase(Searcher.Next()))
{
A_LogInt(GetAngle(1, X));
// tracer = X;
// A_LogInt(GetAngle(1, AAPTR_TRACER));
}