Page 5 of 9

Re: ZScript Documentation

PostPosted: Mon Dec 19, 2016 2:47 pm
by Cherepoc
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.

Re: ZScript Documentation

PostPosted: Mon Dec 19, 2016 3:39 pm
by Graf Zahl
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.

Re: ZScript Documentation

PostPosted: Mon Dec 19, 2016 4:19 pm
by Cherepoc
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.

Re: ZScript Documentation

PostPosted: Tue Dec 20, 2016 4:07 pm
by Major Cooke
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.

Re: ZScript Documentation

PostPosted: Tue Dec 20, 2016 4:53 pm
by Graf Zahl
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.

Re: ZScript Documentation

PostPosted: Wed Dec 21, 2016 12:19 pm
by Major Cooke

Re: ZScript Documentation

PostPosted: Wed Dec 21, 2016 1:03 pm
by D2JK
That reminds me: is there a function that takes a classname, and counts the total number of them at the time of the call?

Re: ZScript Documentation

PostPosted: Wed Dec 21, 2016 1:29 pm
by Major Cooke
You can use a ThinkerIterator for that.

Re: ZScript Documentation

PostPosted: Thu Dec 22, 2016 12:24 pm
by Major Cooke
Added ZScript variables, but it could use some validation as I'm not sure what all is actually correct.

Re: ZScript Documentation

PostPosted: Sun Jan 01, 2017 10:30 am
by Major Cooke
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.

Re: ZScript Documentation

PostPosted: Tue Jan 03, 2017 6:50 am
by Major Cooke
Wiki updated.

  • Added the two remaining iterators.
  • Added information about extending classes inside ZScript classes.

Re: ZScript Documentation

PostPosted: Sat Jan 07, 2017 8:07 am
by Major Cooke
Added a warning about overriding a player's Tick function. See here for details.

Re: ZScript Documentation

PostPosted: Sat Jan 07, 2017 12:44 pm
by D2JK
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).

Re: ZScript Documentation

PostPosted: Sat Jan 07, 2017 12:47 pm
by Graf Zahl
X.GetAngle(1)

Re: ZScript Documentation

PostPosted: Sat Jan 07, 2017 1:07 pm
by D2JK
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:

Code: Select allExpand view
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));
 }

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?