Page 1 of 1

Removing ammo without removing weapons

Posted: Sat Nov 05, 2022 10:03 pm
by Kismet
I made a mutator that removes some ammo from the level. Weapons must remain. I do it like this (ordinary code):

Code: Select all

function bool CheckReplacement(Actor other, out byte bSuperRelevant) {
	if (other.IsA('BioAmmo')) {
		return false;
	}
	return true;
}
But at the same time, those ammo that are in the weapon are also removed. Please tell me how to separate ammo in weapons from ammo on the ground.

P.S. English is not my native language.

Re: Removing ammo without removing weapons

Posted: Sat Nov 05, 2022 11:09 pm
by Barbie
Add the condition IsInState('Pickup'):

Code: Select all

function bool CheckReplacement(Actor other, out byte bSuperRelevant) {
	if (other.IsA('BioAmmo') && Other.IsInState('Pickup')) return false;
	return true;
}
(untested)

Re: Removing ammo without removing weapons

Posted: Sat Nov 05, 2022 11:35 pm
by Kismet
Unfortunately not working.

When the player gets the weapon, script always runs CheckReplacement() for its ammo (I knew it before). And other.IsInState('Pickup') also return true.

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 12:42 am
by Buggie
Just iterate over All actors on map start and destroy ammo.
This partially help. Dynamically created ammo will be left.

Another approach - spawn custom actor which held link to ammo. On first tick it check in which state ammo. if it is pickup, then ammo destroyed.
At end first tick helper actor destroy self.

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 12:49 am
by Kismet
Thanks for the reply. But I just found simple solution:

Code: Select all

Inventory(other).MyMarker != none
Ammo that spawns on the ground contains a navigation point in that property.

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 5:25 am
by Buggie
Usual ammo yes. But some mods can spawn or drop ammo to ground without it. Or it can be produced be breakable things and so on.
If this not case, your way must work fine.

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 9:12 am
by sektor2111
Replacing/Removing ammo during "Level.bStartUp" - it takes in account even those without "Marker" and no further replacements are in account.

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 2:26 pm
by papercoffee
just replace ammo with decoration... :mrgreen:

Re: Removing ammo without removing weapons

Posted: Sun Nov 06, 2022 9:35 pm
by sektor2111
papercoffee wrote: Sun Nov 06, 2022 2:26 pm just replace ammo with decoration... :mrgreen:
That's easy...