How to change the ammo limits when you create a New skill

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!)
TheMightyLostSoul
Posts: 1
Joined: Mon Sep 06, 2021 9:23 am

How to change the ammo limits when you create a New skill

Post by TheMightyLostSoul »

Hello, I'm new here and sorry for my bad english, english is not my first language.
So, I want to make a new Skill and I want to modify the limit of ammo.
For exmeple the max of bullets it's 200, but I want to change this limit to a higher number. And how to do this for backpack as well. I want to do this for all ammo type.
Thanks for answer.
maxx_tnt
Posts: 3
Joined: Wed Sep 01, 2021 5:45 am

Re: How to change the ammo limits when you create a New skil

Post by maxx_tnt »

There's probably a better way to do this but the one I would personally use is this:

1 - Make multiple separate weapon actors that can hold different ammo capacities (eg: Pistol_Easy, Pistol_Normal, Pistol_Hard)
2 - Make a new CustomInventory actor and use a ACS script on PickUp to give player a different weapon depending on current skill level
3 - Replace the base weapon with that CustomInventory item
User avatar
Player701
 
 
Posts: 1401
Joined: Wed May 13, 2009 3:15 am
Discord: Player701#8214
Graphics Processor: nVidia with Vulkan support
Location: Russia

Re: How to change the ammo limits when you create a New skil

Post by Player701 »

maxx_tnt wrote:1 - Make multiple separate weapon actors that can hold different ammo capacities (eg: Pistol_Easy, Pistol_Normal, Pistol_Hard)
You will also have to redefine the ammo types themselves, along with all their specific ammo pickups (e.g. both the ammo box and the clip will have to be defined for each skill).
maxx_tnt wrote:2 - Make a new CustomInventory actor and use a ACS script on PickUp to give player a different weapon depending on current skill level
3 - Replace the base weapon with that CustomInventory item
Note that this will break item respawning and weapon stay. Use ReplaceActor in the skill definition instead.

You will also have to assign weapon slots via Weapon.SlotNumber or in the player class defintion.
Jarewill
Posts: 1334
Joined: Sun Jul 21, 2019 8:54 am

Re: How to change the ammo limits when you create a New skil

Post by Jarewill »

You can also use SetAmmoCapacity in ACS.
You can detect the current skill with GameSkill.

Return to “Scripting”