Duke4.net Forums: Double Ammo Issue - Duke4.net Forums

Jump to content

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

Double Ammo Issue  "An actor that adds BOTH types of ammo at the same time."

User is offline   HELLMOUSE 

#1

Remember in Hexen how some of the power-ups would give you both mana's. I'm trying to do the same thing. The only problem is if one is at full already, I can't pick up the item even if the other ammo type is less than full.

I've made an ammo type that adds ammo for both the Shrinker and Expander at the same time. Only problem is, lets say the Shrinker is at full, I can't gain ammo for the other weapon, which is the Expander in this case. If one ammo type is full, the sprite has no effect on the other ammo type.

Does anyone have a suggestion?

This post has been edited by HELLMOUSE: 17 June 2020 - 07:08 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer

#2

The addammo command will abort code execution if the weapon being added to is already full, therefore any lines following in that actor/state will not be executed. There are several ways around this. The most straightforward way is to not use that command at all and learn how to check and set the player's ammo_amount members directly. Use the wiki to learn how to do this, it is all there.
3

User is offline   HELLMOUSE 

#3

I've spent enough time on that wiki and need to get back to everything else. I'm sure there is a way to do it, but for now I have lots of other stuff to do. It's not game breaking. Maybe preventing the player from wasting ammo is a good thing, because the actor is for people who like to use the shrinker and expander.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#4

Instead of "addweapon", use this:
  ife player[].gotweapon SHRINKER_WEAPON 1
  ife player[].gotweapon GROW_WEAPON 1
  ifge player[].ammo_amount SHRINKER_WEAPON player[].max_ammo_amount SHRINKER_WEAPON
  ifge player[].ammo_amount GROW_WEAPON player[].max_ammo_amount GROW_WEAPON
    break
  setplayer[].gotweapon SHRINKER_WEAPON 1
  setplayer[].gotweapon GROW_WEAPON 1
  addammo SHRINKER_WEAPON 10
  addammo GROW_WEAPON 10


Instead of "addammo", use this:
  ifge player[].ammo_amount SHRINKER_WEAPON player[].max_ammo_amount SHRINKER_WEAPON
  ifge player[].ammo_amount GROW_WEAPON player[].max_ammo_amount GROW_WEAPON
    break
  addammo SHRINKER_WEAPON CRYSTALAMMOAMOUNT
  addammo GROW_WEAPON GROWCRYSTALAMMOAMOUNT

1

User is offline   HELLMOUSE 

#5

Thanks, I'll try this out.
0

User is offline   HELLMOUSE 

#6

View PostFox, on 22 June 2020 - 07:03 PM, said:

Instead of "addweapon", use this:
  ife player[].gotweapon SHRINKER_WEAPON 1
  ife player[].gotweapon GROW_WEAPON 1
  ifge player[].ammo_amount SHRINKER_WEAPON player[].max_ammo_amount SHRINKER_WEAPON
  ifge player[].ammo_amount GROW_WEAPON player[].max_ammo_amount GROW_WEAPON
    break
  setplayer[].gotweapon SHRINKER_WEAPON 1
  setplayer[].gotweapon GROW_WEAPON 1
  addammo SHRINKER_WEAPON 10
  addammo GROW_WEAPON 10

Hmm, I'm not sure if I need this part.



View PostFox, on 22 June 2020 - 07:03 PM, said:

Instead of "addammo", use this:
  ifge player[].ammo_amount SHRINKER_WEAPON player[].max_ammo_amount SHRINKER_WEAPON
  ifge player[].ammo_amount GROW_WEAPON player[].max_ammo_amount GROW_WEAPON
    break
  addammo SHRINKER_WEAPON CRYSTALAMMOAMOUNT
  addammo GROW_WEAPON GROWCRYSTALAMMOAMOUNT

This part looks like what I'm talking about. I've tested it, but I still have the same problem. If one is maxed, then Duke doesn't pick up the sprite. You're still using "addammo" which seems to be preventing him from using the object. Even without "addammo" it doesn't work, because there is no way to add anything.

I'm wondering if there is a way to load Duke's ammo amount and the amounts of the power-ups into "vars" and add them together. I did notice some math operations and ways to access the player's structs. Again, I'm not sure of the syntax and some of the commands don't have anything.

Thanks for the advice though.
0

User is online   Trooper Dan 

  • Duke Plus Developer

#7

I don't think Fox intended to use "addammo" since the whole point was to avoid the problem caused by that command.
1

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