Page 2 of 4

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Thu May 16, 2019 11:09 pm
by Matt
If you make ModWeapon (or whichever of its ancestors inherits from Weapon) inherit from this ZS-defined actor instead:

Code: Select all

class JumpButtonWeapon:Weapon{
    action void A_JumpIfPressing(int button,statelabel stt,int layer=PSP_WEAPON){
        if(player.cmd.buttons&button)player.setpsprite(layer,invoker.findstate(stt));
    }
    action void A_JumpIfPressingFire(statelabel stt){
        A_JumpIfPressing(BT_ATTACK,stt);
    }
    action void A_JumpIfPressingAltfire(statelabel stt){
        A_JumpIfPressing(BT_ALTATTACK,stt);
    }
} 
and then in althold replace "VLCN ABCD 1" with

Code: Select all

VLCN ABCD 1 A_JumpIfPressingFire("hold")
and then in hold, just before the A_Refire line, add

Code: Select all

TNT1 A 0 A_JumpIfPressingAltfire("althold")
I think you can approximate what you need.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 1:09 am
by Alexagon
Not to sound like a moron, but I have no idea where to place that first bit of code you posted. Like I may need some ELI5 for this type of thing.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 3:15 am
by Dan_The_Noob
Matt wrote:Dan please stop posting about things you know nothing about. What I posted was literally a complete, functioning solution to the problem you're claiming is unsurmountable. (One of several possible solutions and not all of them needing ZScript if one is willing to put up with the spaghetti)

Alexagon you'll need to post the entire actor code for us to see what went wrong.
HE IS THE ONE NOT WANTING TO USE SCRIPT
So i am informing that it probably can't work because I already looked into this type of thing using Decorate.
Alexagon wrote:Not to sound like a moron, but I have no idea where to place that first bit of code you posted. Like I may need some ELI5 for this type of thing.
first part goes during the spinny bit
Spoiler:
second part goes after the shooty bit
Spoiler:

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 3:44 am
by Void Weaver
Alexagon, maybe my english are too bad but I still don't understand what (alt-)firing effects you want to achieve? Should is Altfire mode supposed to be are sorta of toggleable (by alt-fire button) wind-up "awaited-for-Fire-button" state?

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 8:32 am
by Matt
Alexagon wrote:Not to sound like a moron, but I have no idea where to place that first bit of code you posted. Like I may need some ELI5 for this type of thing.
Here's an entire functioning ZSCRIPT lump:

Code: Select all

version "4.1"

class JumpButtonWeapon:Weapon{
    action void A_JumpIfPressing(int button,statelabel stt,int layer=PSP_WEAPON){
        if(player.cmd.buttons&button)player.setpsprite(layer,invoker.findstate(stt));
    }
    action void A_JumpIfPressingFire(statelabel stt){
        A_JumpIfPressing(BT_ATTACK,stt);
    }
    action void A_JumpIfPressingAltfire(statelabel stt){
        A_JumpIfPressing(BT_ALTATTACK,stt);
    }
}  

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 8:33 pm
by Alexagon
Dan_The_Noob wrote:
Matt wrote:Dan please stop posting about things you know nothing about. What I posted was literally a complete, functioning solution to the problem you're claiming is unsurmountable. (One of several possible solutions and not all of them needing ZScript if one is willing to put up with the spaghetti)

Alexagon you'll need to post the entire actor code for us to see what went wrong.
HE IS THE ONE NOT WANTING TO USE SCRIPT
So i am informing that it probably can't work because I already looked into this type of thing using Decorate.
Alexagon wrote:Not to sound like a moron, but I have no idea where to place that first bit of code you posted. Like I may need some ELI5 for this type of thing.
first part goes during the spinny bit
Spoiler:
second part goes after the shooty bit
Spoiler:
First off, I'm not a he.

Secondly, I got where to put those two lines of code but the first section with the class definition I don't know where to place. Same with what Matt just posted; I have no idea where in the code that goes.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 8:35 pm
by Alexagon
Void Weaver wrote:Alexagon, maybe my english are too bad but I still don't understand what (alt-)firing effects you want to achieve? Should is Altfire mode supposed to be are sorta of toggleable (by alt-fire button) wind-up "awaited-for-Fire-button" state?
I want it so that while holding the altfire key, the barrel on the minigun spins and only spins. Then if I press fire while the barrel is spinning, I want it to fire without any delay.

Essentially I want to be able to be prepared to shoot with the minigun instead of waiting for the first few frames to pass before actually firing.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 9:38 pm
by Dan_The_Noob
Alexagon wrote: First off, I'm not a he.
sorry, it was more of "until proven otherwise" situations.
Alexagon wrote:Secondly, I got where to put those two lines of code but the first section with the class definition I don't know where to place. Same with what Matt just posted; I have no idea where in the code that goes.
I believe if code comes up blue it's a ZScript (make seperate file to put in the WAD)

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Fri May 17, 2019 10:18 pm
by Alexagon
No problem, was just pointing it out.

Do I just need to make a txt file for the zscript, paste what Matt posted, then just place it in the directory where the decorate txt file is? I've never done anything with zscript before.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 12:20 am
by Dan_The_Noob
I would assume so? I haven't used Zscript because i made my mod for Zandronum which i don't think supports it.

but there is an option in SLADE for it to highlight in Zscript so i guess you jus put it in as a txt file like decorate does.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 12:41 am
by Alexagon
Dan_The_Noob wrote:I would assume so? I haven't used Zscript because i made my mod for Zandronum which i don't think supports it.

but there is an option in SLADE for it to highlight in Zscript so i guess you jus put it in as a txt file like decorate does.
I made the file and put it in with the rest of the main pk3 directory. First thing, when I tried to luanch from ZDL it said only version 4.0 is supported. So I changed that in the script and when I launched it, the script did nothing to solve my issue.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 12:41 am
by Dan_The_Noob
update your GZDoom to 4.1.1?

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 1:04 am
by Alexagon
Dan_The_Noob wrote:update your GZDoom to 4.1.1?
Did that, changed the code back. No difference.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 1:27 am
by Dan_The_Noob
you may just have to make the barrel spin a toggle unless Matt can help with the code not working.

Re: Adding a spin alt-fire to a chaingun? Is it possible?

Posted: Sat May 18, 2019 1:32 am
by Alexagon
Dan_The_Noob wrote:you may just have to make the barrel spin a toggle unless Matt can help with the code not working.
Yeah, that's what I'm thinking. I wouldn't mind too much if I could at least make it a toggle, As long as it would work!