heretic wheel weapon

Ask gaming related questions
hereticnext
Posts: 1
Joined: 16 Feb 2024, 05:18

heretic wheel weapon

Post by hereticnext » 16 Feb 2024, 05:41

I need a function in the heretic game for dosbox pure because I am going to play on a console with few buttons. The game has weapons configured from 1 to 6 on the keyboard. For example, the j key will need to act as the previous weapon (for example, if I have weapon 1 and I touch it, it will be 6, if I touch it again, it will be 5 and so on. successively) and the letter k which would be the next key (if I have weapon 1 and I touch it would be 2 and so on) the game already starts with weapon 1 selected

Rohwedder
Posts: 7732
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: heretic wheel weapon

Post by Rohwedder » 16 Feb 2024, 12:11

Hallo,
perhaps?:

Code: Select all

#Requires AutoHotkey v2.0
Global weapon := 1
j:: {
	Global
	Send ++weapon := Mod(weapon+4, 6)
}
k:: {
	Global
	Send ++weapon := Mod(weapon, 6)
}

User avatar
WarlordAkamu67
Posts: 230
Joined: 21 Mar 2023, 06:52

Re: heretic wheel weapon

Post by WarlordAkamu67 » 16 Feb 2024, 12:31

Rohwedder wrote:
16 Feb 2024, 12:11
Hallo,
perhaps?...
Great thinking on just adding to swap "back down"! I love it! I commented out a modified version of yours below mine. I used a number line including negatives, which got me in a bit of trouble...

Code: Select all

#Requires AutoHotkey v2.0

j::
k:: {
  static number_of_Weapons := 6
  static weapon_Index := 0
  Switch(A_ThisHotkey) {
    Case("j"):
      increment_Value := -1
    Case("k"):
      increment_Value := 1
    Default:
      return
}
  weapon_Index := weapon_Index + increment_Value
  weapon_Value := Mod(weapon_Index, number_of_Weapons)
  (weapon_Index < 0) ? (weapon_Value := weapon_Value + number_of_Weapons + 1) : (weapon_Value := weapon_Value + 1)
  (weapon_Value = 7) ? (weapon_Value := 1) : ""
  Send(weapon_Value)
  return
}

; ---------- ; ---------- ; ---------- ; ---------- ; ---------- ;

/*
j::
k:: {
  static weapon := 1
  Switch(A_ThisHotkey) {
    Case("j"):
      Send ++weapon := Mod(weapon+4, 6)
    Case("k"):
      Send ++weapon := Mod(weapon, 6)
    Default:
      return
}
  return
}
*/

User avatar
Noitalommi_2
Posts: 285
Joined: 16 Aug 2023, 10:58

Re: heretic wheel weapon

Post by Noitalommi_2 » 17 Feb 2024, 06:04

Hi.

@hereticnext
I just wonder what exactly is a “console with few buttons” ?

Anyway, in Heretic, keys 1 - 7 are used for weapons, so there is one more slot and the starting weapon is 2 and varies depending on which weapon equipped you save the game with.
And if there is no particular reason that you are using DosBox then you can also play Heretic with a modern Doom source port such as GZDoom, which has key assignments for next/prev. weapon.

Post Reply

Return to “Gaming”