Giving custom inventory like weapon upgrades via backpack.

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.

Giving custom inventory like weapon upgrades via backpack.

Postby doomguy214 » Thu Jul 11, 2019 11:20 pm

Is it possible to give custom inventory via backpack with code below :-
Code: Select allExpand view
ACTOR AmmoSuply : BackpackItem Replaces Backpack
   Game Doom
   Height 26
   inventory.pickupsound "BACKPK2"
   Inventory.PickupMessage "$GOTBACKPACK"
        TNT1 A 0 A_GiveInventory("ShellBox", 1)
        TNT1 A 0 A_GiveInventory("ClipBox", 1)
        TNT1 A 0 A_GiveInventory("CellPack", 1)
        TNT1 A 0 A_GiveInventory("RocketBox", 1)
Inventory code as below.
ACTOR Doom2016ShotgunUpgradeSpawner : CustomInventory //Weapon Spawn
   Inventory.Amount 0
   Inventory.MaxAmount 1
   Inventory.PickupMessage ""
        TNT1 A 0
      TNT1 A 0 A_JumpIf(CallACS("GameplayPreset_IB")==1, "SpawnNothing")//Arsenal
      TNT1 A 0 A_JumpIf(CallACS("GameplayPreset_IB")==2, "Spawn4Reel")//Doom 2016
      TNT1 A 0 A_JumpIf((CallACS("GameplayPreset_IB")==3)||(CallACS("GameplayPreset_IB")==7), "SpawnNothing")//Conjoined (:P)
      TNT1 A 0 A_JumpIf(CallACS("GameplayPreset_IB")==4, "Spawn4Reel")//JRMYXD Arsenal
      TNT1 A 0 A_JumpIf(CallACS("GameplayPreset_IB")==5, "SpawnNothing")//JRMYXD Classic
      TNT1 A 0 A_JumpIf(CallACS("GameplayPreset_IB")==6, "SpawnNothing")//JRMYXD Insanity
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==1, "SpawnNothing")//Default
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==2, "Spawn4Reel")//Doom 2016
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==3, "SpawnNothing")//Extra Arsenal
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==4, "Spawn4Reel")//JRMYXD Arsenal
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==5, "SpawnNothing")//JRMYXD Classic
      TNT1 A 0 A_JumpIf(CallACS("UpgradePresets_IB")==6, "SpawnNothing")//JRMYXD Insanity
      TNT1 A 0
      TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DisableUpgrade")==1,"SpawnNothing")
      TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("NoDoom2016ShotgunUpgrade")==1,"SpawnNothing")
      TNT1 A 0 A_JumpIF(ACS_NamedExecuteWithResult("IBArsenalUpgradeToggle")==1,"SpawnNothing")
      TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("Doom2016UpgradeToggle")==1,"SpawnNothing")
      TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("JRMYXDARsenalUpgradeToggle")==1,"SpawnNothing")
      Goto Spawn2
   TNT1 A 0 A_SpawnItem("ShellBoxSpawnIBNew")
   Goto Derp
   TNT1 A 0 A_SpawnItem("Doom2016GrenadeShotgun")
   Goto Derp
   TNT1 A 0
   //TNT1 A -1
Last edited by wildweasel on Thu Jul 11, 2019 11:39 pm, edited 1 time in total.
Reason: Added [code] tags.
Joined: 17 Feb 2015

Re: Giving custom inventory like weapon upgrades via backpac

Postby Void Weaver » Fri Jul 12, 2019 12:51 am

doomguy214 wrote:Pickup:
TNT1 A 0 A_GiveInventory("ShellBox", 1)
The 'Pickup:' state should be used only for CustomInventory NOT for Inventory or BackpackItem.

Anyway you should either make ZScript custom Backpack OR make CustomInventory with ammo cap increasing via ACS smth like as:
'SetAmmoCapacity("<your_ammo_type>",GetAmmoCapacity("<your_ammo_type>")+<additional_cap_value_of_your_ammo_type>);' and with yours weapon upgrades, both into Pickup state.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
Joined: 18 Dec 2014

Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests