"How do I ZScript?"

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Re: "How do I ZScript?"

Postby ZippeyKeys12 » Mon Oct 30, 2017 1:16 pm

Changing the height of an actor in ZScript only affect actor-to-actor collisions, correct?
If so, does that mean I have to morph an actor into another actor to change the height of collision with level architecture?

Also, bump:
ZippeyKeys12 wrote:Is it possible to detect multiple simultaneous key-presses inside of InputProcess?

Also is it possible to register an EventHandler while the game is running? I recall seeing ZZYZX mention this, but I can't seem to figure it out. :?

Any help would be appreciated :)

EDIT: Also, is it not possible to put a constant array in a struct?
EDIT 5: Can I access a variable in an EventHandler from my StatusBar?

Please let me know if I'm not supposed to do ^
ZippeyKeys12
 
Joined: 15 Jun 2016

Re: "How do I ZScript?"

Postby Gutawer » Mon Oct 30, 2017 1:50 pm

You can detect simulataneous key pressed with an EventHandler by keeping track of the keys you need to track as booleans (or a bitfield, if you have a very large amount of them), and testing if both of the booleans are true. The event handler should simply set and unset the booleans. You need to do this since an event handler doesn't give you which keys are pressed currently, only that they've been pressed or released.
User avatar
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431

Re: "How do I ZScript?"

Postby Rip and Tear » Mon Oct 30, 2017 2:36 pm

Hmm, I see. However, I still fail to understand what the actual applications of this would be. Predicable randomness seems to be missing the point.
User avatar
Rip and Tear
King of creative usernames
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later

Re: "How do I ZScript?"

Postby Apeirogon » Tue Oct 31, 2017 6:10 am

How make monster dont shoot if between monster and his target stand some actor? Like, chaingunner dont shooting if between him and player walk another former human.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby Blue Shadow » Tue Oct 31, 2017 7:43 am

It looks like you want A_CheckLOF.
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: "How do I ZScript?"

Postby Apeirogon » Tue Oct 31, 2017 8:29 am

And if i want actor thet prevent shooting, if it block line of sight of any monster?
Like, i want to smoke grenade. And i want to make it into PWAD to play with guncaster/high noon driver/demonsteel/etc. or custom monsters pack. And I too lazy and stupid to edit every actor, that potentialy can shoot me, with a_checkLOF.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby Gutawer » Wed Nov 01, 2017 5:34 am

What's the cleanest way to send out a hitscan from a position in 3d space? Spawning an actor to send out the hitscan seems to work nicely, but I can't figure out how to make it transfer the target to the actor that is "supposed" to have sent out the hitscan.
User avatar
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431

Re: "How do I ZScript?"

Postby ZzZombo » Wed Nov 01, 2017 11:39 am

Isn't P_AimLineAttack() and/or related stuff exposed?
ZzZombo
 
Joined: 16 Jul 2012

Re: "How do I ZScript?"

Postby Apeirogon » Wed Nov 01, 2017 3:23 pm

In definition of CanCollideWith write (Actor other, bool passive)
So if I wish make "false" to all projectile and hitscan in game, it means that must write check for all projectile/hitscan by name? Llike

Code: Select allExpand view
class some_thing: actor
{
    override bool CanCollideWith (Actor other, bool passive)
    {
        if(actor.imp_fireball)
        {
            false;
        }

        if(actor.chainguy_hitscan_puff)
        {
            false;
        }
        if...
       ...
       ...
       ...
       and so on
    }
}
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby ZippeyKeys12 » Wed Nov 01, 2017 11:06 pm

Code: Select allExpand view
if(other.bMissile)
    return false;

Of course if there's an entirely reasonable chance of projectiles not using the +Missile flag. Also I'm not sure how to access flags so I just guessed.

For hitscans IDK.
ZippeyKeys12
 
Joined: 15 Jun 2016

Re: "How do I ZScript?"

Postby Apeirogon » Thu Nov 02, 2017 9:24 am

Yes, it can look at the flag of collide actor.
About hitscan...Im just add to actor spectral flag and add check dont collide with projectile with spectral flag.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby Apeirogon » Thu Nov 02, 2017 2:47 pm

SpecialMissileHit used as ripper expansion?
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby ZippeyKeys12 » Thu Nov 02, 2017 8:27 pm

Apeirogon wrote:SpecialMissileHit used as ripper expansion?

Umm, excuse me? :?
ZippeyKeys12
 
Joined: 15 Jun 2016

Re: "How do I ZScript?"

Postby Apeirogon » Fri Nov 03, 2017 5:38 am

int SpecialMissileHit (Actor victim)

Called when a missile impacts an actor. Returning 1 tells the missile to keep going instead of exploding, while -1 signifies the missile to die.

When return 1 it means "pierce/fly through actor"?
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: "How do I ZScript?"

Postby Major Cooke » Fri Nov 03, 2017 10:09 am

Apeirogon wrote:When return 1 it means "pierce/fly through actor"?

Yes.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: Dan_The_Noob, Jambus and 6 guests