Help with DECORATE?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
Warhawk
Posts: 161
Joined: Tue Mar 27, 2012 5:48 pm

Help with DECORATE?

Post by Warhawk »

I'm trying to combine 2 types weapons into one using A_GiveInventory. Without the inventory, it'll fire a projectile. When Alt-fire is pressed, the weapon will "check" the inventory and will "give" inventory: "Expander Mode" meaning the weapon has changed to a hit-scanner. Then when Alt-fire is pressed again, it'll "check" and "take" the inventory and it'll return to projectile attack. But I'm stuck and cofused at the Alt-Fire state when it "gives","takes", and "checks" inventory. Help please? Thanks.
Spoiler:
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Help with DECORATE?

Post by Blue Shadow »

Try this...

Code: Select all

  AltFire:
    SHRG A 0 A_JumpIfInventory("ExpanderMode", 1, 2)
    SHRG A 1 A_GiveInventory("ExpanderMode", 1)
    Goto Ready
    SHRG A 1 A_TakeInventory("ExpanderMode", 1)
    Goto Ready
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Help with DECORATE?

Post by Matt »

Code: Select all

  AltFire:
    SHRG A 0 A_JumpIfInventory("ExpanderMode", 1, "RemoveExpanderModeFlag")
    SHRG A 0 A_GiveInventory("ExpanderMode", 1)
    SHRG A 0 A_Refire
    Goto Ready
  RemoveExpanderModeFlag:
    SHRG A 0 A_TakeInventory("ExpanderMode", 1)
    SHRG A 0 A_Refire
    Goto Ready
  AltHold:
    SHRG A 1 A_WeaponReady(WRF_NOFIRE)
    SHRG A 0 A_Refire
    Goto Ready
That way you won't have to perfectly time your altfire press to get the result you want.
Locked

Return to “Editing (Archive)”