Tertiary ammo type?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

Tertiary ammo type?

Postby XASSASSINX » Tue Nov 07, 2017 4:58 pm

I'm trying to make a weapon that uses as primary ammo Clips, as secundary it shoots rockets. BUT i wanna ALSO that when shooting the rockets, it uses 10 cells to do that too. So how would i do that? A_JumpIfInventory didn't work for me. Here's the code:

Code: Select allExpand view
   AltFire:
      TNT1 A 0 A_JumpIfInventory("Cell", 0, "NoAmmo")
      TNT1 A 0 A_TakeInventory("Cell", 10)
      HCGG A 3 A_PlaySound("terminator/hmissile")
      TNT1 A 0 A_FireCustomMissile("PlayerHomingMissile")
      HCCT AB 4 BRIGHT
      Goto Ready

(The weapon just go to the "No Ammo" state everytime, but i don't have 0 cells)
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Tertiary ammo type?

Postby Ichor » Tue Nov 07, 2017 5:31 pm

Code: Select allExpand view
   AltFire:
      TNT1 A 0 A_JumpIfInventory("Cell", 1, 1)
      Goto NoAmmo
      TNT1 A 0 A_TakeInventory("Cell", 10)
      HCGG A 3 A_PlaySound("terminator/hmissile")
      TNT1 A 0 A_FireCustomMissile("PlayerHomingMissile")
      HCCT AB 4 BRIGHT
      Goto Ready


It's jumping to NoAmmo all the time because JumpIfInventory checks for at least that amount. In this case, 0. This change here will skip across the Goto NoAmmo if you have at least one 1 cell.
User avatar
Ichor
The fun cannot be halted
 
Joined: 23 Jul 2003

Re: Tertiary ammo type?

Postby XASSASSINX » Tue Nov 07, 2017 5:35 pm

[quote=ichor]It's jumping to NoAmmo all the time because JumpIfInventory checks for at least that amount. In this case, 0. This change here will skip across the Goto NoAmmo if you have at least one 1 cell.[/quote]

So... How should i put it?

EDIT: Wait, i put 1? I remember putting 0! But even with 0, it still doens't work.

EDIT 2: Hold on i forgot to create the missile projectile. DUH

EDIT 3: Well it works, EXCEPT if i'm full of cells. Weird.
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Tertiary ammo type?

Postby Arctangent » Tue Nov 07, 2017 5:57 pm

A_JumpIfInventory with an amount of 0 jumps if you have the max amount of the item, not if you have 0.
User avatar
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: Tertiary ammo type?

Postby XASSASSINX » Tue Nov 07, 2017 6:22 pm

Arctangent wrote:A_JumpIfInventory with an amount of 0 jumps if you have the max amount of the item, not if you have 0.


Again, how should i put it then?
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Tertiary ammo type?

Postby Arctangent » Tue Nov 07, 2017 8:46 pm

Ichor has an example right there in his post, where instead of going to NoAmmo if you don't have ammo, you go to the rest of the AltFire state if you do have ammo.
User avatar
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: Tertiary ammo type?

Postby XASSASSINX » Wed Nov 08, 2017 5:42 am

Arctangent wrote:Ichor has an example right there in his post, where instead of going to NoAmmo if you don't have ammo, you go to the rest of the AltFire state if you do have ammo.


yeah yeah... I already fixed it. Thanks!
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests