Replacing multiple weapons in same slot.

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
User avatar
yuyu3
Posts: 131
Joined: Fri Feb 18, 2011 12:03 pm
Location: In my house

Replacing multiple weapons in same slot.

Post by yuyu3 »

Hello, i am getting crazy in replacing weapons, i need to use some tommyguns as upgrades of each other, and those will be given only if the amount of weapon parts are matched.. Concretelly.

-The first tommy gun must replace the chaingun, nothing else is needed with it.
-The second tommygun(double barrel upgrade) must replace the first tommygun and must spawn only if you have 1 weapon part.
-The third tommygun (triple barreled upgrade) must replace the second tommygun and must spawn oly if you have 2 weapon parts..

Ok so there is what i have,..

Code: Select all

actor Tommygun1 : Weapon Replaces Chaingun
{
   Weapon.SelectionOrder 700
   Weapon.AmmoUse 1
   Weapon.AmmoGive 50
   Weapon.AmmoType "TommAmmo"
   Inventory.PickupMessage "You got the TommyGun!"
   Obituary "%k riddled %o with bullets."
   attacksound "DSTOMFR"
   Decal "BulletChip"
   Weapon.SlotNumber 4
   States
   {
   Ready:
     TOF1 A 1 A_weaponready
		loop
   Deselect:
     TOF1 AA 0 A_lower
		TOf1 A 1 A_lower
		loop
   Select:
     TOF1 AA 0 A_raise
		TOF1 A 1 A_raise
		loop
loop
   Fire:
     TOF1 B 1 bright A_FireBullets (2, 2, 1, 6,"BulletPuff")
     TOF1 B 0 bright A_GunFlash
     TOF1 B 0 A_FireCustomMissile("9mmCasingSpawner",2,0,0,0)
     TOF1 A 3
     TOF1 A 0 A_Refire
     goto Ready
   Flash:
     TNT1 A 3 Bright A_Light1
     Goto LightDone
   Spawn:
     AUTP A -1
     Stop
   }
}

actor Tommygun2 : Weapon Replaces Chaingun
{
inventory.pickupmessage "TommyGun Double-Barreled!"
Weapon.SelectionOrder 701
weapon.ammotype1 "TommAmmo"
weapon.ammogive 50
weapon.ammouse1 2
inventory.pickupsound "TOMPKP"
decal "Bulletchip"
Attacksound "DSTOMFR"
Scale 0.6
weapon.kickback 100
Weapon.SlotNumber 4
states
	{
	spawn:
		TOMM A 4
		loop
	select:
		TOF2 II 0 A_raise
		TOF2 I 1 A_raise
		loop
	deselect:
		TOF2 II 0 A_lower
		TOf2 I 1 A_lower
		loop
	ready:
		TOF2 I 1 A_weaponready
		loop
	fire:
	NULL A 0 A_GunFlash
	NULL A 0 A_JumpifNoAmmo("Ready")
	TOF2 J 1 bright A_firebullets(2, 2, 2, 6,"BulletPuff")
        TOF2 I 3
        Goto Ready
	}
}
ACTOR TommAmmo : Ammo
{
	+INVENTORY.IGNORESKILL
   Radius 10
   Inventory.Amount 50
   Inventory.MaxAmount 500
   Ammo.BackpackAmount 50
   Ammo.BackpackMaxAmount 999
   Inventory.PickupMessage "Picked up some ammo for the tommygun."
   Inventory.Icon "TOMAA0"
   States
   {
   Spawn:
      TOMA A 1 Bright
      Loop
   }
}


actor Tommygun3 : Weapon Replaces Chaingun
{
inventory.pickupmessage "TommyGun Triple-Barreled!!!"
Weapon.SelectionOrder 702
weapon.ammotype1 "TommAmmo"
weapon.ammogive 50
weapon.ammouse1 3
inventory.pickupsound "TOMPKP"
decal "Bulletchip"
Attacksound "DSTOMFR"
Scale 0.6
weapon.kickback 150
Weapon.SlotNumber 4
states
	{
	spawn:
		TOMM A 4
		loop
	select:
		TOF3 A 0 A_raise
		TOF3 A 1 A_raise
		loop
	deselect:
		TOF3 AA 0 A_lower
		TOf3 A 1 A_lower
		loop
	ready:
		TOF3 A 1 A_weaponready
		loop
	fire:
	NULL A 0 A_GunFlash
	NULL A 0 A_JumpifNoAmmo("Ready")
	TOF3 B 1 bright A_firebullets(2, 2, 3, 6,"BulletPuff")
        TOF3 A 3
        Goto Ready
	}
}




ACTOR Shellout
{
   Height 12
   Radius 9
   Speed 4
   Scale 0.45
   PROJECTILE
   +DOOMBOUNCE
   - NOGRAVITY
   SeeSound "weapons/casing2"
   States
   {
   Spawn:
      D3S1 A 0 A_CustomMissile("WWPistolCasing",0,0,random(-100,-80),2,random(-15,15))
      D3S1 ACBHEGFD 1
      Goto Spawn+1
   Death:
      D3S1 A 0 A_Jump(32,8)
      D3S1 A 0 A_Jump(37,8)
      D3S1 A 0 A_Jump(43,8)
      D3S1 A 0 A_Jump(51,8)
      D3S1 A 0 A_Jump(64,8)
      D3S1 A 0 A_Jump(85,8)
      D3S1 A 0 A_Jump(128,8)
      D3S1 A 350
      Stop
      D3S1 B 350
      Stop
      D3S1 C 350
      Stop
      D3S1 D 350
      Stop
      D3S1 E 350
      Stop
      D3S1 F 350
      Stop
      D3S1 G 350
      Stop
      D3S1 H 350
      Stop
   }
}

ACTOR Bulletout
{
   Height 12
   Radius 9
   Speed 4
   Scale 0.45
   PROJECTILE
   +DOOMBOUNCE
   - NOGRAVITY
   SeeSound "weapons/casing1"
   States
   {
   Spawn:
      CAS1 A 0 A_PlaySound("NULL")
      CAS1 ACBHEGFD 1
      Goto Spawn+1
   Death:
      CAS1 A 0 A_Jump(32,8)
      CAS1 A 0 A_Jump(37,8)
      CAS1 A 0 A_Jump(43,8)
      CAS1 A 0 A_Jump(51,8)
      CAS1 A 0 A_Jump(64,8)
      CAS1 A 0 A_Jump(85,8)
      CAS1 A 0 A_Jump(128,8)
      CAS1 A 350
      Stop
      CAS1 B 350
      Stop
      CAS1 C 350
      Stop
      CAS1 D 350
      Stop
      CAS1 E 350
      Stop
      CAS1 F 350
      Stop
      CAS1 G 350
      Stop
      CAS1 H 350
      Stop
   }
}

ACTOR 9mmCasingSpawner     //Borrowed from the in-limbo ZNew mod
{
	Speed 15
	PROJECTILE
	+NOCLIP
	States
	{
	Spawn:
		TNT1 AA 1 A_CustomMissile("Bulletout",0,0,random(-100,-80),2,random(-15,15))
		Stop
	}
}      
Thnks
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: Replacing multiple weapons in same slot.

Post by amv2k9 »

In the Spawn state of the weapon, put a JumpIfInventory that checks for the player having an item that is given when you upgrade. This JumpIf jumps to a state that spawns the upgraded form, then stops, so that the original weapon is removed.
Locked

Return to “Editing (Archive)”