Jump to content

Is it possible to add a GZDoom third weapon state


Mach 7

Recommended Posts

So as the title suggests, Is it possible to add a third weapon state that stays on even through other altfires, like example, brutal doom revenant missile launchers have the auto fire, burst fire, but also the ability to fly, could I do that in vanilla doom? thanks

 

In decorate form too

Edited by Mach 7

Share this post


Link to post

you could go about this a couple ways, i think the quickest way would be to have alt fire cycle through different states with a minimally defined custominventory actor(just tell it the amount possible to have) given or taken to your player to check which firemode/state they're in.

 

here's an example from one of my mods. it changes from full auto to burst fire then to semi auto when altfire is pressed, you can define more 'tokens' to check which firemode you should be in.

Spoiler

actor AutoRifle : Weapon
{
Weapon.SelectionOrder 700
Weapon.SlotNumber 4
Weapon.AmmoUse1 1
Weapon.AmmoGive1 0
Weapon.AmmoType1 "IarAmmo"
Weapon.AmmoUse2 0
Weapon.AmmoGive2 90
Weapon.AmmoType2 "Mag"
Inventory.Icon "MGUNA0"
Inventory.PickupMessage "You got the Infantry Automatic Rifle!"
VisibleToPlayerClass "BTK", "FNB"
Inventory.ForbiddenTo "Rambo", "DoomSlayer"
Obituary "%o was pumped full of holes by %k."
Decal "BulletChip"
AttackSound "weapons/autorifle"
Tag "M27 IAR"
-WEAPON.ALT_AMMO_OPTIONAL
+WEAPON.AMMO_OPTIONAL
+WEAPON.NOALERT
+WEAPON.NOAUTOAIM
+NOEXTREMEDEATH
+WEAPON.NOAUTOFIRE
damagetype "bullets"
States
{
	Ready:
		MIAR A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
		MIAR A 1 A_Lower
		MIAR A 0 A_Lower
		Loop
		Select:
		MIAR A 1 A_Raise
		MIAR A 0 A_Raise
		Loop
	Fire:
		MIAR A 0 A_JumpIfNoAmmo("Reload")
		TNT1 A 0 A_JumpIfInventory("iarBurstFireToken",1,"Burst")
		TNT1 A 0 A_JumpIfInventory("iarSemiToken",1,"Semi")
		MIAR A 0 A_Quake (1, 2, 0, 1, "none")
		MIAR A 0 A_AlertMonsters
		MIAR AA 2 Light("playerfiring") A_GunFlash
		MIAR A 0 A_Jump(123,random(1,7))
		MIAR A 0 A_FireCustomMissile ("tracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,6)
		MIAR A 0 A_FireCustomMissile ("redtracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,4)
		MIAR A 0 A_FireCustomMissile ("greentracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,2)
		MIAR A 0 A_FireCustomMissile ("purpletracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_FireBullets (3, 3, -1, 20, "BulletPuff", FBF_NORANDOM| FBF_USEAMMO)
		MIAR A 0 A_SetPitch(Pitch-2)
		MIAR A 1 A_ReFire
		Goto Ready
	AltFire:
		MIAR A 0 Offset(0,33) A_Playsound ("click")
		TNT1 A 0 A_JumpIfInventory("iarBurstFireToken",1,"FireMode")
		TNT1 A 0 A_JumpIfInventory("iarSemiToken",1,"FireMode2")
		MIAR A 0 A_GiveInventory("iarBurstfireToken", 1)
		TNT1 A 0 A_Print("3 round burst")
		MIAR A 1 Offset(0,33) A_WeaponReady
		Goto Ready
	Firemode:
		MIAR A 0 A_TakeInventory("iarBurstfireToken", 1)
		MIAR A 0 A_GiveInventory("iarSemiToken", 1)
		TNT1 A 0 A_Print("Semi auto")
		Goto Ready
	Firemode2:
		MIAR A 0 A_TakeInventory("iarBurstfireToken", 1)
		MIAR A 0 A_TakeInventory("iarSemiToken", 1)
		TNT1 A 0 A_Print("Full auto")
		Goto Ready
	Burst:
		MIAR A 0 A_JumpIfNoAmmo("Reload")
		MIAR A 0 A_Quake (1, 2, 0, 1, "none")
		MIAR A 0 A_AlertMonsters
		MIAR A 1 FAST Light("Playerfiring") A_GunFlash
		MIAR A 0 A_FireCustomMissile ("tracer", 0, 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_FireBullets (1, 1, 1, 20, "BulletPuff", FBF_NORANDOM | FBF_USEAMMO)
		MIAR A 0 A_JumpIfNoAmmo("Reload")
		MIAR A 0 A_SetPitch(Pitch-1)
		MIAR A 1 FAST A_GunFlash
		MIAR A 0 A_FireCustomMissile ("REDtracer", 0, 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_FireBullets (1, 1, 1, 20, "BulletPuff", FBF_NORANDOM | FBF_USEAMMO)
		MIAR A 0 A_JumpIfNoAmmo("Reload")
		MIAR A 0 A_SetPitch(Pitch-2)
		MIAR A 1 FAST A_GunFlash
		MIAR A 0 A_FireCustomMissile ("Purpletracer", 0, 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_FireBullets (1, 1, 1, 20, "BulletPuff", FBF_NORANDOM | FBF_USEAMMO)
		MIAR A 0 A_SetPitch(Pitch-3)
		Goto Ready
	Semi:
		MIAR A 0 A_JumpIfNoAmmo("Reload")
		MIAR A 0 A_Quake (1, 2, 0, 1, "none")
		MIAR A 0 A_AlertMonsters
		MIAR AA 2 Light("playerfiring") A_GunFlash
		MIAR A 0 A_Jump(123,random(1,7))
		MIAR A 0 A_FireCustomMissile ("tracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,6)
		MIAR A 0 A_FireCustomMissile ("redtracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,4)
		MIAR A 0 A_FireCustomMissile ("greentracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_Jump(256,2)
		MIAR A 0 A_FireCustomMissile ("purpletracer", random(-2,2), 0, 0, -12, 0, random(-1,1))
		MIAR A 0 A_FireBullets (3, 3, -1, 20, "BulletPuff", FBF_NORANDOM| FBF_USEAMMO)
		MIAR A 0 A_SetPitch(Pitch-2)
		Goto Ready
	Flash:
		SHTF AB 1 Bright A_Light1
		Goto LightDone
	Reload:
		MIAR A 0 A_JumpIfInventory("IarAmmo", 30, "Ready")
		MIAR A 0 A_JumpIfInventory("Mag", 1, "ReloadWork")
		MIAR A 1
		Goto Ready
	ReloadWork:
		MIAR B 3 
		MIAR C 3 A_PlaySound ("reload/open")
		MIAR DDD 12 
		MIAR C 3 A_PlaySound ("reload/close")
		MIAR B 3
	ReloadLoop:
		TNT1 A 0 A_TakeInventory("Mag", 1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_GiveInventory("IarAmmo", 1)
		TNT1 A 0 A_JumpIfInventory("IarAmmo", 30, "Ready")
		TNT1 A 0 A_JumpIfInventory("Mag", 1, "ReloadLoop")
		Goto Ready
	ReloadFinished:
		MIAR A 1 offset (0,88)
		MIAR A 1 offset (0,78)
		MIAR A 1 offset (0,68)
		MIAR A 1 offset (0,58)
		MIAR A 1 offset (0,48)
		MIAR A 1 offset (0,38)
		MIAR A 1 offset (0,33)
		Goto Ready
	Spawn:
		MGUN A -1
		Stop
	}
}

actor IarAmmo : Ammo
{
Inventory.MaxAmount 30
+INVENTORY.QUIET
+INVENTORY.KEEPDEPLETED
+INVENTORY.IGNORESKILL
}

actor iarBurstFireToken : Inventory
{
	Inventory.MaxAmount 1
	+INVENTORY.UNDROPPABLE
}

actor iarSemiToken : Inventory
{
	Inventory.MaxAmount 1
	+INVENTORY.UNDROPPABLE
}

 

 

Edited by Grotski

Share this post


Link to post

Specifically, im trying to make a port of brutal dooms revenant launchers and I want to make an alt fire 3 where you can fly but also still shoot the other firing modes

 

Share this post


Link to post

GZDoom allows to have up to eight actions associated to a weapon: regular fire, alternate fire, reload, zoom, and then four "user" actions that have no fixed semantic values: user1, user2, user3, and user4. It's up to you to actually implement these actions however (and, well, you can do largely what you want with them, including using reload and zoom for more attacks).

https://zdoom.org/wiki/Classes:Weapon#Weapon_states

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
Reply to this topic...

×   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...