Page 53 of 123

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 9:02 am
by Graf Zahl
The Loremaster uses DoSpecialDamage.

The difference is, DoSpecialDamage is called when it is decided that the projectile actually should damage the target, after it has already collided. SpecialMissileHit is for performing special actions BEFORE the projectile is exploded. This is used by a few Hexen projectiles that perform special actions on collision and do not explode, like the lightining attack. Do not confuse this with collision exclusion. It may sound similar on the surface but really is not.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 9:18 am
by Major Cooke
Does it take the HIT* pointer flags into account before SpecialMissileHit function is checked?

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 9:36 am
by Blue Shadow
MaxED wrote:Can ZScript class be inherited from DECORATE actor?
Graf Zahl wrote:No. Since DECORATE is parsed last the info is not available.

This is important and should emphasized, because this means that if you have mod A, which uses ZSCRIPT, and mod B, which uses DECORATE, and you want mod A to inherit classes from mod B, well, you won't be able to do that.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 9:43 am
by Graf Zahl
Major Cooke wrote:Does it take the HIT* pointer flags into account before SpecialMissileHit function is checked?


Can't say. SpecialMissileHit gets called right before deciding if ExplodeMissile needs to be callsed.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 10:02 am
by Major Cooke
Oh wait, I don't need those. It takes an actor called victim instead which is all I needed.

To clarify about this recent new addition of 'let p = Classtype(objectvar)'... If 'p' is not, say, MinotaurFriend like the change you made, would it return null even though it exists as something else? That is, if it's a different class instead of minotaurfriend. Would p be null?

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 10:15 am
by Graf Zahl
Yes. That's the entire point of a dynamic cast - it prevents that you access an incompatible object through a pointer.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 10:38 am
by Major Cooke
Okay, so what other 'special' words are there besides 'is' and 'let'? It's time to start adding these all to the wiki again.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 11:35 am
by Graf Zahl
Take a look at sc_man_scanner.re That contains all the reserved words, although many of them are just reserved but not used. Or do you only want to know the ones that do something? That list is in zcc_parser.cpp.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 12:12 pm
by Major Cooke
The latter. And okay. Now I need clarification on what the following are:

  • until
  • in
  • out

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 12:30 pm
by Graf Zahl
'until' is sometimes used as a negative 'while'. Although being parsed it's currently not being processed by the compiler.
In and Out are qualifiers for function parameters, 'out' causes a parameter being passed by reference. 'In' can be added as well, but has no function, it merely serves as means of documentation.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 1:19 pm
by Major Cooke
Alright.

Next question, how does GetSpriteIndex work? Does it convert the frame's A-Z (or whatever limit it is, I forgot) from 0 to that limit? Is the 'sprite' property what we use to compare/find what sprite an actor currently has?

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 1:43 pm
by Graf Zahl
No, it takes the four character name and returns the internal index for it.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 1:52 pm
by Xaser
Oh, that's interesting. Could that function be used to set an actor's sprite property directly via something like:
Code: Select allExpand view
self.sprite = GetSpriteIndex("SHTG");

?

(Can't test that code presently but that seems to be way thingdef_states.cpp is using said function internally. This would be extremely useful for a thing I'm planning on making).

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 2:00 pm
by Graf Zahl
Yes, that should work.

Re: ZScript Discussion

PostPosted: Mon Dec 05, 2016 4:48 pm
by D2JK
Suggestion: could someone please make a wiki page or section about iterators, documenting any of the following:

- brief introduction, their purpose, and how they work
- iterator types (ActorIterator, ThinkerIterator, anything else?)
- what sort of task does each type excel at
- perhaps a brief explanation of the performance cost
- usage instructions, the options available, example code