Pickup only for specific player
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.
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.
-
- Posts: 1
- Joined: Wed May 31, 2023 10:46 am
Pickup only for specific player
I'm looking to make a specific item pickable only by a specific player. This would help in coop, so that -for example- Backpack 1 can only be picked up by Player 1, and Backpack 2 can only be picked up by Player 2. I've just started with mapping, and my scripting knowledge is minimal, but is there a way to do this?
-
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: Pickup only for specific player
Well, this could be probably handled by zscript eventhandler. But I dont know how zscript handles multiplayer, yet if it even supports such use. I think this question belongs more into scripting than mapping. It's not a question of placement, but a scripting thing.
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Pickup only for specific player
Event handlers won't help here. For this the TryPickup method needs to be overridden and check whether the player is allowed to take the item.
-
- Posts: 2
- Joined: Mon Nov 21, 2022 8:19 pm
- Operating System Version (Optional): Windows 11, Ubuntu 23.10
- Graphics Processor: nVidia with Vulkan support
Re: Pickup only for specific player
While not the most flexible way, you could simply have multiple starting rooms: one for each player. Players can pick up their starting items then teleport, drop, or otherwise have a one-way trip into a common start room where they can group up before tackling the level. This has the advantage that it does not even require GZDoom: you can do this in the OG 1993 game which means every source port supports it.
Another option for GZDoom is using an ACS script defined for "ENTER" to give items to the script activator. Then when each player enters the level, the script populates some starting items.
Another option for GZDoom is using an ACS script defined for "ENTER" to give items to the script activator. Then when each player enters the level, the script populates some starting items.
-
- Posts: 362
- Joined: Wed Aug 02, 2017 3:01 pm
- Location: Illinois
Re: Pickup only for specific player
You could have 8 separate objects which all have A_CheckProximity(). You can specify a specific player pointer with this function such as :
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER1)
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER2)
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER3)
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER1)
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER2)
A_CheckProximity ("PlayerMatchState", "DoomPlayer", 64.0, 1, 0 , AAPTR_PLAYER3)