Duke4.net Forums: Splitting the Shrink and Expander Key Binding Issue - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Splitting the Shrink and Expander Key Binding Issue  "Get locked out of the shrinker until you find the expander."

User is offline   HELLMOUSE 

#1

I've split the shrinker and expander into two weapons. Duke must pick each one up separately. However, there is an issue.

The "gotweapon" member in the player struct is useful and most of the coding was just copy and paste from the shrinker. Only problem is if you accidently hit 7 when you have the shrinker, but don't have the expander yet, you'll get locked out of the shrinker. The only way you can select the shrinker again is if you pick up the expander. Another part of the issue is even if you pick up the expander first, you can't select it until you find the shrinker and can flip back and forth. In other words you need both weapons to switch between one and the other.

I doubt that this is a "never encountered it before issue" but I couldn't find anything on the forums about it.

Does anyone know how to fix this problem?
0

User is offline   HELLMOUSE 

#2

This is what I have so far:

// put this somewhere above APLAYER 
gamevar GUN_FUDGE_SH 0 1
gamevar GUN_FUDGE_EX 0 1

// put this under APLAYER actor
getplayer[].gotweapon 6 GUN_FUDGE_SH
getplayer[].gotweapon 11 GUN_FUDGE_EX

ifvare GUN_FUDGE_EX 0
  setplayer[].bsubweapon 6 1 
else
  ifvare GUN_FUDGE_SH 0    
    setplayer[].bsubweapon 11 1


You can pick up the shrinker and get ammo for it. Even if you don't have ammo you still can pull it up. If you don't have the expander, you still can pull up the shrinker if you have it. If you only have the expander and have ammo for it, you can pull it up without the shrinker.

You can have either weapon with its ammo and pull it up without the need for the other weapon. The only problem is if you have the shrinker, but not the expander weapon, and get expander ammo, you get locked out of the shrinker even if the shrinker has ammo. The opposite is not true the other way around for the expander weapon.

The code below seems to have no effect.

// put this somewhere above APLAYER
gamevar GUN_FUDGE_AMMO 0 1

// put this under APLAYER actor
getplayer[].ammo_amount 11 GUN_FUDGE_AMMO

ifvarg GUN_FUDGE_AMMO 0
  ifvare GUN_FUDGE_EX 0
    setplayer[].bsubweapon 6 1


However it is now possible to pick up the shrinker without the expander just as long as you don't get any expander ammo. Contradictory to the previous statement, you can pick up the expander and get ammo for it while at the same time get ammo for the shrinker. Even if you don't have the shrinker weapon, you can still use the expander without getting locked out of it.

This is weird. :)

Please share some ideas. I'm sure there is a solution. Before you answer, run both sets of code to see exactly what I'm talking about.

Uhh, HELLMOUSE. There is no expander actor! How can we test it if it does not exist! :o

Here it is with the shrinker as well. Don't worry, tile 32 should be the expander. If not, then you can use another art tile with this picture. I've made a few changes with the displayed weapon in the game and will make changes to this art tile for the actor, eventually.

Attached File  NEEDED FOR SH-EX TEST.TXT (1.96K)
Number of downloads: 134

Attached Image: DARK_EXPANDER.png
Right click for options and save as a PNG.

This post has been edited by HELLMOUSE: 01 August 2020 - 04:18 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#3

What does setting the bsubweapon x member of the player struct do? I've never seen that before and it's not listed in the wiki.
1

User is offline   HELLMOUSE 

#4

It is used to remember if the player had the shrinker or expander up last time. So, if the player hits the shrinker/expander key the last one that was selected comes up. I wasn't completely sure how it worked but used it to set what weapon the player can bring up. It was a way to force the player to not select the other weapon. It does not look like it is listed in the "Members of the player structure".

Structure members
---Members of the player structure
------subweapon
---------bsubweapon

Under the subweapon description there is a sentance that has a link to bsubweapon in it. "Identical to bsubweapon, except it interprets the value as true/false for each weapon."

here is the link: https://wiki.eduke32...wiki/Bsubweapon

I stumbled on to it from "spritebridge" (the link you gave me). Then I went to "Player structure members" and that took me to the "Category:Player structure members" page.

Another way to get to it is at the very bottom of "Members of the player structure" click "Player manipulation".
Then on the "Category:Player manipulation" page, under subcategory "P", there is "Player structure members‎ (151 P)".
On the "Category:Player structure members" page, under B, is the "Bsubweapon" and, under S, is "Subweapon".

It is a little counterintuitive to find it.
2

User is offline   Danukem 

  • Duke Plus Developer

#5

Making new subweapons are a pain. Personally, I find it goes more smoothly if you just allow the shrinker/expander to be a set (getting one gives the other) instead of fighting the hardcoding. When I want to make a new subweapon that isn't linked that way to an existing weapon, I don't usually put it on the shrinker slot. It takes some work, but you can do it using your own gamevars and hacking events such as next/prev weapon to make it switch to your new weapon in the right place in the lineup. Also add code to the appropriate number key event. There are examples of this in Alien Armageddon and my older mods, although AA probably has the best implementation of it and there are several of them. It might be hard to read the code because there are multiple characters and lots of other stuff to wade through.
1

User is offline   HELLMOUSE 

#6

Solved it. I'm not 100% sure why this works but I don't get locked out of either weapon with any of the in-game situations. This seems to be the only combination of subweapon and bsubweapon that works. I've also allowed for Duke to have an overcharge for each weapon in case the ammo is full and then he picks up the weapon. Of course I had to have a safeguard in my Double Ammo Actors', Boother Math state.

// This goes above APLAYER actor

gamevar HAVE_SHRINKER 0 1
gamevar HAVE_DARKEXP 0 1


// This goes under APLAYER actor

// **** Shrinker and Dark Expander split fix ****

// This is needed so the player does not get locked out of the 
// other weapon until it is picked up.  It also prevents the HUD 
// from showing the wrong ammo status if the player hits “7” again 
// expecting the other weapon to show up when Duke does not have it.                  

getplayer[].gotweapon 6 HAVE_SHRINKER
getplayer[].gotweapon 11 HAVE_DARKEXP

ifvare HAVE_DARKEXP 0
  setplayer[].subweapon 6 
else
  ifvare HAVE_SHRINKER 0    
    setplayer[].bsubweapon 11 1

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#7

View PostDanukem, on 01 August 2020 - 04:49 PM, said:

What does setting the bsubweapon x member of the player struct do? I've never seen that before and it's not listed in the wiki.

It's the same as subweapon, except it works like this:
setplayer[].bsubweapon GROW_WEAPON 1

1

User is offline   HELLMOUSE 

#8

I've listed a few ways to find in on post #4. It is not easy to find.

"setplayer[].bsubweapon 11 1" did not yield the same results as "setplayer[].subweapon 11 1". "setplayer[].subweapon 11 1" locked me out of the expander when I picked-up shrinker ammo without the shrinker.

Using 11 or GROW_WEAPON is the same. "bsubweapon" is expecting a binary value of either 1 or 0. Maybe that's what the "b" stands for.

From Wiki:
"This value is used to "remember" if the player has the Shrinker or Expander selected when changing weapon.
Identical to subweapon, except the it interprets the value as a bitfield for each weapon."

I really don't have anything more than that. Like I said I just started playing around with them and this worked. Maybe "bsubweapon" was a fudge-it factor just for the expander when the makers of Duke Nukem created the Plutonium addition. I can't really tell you more than what the Wiki says and my experiment's results. I was just testing every in-game situation against the positions of "subweapon" vs "bsubweapon" and using one or the other in both "setplayer[]" commands.

Thinking about it. It kind of makes sense. This weird "bsubweapon" only works correctly with the expander not the shrinker, and "subweapon" only works with the shrinker not the expander. That code I have also keeps the ammo set to the shrinker if Duke does not have the expander yet. Before, hitting 7 again with the shrinker would display the expander's ammo which is incorrect.

By the way, I did give both weapons an ammo value of 5 and not 0. Doing that just gives you the ability to pick-up the expander to look at it with 5 rounds. When it was 0 you couldn't bring it up to see 0 and have Duke put it away again. That really didn't mean anything because there is no ammo in it so what's the point?

Well, now people know how to split the shrinker and expander in case they ever want to.

All of this just from a question about a spritebridge.
0

User is offline   HELLMOUSE 

#9

The Dark Expander with some fancy info as part of the sprite.
Attached Image: DARK_EXPANDER_2.png

Idle
Attached Image: DARK_EXPANDER_IDLE.png

Fire
Attached Image: DARK_EXPANDER_FIRE.png
3

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options