ZScript Documentation

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Re: ZScript Documentation

Postby Cherepoc » Mon Dec 19, 2016 2:47 pm

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.
User avatar
Cherepoc
 
Joined: 08 Sep 2004
Location: Russia

Re: ZScript Documentation

Postby Graf Zahl » Mon Dec 19, 2016 3:39 pm

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

Re: ZScript Documentation

Postby Cherepoc » Mon Dec 19, 2016 4:19 pm

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.
User avatar
Cherepoc
 
Joined: 08 Sep 2004
Location: Russia

Re: ZScript Documentation

Postby Major Cooke » Tue Dec 20, 2016 4:07 pm

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.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Graf Zahl » Tue Dec 20, 2016 4:53 pm

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

Re: ZScript Documentation

Postby Major Cooke » Wed Dec 21, 2016 12:19 pm

User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby D2JK » Wed Dec 21, 2016 1:03 pm

That reminds me: is there a function that takes a classname, and counts the total number of them at the time of the call?
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Major Cooke » Wed Dec 21, 2016 1:29 pm

You can use a ThinkerIterator for that.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Major Cooke » Thu Dec 22, 2016 12:24 pm

Added ZScript variables, but it could use some validation as I'm not sure what all is actually correct.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Major Cooke » Sun Jan 01, 2017 10:30 am

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.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Major Cooke » Tue Jan 03, 2017 6:50 am

Wiki updated.

  • Added the two remaining iterators.
  • Added information about extending classes inside ZScript classes.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Major Cooke » Sat Jan 07, 2017 8:07 am

Added a warning about overriding a player's Tick function. See here for details.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby D2JK » Sat Jan 07, 2017 12:44 pm

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).
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Graf Zahl » Sat Jan 07, 2017 12:47 pm

X.GetAngle(1)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Documentation

Postby D2JK » Sat Jan 07, 2017 1:07 pm

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?
D2JK
 
Joined: 30 Aug 2014

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 7 guests