Giving custom inventory like weapon upgrades via backpack.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
   +COUNTITEM
   +DONTGIB
   +INVENTORY.ALWAYSPICKUP
   inventory.pickupsound "BACKPK2"
   Inventory.PickupMessage "$GOTBACKPACK"
   States
   {
   Spawn:
      CMPK ABCDEFG 1
      Loop
    Pickup:
        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)
        Stop
   }
}
Inventory code as below.
ACTOR Doom2016ShotgunUpgradeSpawner : CustomInventory //Weapon Spawn
{
   -COUNTITEM
   -INVENTORY.ALWAYSPICKUP
   Inventory.Amount 0
   Inventory.MaxAmount 1
   Inventory.PickupMessage ""
   States
   {
   Spawn:
        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
   Spawn4Reel:
      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
      
   SpawnNothing:
   TNT1 A 0 A_SpawnItem("ShellBoxSpawnIBNew")
   Goto Derp
   
   Spawn2:
   TNT1 A 0 A_SpawnItem("Doom2016GrenadeShotgun")
   Goto Derp
   
   Derp:
   TNT1 A 0
   //TNT1 A -1
   Stop
   }
}
Last edited by wildweasel on Thu Jul 11, 2019 11:39 pm, edited 1 time in total.
Reason: Added [code] tags.
doomguy214
 
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 2 guests