INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Moderator: GZDoom Developers

User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

I know that +INVENTORY.ALWAYSPICKUP is for items, but I tried using it on a weapon I have and it didn't work.

Would it be possible to make this flag work on weapons as well?
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Kate »

Use a [wiki=Classes:CustomInventory]CustomInventory[/wiki] item:

Code: Select all

actor FooGun: Weapon
{
    ... stuff
}

actor FooPickup: CustomInventory
{
    +INVENTORY.ALWAYSPICKUP
    States
    {
    Spawn:
        FOOG A -1
        Stop
    Pickup:
        TNT1 A 0 A_GiveInventory ("FooGun", 1)
        Stop
    }
}
It won't stay in multiplayer, however.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

It must work in multiplayer, the project I'm working on is mainly for multiplayer...
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Kate »

It will work fine in multiplayer, it just won't stay, as in when someone picks it up, it will go away forever unless respawning is on, then it will go away, and come back after a while. From what it sounds like, if you want the weapon to always be picked up you won't want it to stay anyway, otherwise it will have really bad consequences (infinite ammo, anyone?) so that will work fine.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

This is basically what I want:

A random weapon is spawned. The player MUST pick it up, whatever it is, before anything else happens. They may already have this weapon, but they must pick it up if it is spawned.

So based on that information, your suggestion will work?
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Kate »

If I understand correctly, yes. You won't want the weapon to stay in that case.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

Correct. Absolutely must not stay. Thanks for the help, I'll try it out.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Graf Zahl »

In that case the CustomInventory method is the best thing to do. You won't want any of the special code that is there for handling the weapons' special needs and which made the WeaponGiver class necessary - because CustomInventory doesn't have it.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Graf Zahl »

Added. There was another problem in the TryPickup function and the fix for that made it very easy to have the ALWAYSPICKUP flag work for all inventory items.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

Wow, cool. I had already set up the format that SnowKate had suggested, but since you added this, and it's less code, I might as well use it. :wink:
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

I'm bumping this because it's related to this thread. If you feel I should create a bug report, I shall.

@ Graf: You added this so the INVENTORY.ALWAYSPICKUP flag would allow for weapons to be picked up, no matter what. However, I just tried it with my project and it doesn't seem to work when you try picking up a weapon you already have, and have full ammo for. Is this a bug?

Here's my DECORATE lump:

Code: Select all

ACTOR NewChainSaw : ChainSaw
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewShotgun : Shotgun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewSuperShotgun : SuperShotgun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewChaingun : Chaingun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewRocketLauncher : RocketLauncher
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewPlasmaRifle : PlasmaRifle
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewBFG9000 : BFG9000
{
   +INVENTORY.ALWAYSPICKUP
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Graf Zahl »

Works perfectly. Apparently you forgot to declare the 'replaces originalweapon'. If you summon these new weapons directly they will be picked up.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

Graf Zahl wrote:Works perfectly. Apparently you forgot to declare the 'replaces originalweapon'. If you summon these new weapons directly they will be picked up.
Oh oops! :oops: Yes, I see my mistake now. Thanks.
User avatar
Slasher
Posts: 1160
Joined: Sun Mar 16, 2008 11:17 pm
Location: California

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Slasher »

Nope, I just tried it again, with this DECORATE:

Code: Select all

ACTOR NewChainSaw : ChainSaw Replaces ChainSaw
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewShotgun : Shotgun Replaces Shotgun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewSuperShotgun : SuperShotgun Replaces SuperShotgun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewChaingun : Chaingun Replaces Chaingun
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewRocketLauncher : RocketLauncher Replaces RocketLauncher
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewPlasmaRifle : PlasmaRifle Replaces PlasmaRifle
{
   +INVENTORY.ALWAYSPICKUP
}

ACTOR NewBFG9000 : BFG9000 Replaces BFG9000
{
   +INVENTORY.ALWAYSPICKUP
}
And it's not picking them up. I'm using GZDoom r180 to test this. Is this feature in that version? When I have the weapon, and full ammo for it, it just doesn't want to pick it up.

Does it matter that I'm summoning these weapons with an ACS script?

Graf: I'll PM you the mod I'm making that uses this. I'd rather not display it to the public yet.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: INVENTORY.ALWAYSPICKUP Doesn't work on Weapons

Post by Graf Zahl »

Slasher wrote:And it's not picking them up. I'm using GZDoom r180 to test this. Is this feature in that version? When I have the weapon, and full ammo for it, it just doesn't want to pick it up.
r180 should have it. But I tested it with the latest ZDoom and despite the fact that this thing looks like it's completely broken I could pick up any weapon I encountered.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”