A_JumpIfInventory help

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
HellBlade64
Posts: 48
Joined: Tue May 13, 2014 3:00 pm

A_JumpIfInventory help

Post by HellBlade64 »

I'm trying to create weapon-specific runes that grant stronger attacks. For some reason, A_JumpIfInventory is being ignored completely no matter what I've tried.

Code: Select all

actor AbyssRevolver : Weapon 20018
{
Tag "Abyss Magnum"
+WEAPON.NOAUTOAIM
Inventory.PickupMessage "The Abyss Revolver!"
Inventory.PickupSound "dsshck"
Weapon.AmmoGive 20
Weapon.AmmoType "Clip2"
Weapon.AmmoUse 10
Weapon.AmmoGive2 0
Weapon.AmmoType2 "DemonSoul"
Weapon.AmmoUse2 10
Weapon.Kickback 100
Obituary "%o was quick-shot by %k's Abyss Revolver!"
AttackSound "dsarevfir3"
States
{
Spawn:
HGUN C -1
Loop

Ready:
//REVG GFEDIJ 1 
REVG A 0 A_PlaySound("dsarevck") 
REVG A 1 A_WeaponReady(WRF_ALLOWRELOAD)           
Goto Ready+1                
                                  
Deselect:
REVG A 0 A_Lower
REVG A 1 A_Lower
Goto Deselect+1

Select:
REVG A 1 A_Raise
Loop

Fire:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("AbyssRune",1,"SFire")
TNT1 A 0 A_Recoil(2.5)
REVG A 0 A_GunFlash
REVG A 0 A_CheckReload
REVG A 0 A_TakeInventory("RevolverShot",1,TIF_NOTAKEINFINITE) 
REVG A 0 A_FireBullets(0,0,1,0,BulletChip,0,1000)
REVG A 0 A_RailAttack(random(300,750),0,5,"none","FFFFFF",RGF_NOPIERCING,0,0,0,0,1000)
REVG BCDIJ 2 Bright
REVG A 0 A_JumpIfInventory("RevolverShot",1,1)
Goto Reload
REVG A 10
REVG A 0 A_ReFire
Goto Ready+1

SFire:
TNT1 A 0 A_Recoil(2.5)
REVG A 0 A_GunFlash
REVG A 0 A_CheckReload
REVG A 0 A_TakeInventory("RevolverShot",1,TIF_NOTAKEINFINITE) 
REVG A 0 A_FireBullets(0,0,1,0,"ARevolvExp",0,1500)
REVG A 0 A_RailAttack(random(300,750),0,5,"none","FFFFFF",RGF_NOPIERCING,0,0,0,0,1500)
REVG BCDIJ 2 Bright
REVG A 0 A_JumpIfInventory("RevolverShot",1,1)
Goto Reload
REVG A 10
REVG A 0 A_ReFire
Goto Ready+1

Flash:
TNT1 AA 1 A_Light1
TNT1 A 1 A_Light0
Goto LightDone

AltFire:
REVG A 0 A_GunFlash
REVG A 0 A_CheckReload
REVG A 0 A_TakeInventory("RevolverShot",1,TIF_NOTAKEINFINITE)
REVG A 0 A_PlayWeaponSound("dsarevfir3")
REVG A 0 A_FireCustomMissile("ABRDComet",0,5)
RVG2 BCDIJ 1 Bright
REVG A 0 A_JumpIfInventory("RevolverShot",1,1)
Goto Reload
REVG A 2
REVG A 0 A_ReFire
Goto Ready+1

Reload:
TNT1 A 0 A_CheckReload
REVG A 0 A_PlaySound("DSAREVRS")
REVG JIDEFG 1
TNT1 A 10
Goto Reloading

Reloading:
TNT1 A 1 A_JumpIfInventory("RevolverShot",6,"ReloadEnd")
TNT1 A 0 A_PlaySound("DSAREVRL")
TNT1 A 0 A_SpawnItemEx("VPBulletCasing",3,-8 - ACS_NamedExecuteWithResult("vp_casedist",0,0,0,0),36 - ACS_NamedExecuteWithResult("vp_caseheight",0,0,0,0),frandom(0,1),0,frandom(0,1),frandom(265,275),SXF_NOCHECKPOSITION | SXF_CLIENTSIDE)
TNT1 A 5 A_GiveInventory("RevolverShot",1)
Loop

ReloadEnd:
TNT1 A 2 A_PlaySound("DSAREVRE")
REVG GFEDIJ 1
Goto Ready+1
}
}
I feel like I have to be missing something really simple but I don't know what. Any help is appreciated.
User avatar
Hellser
Global Moderator
Posts: 2768
Joined: Sun Jun 25, 2006 4:43 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Citadel Station

Re: A_JumpIfInventory help

Post by Hellser »

Would you mind sharing the AbyssRune actor as well? Here's a couple of things worth mentioning:

Both states are identical outside of the range on both A_FireBullets and A_RailAttack. You have a problem with A_RailAttack too, the 5 in that A_RailAttack is a boolean, it's meant to ask "are we using ammo? Yes (1) or No (0)."

For further debugging and since you have a visual aid, change the SFire A_RailAttack color (the FFFFFF to FF0000), that will change from White to Red - so you can debug if your SFire is indeed being called upon.

Also, if AbyssRune is an item that you can only have 1 of. Try changing your A_JumpIfInventory to A_JumpIfInventory("AbyssRune", 0, "SFire") - the 0 will ask "Do we have the maximum of AbyssRunes? If yes, jump to SFire"
Post Reply

Return to “Scripting”