Flammable Posted May 14, 2015 Ok so, everytime you pick up ACTOR Backpack, you are getting "Double Inventory Space" and "10 clip 4 shell 1 rocket 20 cell". How to make a custom backpack that does not give ammo? I need just the "double space". I know i can make ACS Script GiveInventory("Backpack", 1); TakeInventory("Clip", 10); TakeInventory("Shell", 4); TakeInventory("RocketAmmo", 1); TakeInventory("Cell", 20); But its lame, since if server has "Double Ammo" flag it wont take all the ammo from backpack, and if server does not, it will take ammo that not supposed to take. And i looked at http://zdoom.org/wiki/Classes:Backpack and http://zdoom.org/wiki/Classes:BackpackItem, but i have no idea then just a lame ACS script. I know that i can use the Inventory.Amount Inventory.MaxAmount Ammo.BackpackAmount Ammo.BackpackMaxAmount for all kind of ammo, but i wanna keep default backpack. Can anyone do that Decorate for me? 0 Share this post Link to post
Gez Posted May 14, 2015 Unfortunately, the ammo per backpack is a property of the ammo type, not the backpack. So that means that the only way you can do an empty backpack is by using a custominventory item that calls a script that changes ammo capacity. There's no pure DECORATE way of doing that -- not without replacing all ammo types and therefore replacing all weapon classes and therefore replacing all player classes, which is probably a bigger hassle than calling ACS. 0 Share this post Link to post
scifista42 Posted May 14, 2015 Make this ACS script: int a1 = CheckInventory("Clip"); int a2 = CheckInventory("Shell"); int a3 = CheckInventory("RocketAmmo"); int a4 = CheckInventory("Cell"); GiveInventory("Backpack", 1); TakeInventory("Clip", 400); TakeInventory("Shell", 100); TakeInventory("RocketAmmo", 100); TakeInventory("Cell", 600); GiveInventory("Clip", a1); GiveInventory("Shell", a2); GiveInventory("RocketAmmo", a3); GiveInventory("Cell", a4); It's a workaround that saves the amount of player's ammo into script variables, gives him a regular backpack, takes all ammo from him, and restores his original ammo from the variables. 0 Share this post Link to post
Flammable Posted May 14, 2015 Gez Hmm, I'v got 2 ideas. I can do the Ammo.BackpackAmount 0 for all kind of ammo, and make the ACTOR Backpack2: Backpack { +INVENTORY.AUTOACTIVATE +INVENTORY.ALWAYSPICKUP inventory.maxamount 1 States { Pickup: TNT1 A 1 A_Giveinventory("Clip",10) TNT1 A 1 A_Giveinventory("Shell",4) TNT1 A 1 A_Giveinventory("Rocketammo",1) TNT1 A 1 A_Giveinventory("Cell",20) stop } } and actor Backpack3 : RandomSpawner 8 { DropItem "Backpack2" } That will make the default backpack not give ammo, and still backpacks with ammo will spawn on the map. But the second idea is better, the only problem is DoubleAmmo flag. Is there a way to make ACS Script check this DoubleAmmo flag and then Execute or "else"? This is how i can make 2 scripts that will take desired amount of ammo. 0 Share this post Link to post
scifista42 Posted May 14, 2015 1. As Gez said, you would have to redefine weapon and player classes as well if you were to redefine ammo types. 2. What if the player picked up the backpack while already having full ammo of some types? Your script wouldn't be reliable, it would take more ammo from the player than he actually got. The script I posted above would be reliable, I think. 0 Share this post Link to post
Flammable Posted May 14, 2015 scifista42 Fantastic, works perfect. Btw, did not seen your reply while quoted Gez. Thank you again ;) 0 Share this post Link to post
Gez Posted May 14, 2015 Flammable said:Hmm, I'v got 2 ideas. I can do the Ammo.BackpackAmount 0 for all kind of ammo, and make the ACTOR Backpack2: Backpack { +INVENTORY.AUTOACTIVATE +INVENTORY.ALWAYSPICKUP inventory.maxamount 1 States { Pickup: TNT1 A 1 A_Giveinventory("Clip",10) TNT1 A 1 A_Giveinventory("Shell",4) TNT1 A 1 A_Giveinventory("Rocketammo",1) TNT1 A 1 A_Giveinventory("Cell",20) stop } } For the record, this wouldn't work; the Pickup state is only run for actors derived from CustomInventory, and Backpack doesn't qualify. Instead of giving a real backpack and monkeying with ammo counts, I'd have the script using SetAmmoCapacity. 0 Share this post Link to post