Jump to content
  • 0

How do I make a key stay in the player's inventory for multiple levels ?


Question

Posted (edited)

I'm making a mod that will include either a black key card or skull that functions like in normal Doom, with the exceptions of staying throughout a whole episode to unlock a "super secret" map. I know how to make the actual doomkey actor in decorate, but not how to make it carry between levels.

 

keep in mind this wads mapping is done in udmf format as well, so your answers may not have to be fully vanilla compatible.

Edited by St. Mildly Annoyed

Share this post


Link to post

24 answers to this question

Recommended Posts

  • 2

Heres a small example based on the relevant info and what the OP said

 

THen you just need to make the Door to which the Key would be applied. Might have to make a LOCKDEF for it too.

 

 

Spoiler

Actor BlackSecretKey: DoomKey
{
  +INvBar // So you can see you picked up the Key brcause it may not show up in the Keys part of the HUD
  Inventory.InterHubAmount 1
  Inventory.Icon "BLKYA0"
  INventory.PickupMessage " Got the Black Key"
  Species "BlackKey"
+INVENTORY.ALWAYSPICKUP
States
  {
    Spawn:
     BLKY A -1
     Stop
}
}
  

 

 

Share this post


Link to post
  • 1
5 minutes ago, Yousuf Anik said:

Alright. Could you please suggest any reference so I can take a look at them myself first? That would be really helpful.

 

Following this thread because I have similar plan for my mapset. Instead of special keys that I already set for each first three maps, I need the red and blue keys from the first two maps to stay with me so I can use them on third map without picking up them again anyway. Because I have seperate routing plan/options on my third map, that will require the player to use either red key or blue key. This is also to prevent the player from further exploring the later maps without completing the first maps, so a player gets to play the total story.

This might help: https://zdoom.org/wiki/Classes:Key

 

The Species of a key allows a new key to behave like an existing key. Something like this in DECORATE would replace the red keycard with one that sticks with the player between levels:

actor PersistentRedCard : RedCard replaces RedCard
{
	Inventory.InterHubAmount 1
	Species "RedCard"
}

 

Share this post


Link to post
  • 0

You'd probably want to make the key an inventory item, along the lines of Heretic/Hexen/Strife.

Share this post


Link to post
  • 0
Posted (edited)

that shrimple, mind giving me a decorate example? Just wanting to make sure I do it correctly after how dense my mistakes sometimes are.

 

also, thank you.

Edited by St. Mildly Annoyed

Share this post


Link to post
  • 0
5 minutes ago, LoatharMDPhD said:

just have the key spawn at the player start for the next map. don't have to reinvest the wheel here...

 

That would require the game to check whether or not the player has picked up the key in a previous map, which unfortunately runs into the same initial problem.

Share this post


Link to post
  • 0
56 minutes ago, Obsidian said:

 

That would require the game to check whether or not the player has picked up the key in a previous map, which unfortunately runs into the same initial problem.

could have two exits on the level that has the key, if the player goes over it, then the normal exit is blocked off and the secret exit is opened up, then the next levels are a copy of the maps but with the key at player start. twice the maps but its a work around.

Share this post


Link to post
  • 0
33 minutes ago, LoatharMDPhD said:

could have two exits on the level that has the key, if the player goes over it, then the normal exit is blocked off and the secret exit is opened up, then the next levels are a copy of the maps but with the key at player start. twice the maps but its a work around.

 

It's definitely a bit more doable if you're using UMAPINFO and can define the regular and secret exits yourself. Heck, you could even have the exit be tied to a voodoo doll crossing an exit linedef outside the map and have the key determine whether or not it goes over the regular or secret one: that way the exit architecture doesn't even need to change. It's all admittedly a tad hacky, but I definitely like the concept.

Share this post


Link to post
  • 0
6 hours ago, kalensar said:

Heres a small example based on the relevant info and what the OP said

 

THen you just need to make the Door to which the Key would be applied. Might have to make a LOCKDEF for it too.

 

 

  Reveal hidden contents


Actor BlackSecretKey: DoomKey
{
  +INvBar // So you can see you picked up the Key brcause it may not show up in the Keys part of the HUD
  Inventory.InterHubAmount 1
  Inventory.Icon "BLKYA0"
  INventory.PickupMessage " Got the Black Key"
  Species "BlackKey"
+INVENTORY.ALWAYSPICKUP
States
  {
    Spawn:
     BLKY A -1
     Stop
}
}
  

 

 

Hi there @kalensar is this doable for the regular keys, not special ones? For example, I pick up a regular blue key on second map and want it to stay on the next map.

Share this post


Link to post
  • 0
2 minutes ago, Yousuf Anik said:

Hi there @kalensar is this doable for the regular keys, not special ones? For example, I pick up a regular blue key on second map and want it to stay on the next map.

 

Yes it should be but you need to make a replacement  custom key Actor with the required properties.

Share this post


Link to post
  • 0
Posted (edited)
6 minutes ago, kalensar said:

 

Yes it should be but you need to make a replacement  custom key Actor with the required properties.

Alright. Could you please suggest any reference so I can take a look at them myself first? That would be really helpful.

 

Following this thread because I have similar plan for my mapset. Instead of special keys that I already set for each first three maps, I need the red and blue keys from the first two maps to stay with me so I can use them on third map without picking up them again anyway. Because I have seperate routing plan/options on my third map, that will require the player to use either red key or blue key. This is also to prevent the player from further exploring the later maps without completing the first maps, so a player gets to play the total story.

Edited by Yousuf Anik

Share this post


Link to post
  • 0
8 minutes ago, Yousuf Anik said:

Alright. Could you please suggest any reference so I can take a look at them? That would be really helpful.

 

Following this thread because I have similar plan for my mapset. Instead of special keys that I already set for each first three maps, I need the red and blue keys from the first two maps to stay with me so I can use them on third map without picking up them again anyway. Because I have seperate routing plan/options on my third map, that will require the player to use either red key or blue key. This is also to prevent the player from further exploring the later maps without completing the first maps, so a player gets to play the total story.

 

https://zdoom.org/wiki/MAPINFO/Map_definition

 

Spoiler

Screenshot_2024-05-30_00-45-31.png.a046bbd68e84dc601ac8e93273582343.png

 

Share this post


Link to post
  • 0

I don't know exactly how it works, but I have played a WAD in which the player is teleported to a new version of the map that is actually a second, separate map (and they are teleported back again later, too). They retain all keys between these two maps.

 

The command used appears to be Teleport_NewMap.

https://zdoom.org/wiki/Teleport_NewMap

 

I've not used this one myself, but maybe this is what you need? I can't find anything else in this WAD that might be responsible - the scripting and Decorate areas are fairly straightforward.

Share this post


Link to post
  • 0
8 minutes ago, Artinum said:

I don't know exactly how it works, but I have played a WAD in which the player is teleported to a new version of the map that is actually a second, separate map (and they are teleported back again later, too). They retain all keys between these two maps. 

https://doomwiki.org/wiki/Hub

https://zdoom.org/wiki/Hub

 

Share this post


Link to post
  • 0
Posted (edited)
1 hour ago, Artinum said:

I don't know exactly how it works, but I have played a WAD in which the player is teleported to a new version of the map that is actually a second, separate map (and they are teleported back again later, too). They retain all keys between these two maps.

 

The command used appears to be Teleport_NewMap.

https://zdoom.org/wiki/Teleport_NewMap

 

I've not used this one myself, but maybe this is what you need? I can't find anything else in this WAD that might be responsible - the scripting and Decorate areas are fairly straightforward.

Unloved has such kind of setup where you have to collect all six keys across the maps to finally enter the last part of the last map (you also visit a part of last map before, sometime throughout your journey).

 

@Shepardus @kalensar Thank you both very much, I will study them.

Edited by Yousuf Anik

Share this post


Link to post
  • 0
10 hours ago, St. Mildly Annoyed said:

I'm making a mod that will include either a black key card or skull that functions like in normal Doom, with the exceptions of staying throughout a whole episode to unlock a "super secret" map. I know how to make the actual doomkey actor in decorate, but not how to make it carry between levels.

 

keep in mind this wads mapping is done in boom format as well, but there are going to be decorate/zscript items that will require the use of gzdoom, so your answers may not have to be fully vanilla compatible.

Check this.

Maybe it helps.

Share this post


Link to post
  • 0
Posted (edited)

Hey everyone, thanks for the responses, couldn't view them before cause my modem fucking died.

By the time I get home I'll tell you'll if your suggestions work. Also, disregard my mentions of boom, I need to switch formats to udmf

Edited by St. Mildly Annoyed

Share this post


Link to post
  • 0
Posted (edited)

thanks kalensar, works well. Quick question on top of that, any advice on making the black key not take over Doomguy's face in the HUD?

Edited by St. Mildly Annoyed

Share this post


Link to post
  • 0
47 minutes ago, St. Mildly Annoyed said:

thanks kalensar, works well. Quick question on top of that, any advice on making the black key not take over Doomguy's face in the HUD?

Press + button and use the AltHUD

Share this post


Link to post
  • 0
1 hour ago, St. Mildly Annoyed said:

thanks kalensar, works well. Quick question on top of that, any advice on making the black key not take over Doomguy's face in the HUD?

You could remove the +InvBar, but you'd probably want to do some status bar work to give it a place to show up on the UI.

Share this post


Link to post
  • 0
49 minutes ago, St. Mildly Annoyed said:

guess that's a fine solution, I was wondering more about a method using sbarinfo.

 

Well yeah! If you want to a make a custom SBAR then go for it! I've made a few of them over the years. Basically you just write it up how you want it to look and put the switchable graphic into the Key bar so the game can detect it. The INVBAR tactic was just a shortcut to not having to mess with the vanilla GZDoom status bar.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...