Jump not working on custominventory item

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.

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!)
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Jump not working on custominventory item

Post by Grey-Wolf »

So, I'm making this player class that loses a bunch of random weapons when he enters a new map.
To do this, I'm making multiple actor, one for each weapon, that actually take the weapon from you.

I tried with something like this:
Spoiler:
And everything works like a charm, but I don't quite like it. This way I should spawn the items right under the player's feet, and make him pick them up. Furthermore, the message will show whether the player has the weapon or not.
So I tried this:
Spoiler:
But it seems like the jump is not performed even If I have the shotgun in inventory. What did I do wrong?
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Jump not working on custominventory item

Post by Apeirogon »

Because you place inventory check in spawn state, while it would work on player only if placed in pickup state.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Jump not working on custominventory item

Post by Grey-Wolf »

Is there a pointer or some workaround to make it target the player even from the spawn state?
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: Jump not working on custominventory item

Post by Graf Zahl »

No. The spawn state is only active when the item is not owned.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Jump not working on custominventory item

Post by Grey-Wolf »

Meh. I'll go with the "spawn everything under player's feet" solution then, and see my options from there. Thanks

EDIT:
Ok SOLVED issue, thanks everyone for clarifying my questions!
In case anyone is wondering (I don't think so but still), here's what I did:
Spoiler:
I know, it's pretty basic, but I'm still learning, and form me it's still a good surprise when things go as planned XD
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm

Re: Jump not working on custominventory item

Post by Arctangent »

Should be noted that the Pickup state runs even if the actor is given the item via [wiki]A_GiveInventory[/wiki] or similar direct inventory manipulation functions. So, there's no need to spawn the item under the player's feet - which should generally be avoided with this kind of thing, anyway, as items on the map can only be picked up by player movement.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Jump not working on custominventory item

Post by Grey-Wolf »

I'm using Spawn Item because the actor that takes the weapons away is actually a random spawner that picks between 16 spawn states that removes various combinations of weapons and ammo. I don't think that using A_GiveInventory to give the spawner to the player would work. Or would it?
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm

Re: Jump not working on custominventory item

Post by Arctangent »

It could with a single inventory item that uses [wiki]A_Jump[/wiki] to do the random picking that you're using the RandomSpawner for.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Jump not working on custominventory item

Post by Grey-Wolf »

Oh nice, I've already a single inventory item doing the picking with jumps, but I didn't think it would work if not picked up. Thanks for the info!

Return to “Scripting”