[DECORATE] Help multi-stage weapon

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Okgo5555
Posts: 78
Joined: Thu Mar 23, 2017 11:18 am

[DECORATE] Help multi-stage weapon

Post by Okgo5555 »

I am trying to make a multi stage weapon that simply has different behavior as you pull the trigger. Basically, I want the weapon to select, you press fire, it zooms in, you press fire, it shoots and zooms out and returns to the ready state. AS is, it's all messed up. Is there anyone that can point me in the right direction here? I am working on a vanilla like experience that will be played on a console controller. that is why I am not interested in binding functions to a key on the keyboard. This is about establishing a rhythm and game feel for the weapon, not about maxing out Zdoom's capabilities and flexibility as an sourceport (so yes, I know there is a ZOOM function and an ALTfire function. I'm not using them on purpose).

Code: Select all

ACTOR GaussCannon : DoomWeapon 8000
{
	Weapon.SelectionOrder 480
	Weapon.SlotNumber 5 
	Weapon.AmmoUse1 5
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell"
	Scale .75
	+Weapon.NOAUTOFIRE
	+FRIENDLY
	+Ripper
	Inventory.PickupMessage "You got the Gauss Cannon!"
	+INVENTORY.ALWAYSPICKUP
	Obituary "$OB_BFG"
	Tag "$TAGBFG"
	Decal PlasmaScorch
	States
	{
	Ready:
		GAUS ABC 1 A_WeaponReady 
		GAUS ABC 3 A_WeaponReady 
		Loop
	Ready2:
		RBPY AAAAAAAAAAAAAAA 0 A_ZoomFactor (2.5)
		RBPY ABC 4 A_WeaponReady
		RBPY D   4 A_JumpIf ("Fire","Fire2")
		Loop
	Deselect:
		GAUS A 1 A_Lower
		Loop
	Deselect2:
		GAUS AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
		GAUS A 1 A_Lower		
		Loop		
	Select:
		GAUS A 1 A_Raise
		goto Ready
	Fire:
		GAUS A 1
		goto Ready2
	Fire2:
		RBPY A 17 A_PlaySound ("PLASGET")
		RBPY A 1 bright A_PlaySound ("weapons/RBPYsfire", CHAN_WEAPON)
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"RBPYsExplosion",.5,.25,0,0,0,2,"NONE")
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"RBPYsExplosion",.25,.33,0,0,0,2,"NONE")
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"RBPYsExplosion",0,1,.12,0,0,2,"NONE")
		RBPY A 0	A_GunFlash
		RBPY A 0	A_Quake (3,5,0,750,0)
		RBPY A 0    A_ZoomFactor (1.0)
		GAUS D 1 bright Offset(0,45) A_SetPitch(pitch-2)
		GAUS E 1 bright Offset(0,48) A_SetPitch(pitch-2)
		GAUS E 2 bright Offset(0,48)
		GAUS F 1 bright Offset(0,46) A_SetPitch(pitch+1)
		GAUS F 1 bright Offset(0,44) A_SetPitch(pitch+1)
		GAUS G 1 Offset(0,42) A_SetPitch(pitch+1)
		GAUS G 1 Offset(0,38) A_SetPitch(pitch+1) 
		GAUS A 1 Offset(0,36) 
		GAUS B 1 Offset(0,34) 
		GAUS C 1 Offset(0,33)
		GAUS A 1 Offset(0,32)
		GAUS AAAAAAAAAAAAAAA 0 
		GAUS A 1 
		Goto ready2
	Flash:
		TNT1 I 4 Bright A_Light1
		TNT1 J 3 Bright A_Light2
		Goto LightDone		
	Spawn:
		WEAP D -1 Bright
		Stop
	}
}
For love love of heaven, PLEASE, don't reply with, "you should use Zscript." I am working with DECORATE because it is something that I started a while ago and I am trying to polish up. In any case, I'm not that great at this and clearly haven't mastered what I'm working on yet, so switching scripting tools won't help. I would really appreciate anyone who would have some info to help me tho! Or even point me towards a mod that does do this and I will gladly reverse engineer it on my own.
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: [DECORATE] Help multi-stage weapon

Post by Matt »

For love love of heaven, PLEASE, don't reply with, "you should use Zscript." I am working with DECORATE because it is something that I started a while ago and I am trying to polish up.
I did that in 2017. It took me all of 2017 and I'm still dealing with the fallout of it. Understood.


I'm just looking at the code now, can't test it, but you don't seem to have any way for your fire state to tell whether it's already zoomed. You'll need to check for a dummy inventory item (call it "GaussIsZoomed" or something) that is given when you first press fire and taken away after the shot (and when the weapon is selected, so you never accidentally start out zoomed already).
Okgo5555
Posts: 78
Joined: Thu Mar 23, 2017 11:18 am

Re: [DECORATE] Help multi-stage weapon

Post by Okgo5555 »

Ya, I can't say tat I "get" the custominvetory tricks with weapons yet. Perhaps this is a good way to start. I did some tinkering at got it to work exactly the way I want minus the 2nd trigger pull. To be honest, I like the rhythm and feel of it now. IF there is an easy way to get hack EXACTLY what I described then fine. As it is right now, You press the trigger, it zooms in while it charges, and then shoots, and zooms out. I kinda like it.

Code: Select all

ACTOR GaussCannon : DoomWeapon 8000
{
	Weapon.SelectionOrder 480
	Weapon.SlotNumber 5 
	Weapon.AmmoUse1 5
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell"
	Scale .75
	+Weapon.NOAUTOFIRE
	+FRIENDLY
	+Ripper
	Inventory.PickupMessage "You got the Gauss Cannon!"
	+INVENTORY.ALWAYSPICKUP
	Obituary "$OB_BFG"
	Tag "$TAGBFG"
	Decal PlasmaScorch
	States
	{
	Ready:
		GAUS ABC 3 A_WeaponReady
		Loop
	Ready2:
		RBPY AAAAAAAAAAAAAAA 0 A_ZoomFactor (2.5)
		RBPY AB 3 A_WeaponReady (WRF_NOBOB)
		RBPY CD 4
		goto Fire2
	Deselect:
		GAUS A 1 A_Lower
		Loop	
	Select:
		GAUS A 1 A_Raise
		Loop
	Fire:
		GAUS A 1
		goto Ready2
	Fire2:
		RBPY A 4 A_PlaySound ("PLASGET")
		RBPY BC 4
		RBPY D 5
		RBPY A 1 bright A_PlaySound ("weapons/RBPYsfire", CHAN_WEAPON)
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"GaussExplosion",.5,.25,0,0,0,2,"NONE")
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"GaussExplosion",.25,.33,0,0,0,2,"NONE")
		RBPY A 0	A_RailAttack((80),0,1,"None",White,RGF_SILENT|RGF_FULLBRIGHT|RGF_NOPIERCING,0,"GaussExplosion",0,1,.12,0,0,2,"NONE")
		RBPY A 0	A_GunFlash
		RBPY A 0	A_Quake (3,5,0,750,0)
		RBPY A 0    A_ZoomFactor (1.0)
		GAUS D 1 bright Offset(0,45) A_SetPitch(pitch-2)
		GAUS E 1 bright Offset(0,48) A_SetPitch(pitch-2)
		GAUS E 2 bright Offset(0,48)
		GAUS F 1 bright Offset(0,46) A_SetPitch(pitch+1)
		GAUS F 1 bright Offset(0,44) A_SetPitch(pitch+1)
		GAUS G 1 Offset(0,42) A_SetPitch(pitch+1)
		GAUS G 1 Offset(0,38) A_SetPitch(pitch+1) 
		GAUS A 1 Offset(0,36) 
		GAUS B 1 Offset(0,34) 
		GAUS C 1 Offset(0,33)
		GAUS A 1 Offset(0,32) 
		GAUS A 17 A_WeaponReady
		Goto ready
	Flash:
		TNT1 I 4 Bright A_Light1
		TNT1 J 3 Bright A_Light2
		Goto LightDone		
	Spawn:
		WEAP D -1 Bright
		Stop
	}
}
Okgo5555
Posts: 78
Joined: Thu Mar 23, 2017 11:18 am

Re: [DECORATE] Help multi-stage weapon

Post by Okgo5555 »

Also,

Thanks Matt. Usually when I post a question for help, people just ask why I haven't figure it out myself, or tell me to use Zscript. I appreciate the thoughtful, well meaning reply.
User avatar
Mr.Enchanter
Posts: 481
Joined: Sat Mar 21, 2015 3:22 pm
Location: USA

Re: [DECORATE] Help multi-stage weapon

Post by Mr.Enchanter »

Here's an example in decorate I did for a mod I worked on called NZDE, it has the behaviour you wish to emulate.

Code: Select all

Actor Kar98k : Weapon 10043
{
  Weapon.KickBack 0
  Weapon.AmmoType1 "In_Kar"
  Weapon.AmmoType2 "Reserve_Kar"
  Weapon.AmmoGive1 5
  Weapon.AmmoGive2 9999
  Weapon.AmmoUse 1
  Inventory.PickupMessage "Kar98k"
  Inventory.PickupSound "misc/w_pkup"
  Weapon.SelectionOrder 1400
  Weapon.Slotnumber 1
  +AMMO_OPTIONAL
  +NOAUTOFIRE
  Radius 1
  Height 1
  States
  {
  Spawn:
    KAR9 Z -1
    Loop
  Ready:
    TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSmode",1)
	TNT1 A 0 A_JumpIfInventory("reload",1,"Reload")
	TNT1 A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
	TNT1 A 0 A_JumpIfInventory("throwspec",1,"ThrowSpecial")
	KAR9 A 0 A_JumpIfInventory("knife",1,"Knife")
    KAR9 A 1 A_WeaponReady
    Loop
  Ready.ADS:
    TNT1 A 0 A_JumpIfInventory("reload",1,"Reload")
	TNT1 A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
	TNT1 A 0 A_JumpIfInventory("throwspec",1,"ThrowSpecial")
	KAIM A 0 A_JumpIfInventory("knife",1,"Knife")
    KAIM A 1 A_WeaponReady
    Loop	
	
   Deselect:
     TNT1 A 0 A_Takeinventory("K98KZoomed",1)
     TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_Takeinventory("K98KADSMode",1)
	 KAR9 A 0 A_JumpIfInventory("SpeedCola",1,"Deselect.SpeedSwitch")
     KAR9 A 1 A_Lower
	 KAR9 A 1 A_Lower
	 KAR9 A 0 A_Lower
     Loop
   Deselect.SpeedSwitch:
     TNT1 A 0 A_Takeinventory("K98KZoomed",1)
     TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_Takeinventory("K98KADSMode",1)
     KAR9 A 1 A_Lower
	 KAR9 A 0 A_Lower
	 KAR9 A 0 A_Lower
     Loop
   Select:
     TNT1 A 0 A_Takeinventory("K98KZoomed",1)
     TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_Takeinventory("K98KADSMode",1)     
	 KAR9 A 0 A_JumpIfInventory("SpeedCola",1,"Select.SpeedSwitch")
     KAR9 A 1 A_Raise
	 KAR9 A 1 A_Raise
	 KAR9 A 0 A_Raise
     Loop
   Select.SpeedSwitch:
     TNT1 A 0 A_Takeinventory("K98KZoomed",1)
     TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_Takeinventory("K98KADSMode",1)
     KAR9 A 1 A_Raise
	 KAR9 A 0 A_Raise
	 KAR9 A 0 A_Raise
	 Loop

  Fire:
	KAR9 A 0 A_JumpIfInventory("K98KZoomed",1,"Fire.ADS")
    TNT1 A 0 A_JumpIfNoAmmo("Reload")
	TNT1 A 0 A_JumpIfInventory("DoubleTap",1,"Fire.DoubleTap")
    TNT1 A 0 A_PlayWeaponSound("weapons/kar")
	TNT1 A 0 A_ZoomFactor(0.98)
	TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
	TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
	TNT1 A 0 A_Jump(200,3)
    KAR9 A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
	TNT1 A 0 A_Jump(256,2)
	KAR9 A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
	TNT1 A 0 A_ZoomFactor(0.95)
	KAR9 E 1 BRIGHT A_Light2
	TNT1 A 0 A_ZoomFactor(0.98)
	KAR9 F 1 BRIGHT A_Light1
	KAR9 A 1 A_ZoomFactor(1)
	KAR9 A 16
	TNT1 A 0 A_PlaySound("weapons/karcyc")
	KAR9 ABC 3
	TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
	KAR9 D 4
	KAR9 CBA 3
	KAR9 A 8
    KAR9 A 2 A_WeaponReady
    Goto Ready
  Fire.ADS:
    TNT1 A 0 A_JumpIfNoAmmo("Reload")
	TNT1 A 0 A_JumpIfInventory("DoubleTap",1,"Fire.DoubleTap.ADS")
    TNT1 A 0 A_PlayWeaponSound("weapons/kar")
	TNT1 A 0 A_ZoomFactor(0.98)
	TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
	TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
	TNT1 A 0 A_Jump(200,3)
    KAIM A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
	TNT1 A 0 A_Jump(256,2)
	KAIM A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
	TNT1 A 0 A_ZoomFactor(0.95)
	KAIM B 1 BRIGHT A_Light2
	TNT1 A 0 A_ZoomFactor(0.98)
	KAIM B 1 BRIGHT A_Light1
	KAIM A 1 A_ZoomFactor(1)
	KAR9 A 16
	TNT1 A 0 A_PlaySound("weapons/karcyc")
	KAR9 ABC 3
	TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
	KAR9 D 4
	KAR9 CBA 3
	KAR9 A 8
	KAR9 A 1 A_ZoomFactor(1.6)
    KAR9 A 1 A_WeaponReady
    Goto Ready.ADS	

   AltFire:
    TNT1 A 0 A_JumpIfNoAmmo("Reload")
	TNT1 A 0
	TNT1 A 0 A_JumpIfInventory("K98KZoomed",1,8)
	TNT1 A 0 A_Giveinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.6)
	TNT1 A 0 A_Giveinventory("K98KADSMode",1)
    K98A A 1
    Goto Ready.ADS
    TNT1 AAAAAA 0
    K98A A 1
	TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSMode",1)
    Goto Ready
	
  Fire.DoubleTap:
	TNT1 A 0 A_PlayWeaponSound("weapons/kar")
	TNT1 A 0 A_ZoomFactor(0.98)
	TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
	TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
    KAR9 A 1 A_FireBullets(1.3,1.3,-1,105,"GunSmoke")
	TNT1 A 0 A_ZoomFactor(0.99)
	KAR9 E 1 BRIGHT A_Light2
	KAR9 F 1 BRIGHT A_Light1
	KAR9 A 1 A_ZoomFactor(1)
	KAR9 A 8
	TNT1 A 0 A_PlaySound("weapons/karcyc")
	KAR9 ABC 2
	TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
	KAR9 D 4
	KAR9 CBA 2
	KAR9 A 4
    KAR9 A 1 A_WeaponReady
    Goto Ready
  Fire.DoubleTap.ADS:
    TNT1 A 0 A_PlayWeaponSound("weapons/kar")
	TNT1 A 0 A_ZoomFactor(0.98)
	TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
	TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
	TNT1 A 0 A_Jump(200,3)
    KAIM A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
	TNT1 A 0 A_Jump(256,2)
	KAIM A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
	TNT1 A 0 A_ZoomFactor(0.95)
	KAIM B 1 BRIGHT A_Light2
	TNT1 A 0 A_ZoomFactor(0.98)
	KAIM B 1 BRIGHT A_Light1
	KAIM A 1 A_ZoomFactor(1)
	KAR9 A 8
	TNT1 A 0 A_PlaySound("weapons/karcyc")
	KAR9 ABC 2
	TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
	KAR9 D 4
	KAR9 CBA 2
	KAR9 A 4
	KAR9 A 1 A_ZoomFactor(1.6)
    KAR9 A 1 A_WeaponReady
    Goto Ready.ADS	


  Reload:
	TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSMode",1)
	TNT1 A 0 A_TakeInventory("reload",1)
	TNT1 A 0 A_JumpIfInventory("In_Kar",5,"Ready")
	TNT1 A 0 A_JumpIfInventory("Reserve_Kar",1,"ReloadLoop")
	Goto Ready
  ReloadLoop:
     TNT1 A 0 A_JumpIfInventory("In_Kar",5,"Reloading")
     TNT1 A 0 A_JumpIfInventory("Reserve_Kar",1,1)
	 Goto Reloading
	 TNT1 A 0 A_TakeInventory("Reserve_Kar",1)
	 TNT1 A 0 A_GiveInventory("In_Kar",1)
	 Loop
  Reloading:
     TNT1 A 0 A_JumpIfInventory("SpeedCola",1,"Reloading.SpeedReload")
	 KAR9 A 1 A_PlaySound("weapons/karrel")
	 KAR9 ABCD 3
	 KAR9 D 2 Offset(2,32)
	 KAR9 D 2 Offset(8,32)
	 KAR9 D 2 Offset(24,32)
	 KAR9 D 2 Offset(56,32)
	 KAR9 D 2 Offset(64,32)
	 KAR9 G 8 Offset(-32,32)
	 KAR9 GHIJ 3 Offset(-32,32)
	 KAR9 D 2 Offset(56,32)
	 KAR9 D 2 Offset(24,32)
	 KAR9 D 2 Offset(8,32)
	 KAR9 D 2 Offset(0,32)
	 KAR9 D 16
	 KAR9 DCBA 2
	 TNT1 A 0 A_TakeInventory("reload",1)
	 Goto Ready
  Reloading.SpeedReload:
     KAR9 A 1 A_PlaySound("weapons/karrel")
	 KAR9 ABCD 2
	 KAR9 D 2 Offset(2,32)
	 KAR9 D 2 Offset(8,32)
	 KAR9 D 2 Offset(24,32)
	 KAR9 D 2 Offset(56,32)
	 KAR9 D 2 Offset(64,32)
	 KAR9 G 4 Offset(-32,32)
	 KAR9 GHIJ 2 Offset(-32,32)
	 KAR9 D 2 Offset(56,32)
	 KAR9 D 2 Offset(24,32)
	 KAR9 D 2 Offset(8,32)
	 KAR9 D 2 Offset(0,32)
	 KAR9 D 8
	 KAR9 DCBA 1
	 TNT1 A 0 A_TakeInventory("reload",1)
	 Goto Ready
  
  ThrowGrenade:
  	TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSMode",1)
	KAR9 A 0 A_ZoomFactor(1)
    KAR9 A 1 Offset(0,32)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,72)
	TNT1 A 0 Offset(0,32)
	TNT1 A 0 A_PlaySound("weapons/grenadepin")
	NADE ABCDE 1
	TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
	NADE FGH 1
	TNT1 A 8
    TNT1 A 0 A_PlaySound("weapons/grenadethr") 
	NADE IJK 1
    TNT1 A 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	NADE LM 1
	KAR9 A 1 Offset(0,72)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,32)
	TNT1 A 0 A_TakeInventory("thrownade")
    Goto Ready
  ThrowSpecial:
  	TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSMode",1)
	TNT1 A 0 A_TakeInventory("throwspec")
	TNT1 A 0 A_JumpIfInventory("SpecGrenade_N74ST",1,"ThrowN74ST")
	TNT1 A 0 A_JumpIfInventory("SpecGrenade_Molotov",1,"ThrowMolotov")
	TNT1 A 0 A_JumpIfInventory("SpecGrenade_BouncingBetty",1,"ThrowBouncingBetty")
	Goto Ready
  ThrowN74ST:
    TNT1 A 0 A_JumpIfInventory("N74STAmmo",1,1)
	Goto Ready
	TNT1 A 0 A_TakeInventory("N74STAmmo",1)
    TNT1 A 0 A_TakeInventory("sights",1)
	TNT1 A 0 A_ZoomFactor(1)
    KAR9 A 1 Offset(0,32)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,72)
	TNT1 A 0 Offset(0,32)
	TNT1 A 0 A_PlaySound("weapons/grenadepin")
	N74S ABCD 1
	TNT1 A 2
	TNT1 A 0 A_PlaySound("weapons/grenadethr")
	NADE ABCDE 1
	TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
	NADE FGH 1
	TNT1 A 8
    TNT1 A 0 A_PlaySound("weapons/grenadethr") 
	NADE IJK 1
    TNT1 A 0 A_FireCustomMissile("ThrownN74ST",0,0,0,0)
	NADE LM 1
	KAR9 A 1 Offset(0,72)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,32)
    Goto Ready
  ThrowMolotov:
    TNT1 A 0 A_JumpIfInventory("MolotovAmmo",1,1)
	Goto Ready
	TNT1 A 0 A_TakeInventory("MolotovAmmo",1)
    KAR9 A 0 A_TakeInventory("sights",1)
	KAR9 A 0 A_ZoomFactor(1)
    KAR9 A 1 Offset(0,32)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,72)
	TNT1 A 0 Offset(0,32)
	TNT1 A 0 A_PlaySound("weapons/grenadepin")
	NADE ABCDE 1
	TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
	NADE FGH 1
	TNT1 A 8
    TNT1 A 0 A_PlaySound("weapons/grenadethr") 
	NADE IJK 1
    TNT1 A 0 A_FireCustomMissile("ThrownMolotov",0,0,0,0)
	NADE LM 1
	KAR9 A 1 Offset(0,72)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,32)
	TNT1 A 0 A_TakeInventory("thrownade")
    Goto Ready
  ThrowBouncingBetty:
	TNT1 A 0 A_JumpIfInventory("BouncingBettyAmmo",1,1)
	Goto Ready
    TNT1 A 0 A_TakeInventory("sights",1)
	TNT1 A 0 A_TakeInventory("BouncingBettyAmmo",1)
	TNT1 A 0 A_ZoomFactor(1)
    KAR9 A 1 Offset(0,32)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,72)
	TNT1 A 0 Offset(0,32)
	TNT1 A 0 A_PlaySound("weapons/grenadepin")
	N74S ABCD 1
	TNT1 A 2
	TNT1 A 0 A_PlaySound("weapons/grenadethr")
	NADE ABCDE 1
	TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
	NADE FGH 1
	TNT1 A 8
    TNT1 A 0 A_PlaySound("weapons/grenadethr") 
	NADE IJK 1
    TNT1 A 0 A_FireCustomMissile("BouncingBetty_OnGround",0,0,0,0)
	NADE LM 1
	KAR9 A 1 Offset(0,72)
	KAR9 A 1 Offset(0,56)
	KAR9 A 1 Offset(0,40)
	KAR9 A 1 Offset(0,32)
    Goto Ready
    
  Knife:
  	 TNT1 A 0 A_Takeinventory("K98KZoomed",1)
     TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_Takeinventory("K98KADSMode",1)
     KAR9 A 0 A_JumpIfInventory("Machete",1,"Knife.Machete")
	 KAR9 A 1 Offset(-16,52)
	 KAR9 A 1 Offset(-24,60)
	 KAR9 A 1 Offset(-30,66)
	 KAR9 A 1 Offset(-32,68)
	 KAR9 A 1 Offset(-32,84)
 	 KNIF A 1 Offset(0,32)
	 KNIF A 1 Offset(-4,32)
	 KNIF A 1 Offset(-12,32)
	 TNT1 A 0 A_CustomPunch(4,0,0,"KnifeSlash")
	 KNIF A 1 Offset(-24,32)
	 KNIF B 1 Offset(-40,32)
	 KNIF B 1 Offset(-64,32)
	 KNIF B 1 Offset(-88,32)
	 TNT1 A 0 A_CustomPunch(4,0,0,"KnifePuff")
	 KNIF C 1 Offset(-112,32)
	 KNIF C 1 Offset(-136,32)
	 KNIF C 1 Offset(-160,32)
	 TNT1 A 0 A_CustomPunch(6,0,0,"KnifeSlash")
	 KAR9 A 1 Offset(32,80)
	 KAR9 A 1 Offset(32,64)
	 KAR9 A 1 Offset(30,62)
	 KAR9 A 1 Offset(24,56)
	 KAR9 A 1 Offset(16,48)
	 KAR9 A 1 Offset(0,32)
	 TNT1 A 0 A_TakeInventory("knife",1)
	 Goto Ready
   Knife.Machete:
   	TNT1 A 0 A_Takeinventory("K98KZoomed",1)
    TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_Takeinventory("K98KADSMode",1)
	KAR9 A 1 Offset(-16,52)
	KAR9 A 1 Offset(-24,60)
	KAR9 A 1 Offset(-30,66)
	KAR9 A 1 Offset(-32,68)
	KAR9 A 1 Offset(-32,84)
	TNT1 A 0 ACS_ExecuteAlways(253,0,random(0,-1),random(3,6),0)
	MCHT A 2
    MCHT B 2
	TNT1 A 0 A_CustomPunch(38,0,0,"KnifeSlash")
	MCHT C 2
	MCHT D 2
	TNT1 A 0 A_CustomPunch(38,0,0,"MachetePuff")
	MCHT E 2
	MCHT F 2
	TNT1 A 0 A_CustomPunch(40,0,0,"KnifeSlash")
	KAR9 A 1 Offset(32,80)
	KAR9 A 1 Offset(32,64)
	KAR9 A 1 Offset(30,62)
	KAR9 A 1 Offset(24,56)
	KAR9 A 1 Offset(16,48)
	KAR9 A 1 Offset(0,32)
	TNT1 A 0 A_TakeInventory("knife",1)
	Goto Ready
  NoAmmo:
     KAR9 A 4 A_PlaySound("weapons/noammo")
	 Goto Ready
  }
}

Actor In_Kar : Ammo
{
 Inventory.Amount 1
 Inventory.MaxAmount 5
}
Actor Reserve_Kar : Ammo
{
 Inventory.Amount 1
 Inventory.MaxAmount 50
}

Actor K98KZoomed : Inventory
{
inventory.maxamount 1
}

Actor K98KADSMode : Inventory
{
inventory.maxamount 1
}
User avatar
ramon.dexter
Posts: 1520
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: [DECORATE] Help multi-stage weapon

Post by ramon.dexter »

Okgo5555 wrote:Ya, I can't say tat I "get" the custominvetory tricks with weapons yet.
Think of the custominventory item that it is a variable. When you have it in inventory, the variable is "1". When you dont have it in inventory, the variable is "0". Simple.
Okgo5555
Posts: 78
Joined: Thu Mar 23, 2017 11:18 am

Re: [DECORATE] Help multi-stage weapon

Post by Okgo5555 »

Thanks. That was extremely helpful! DECORATE is the only scripting/code I have ever done besides some html in 1996 and BASIC in highschool.
Post Reply

Return to “Scripting”