Page MenuHomeFeedback Tracker

triggerAmmo doesn't work on some ammo types
Feedback, NormalPublic

Description

triggerAmmo doesn't seem to work on some ammo types.
Examples include: mines, time bombs, grenades, smokes, flares.

This script returns all ammo types that this command doesn't work on, along with their simulation type:

_xx = 0;
_yy = 0;
projectiles = [];
toString {
	getText (_x >> "simulation") != "shotBullet" && {
		_xx = _xx + 100;
		if (_xx > 8000) then {_xx = 0; _yy = _yy + 100};
		_missile = createVehicle [configName _x, [_xx,_yy,1000]];
		triggerAmmo _missile;
		projectiles pushBack [_missile, configName _x, getText (_x >> "simulation")];
		false
	};
} configClasses (configFile >> "CfgAmmo");
initTime = time;
onEachFrame {
	if (time == initTime) exitWith {};
	_list = projectiles select {
		_alive = alive (_x#0);
		deleteVehicle (_x#0);
		_alive
	} apply {[_x#1, _x#2]};
	copyToClipboard (str _list regexReplace [",\[", "\n["]);
	onEachFrame "";
}

These simulation types don't work in vanilla:

["shotSpread"
"shotShell"
"shotSubmunitions"
"shotDeploy"
"shotTimeBomb"
"shotLaser"
"shotMine"
"shotDirectionalBomb"
"shotBoundingMine"
"shotIlluminating"
"shotSmokeX"
"shotGrenade"
"shotCM"
"shotSmoke"
"shotNVGMarker"]

(some are irrelevant though)

Details

Severity
Minor
Resolution
Open
Reproducibility
Sometimes
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

Leopard20 created this task.Mar 7 2022, 2:33 PM
Leopard20 updated the task description. (Show Details)Mar 8 2022, 2:13 PM
Leopard20 updated the task description. (Show Details)Mar 8 2022, 2:24 PM
Leopard20 updated the task description. (Show Details)Mar 8 2022, 2:39 PM
Leopard20 updated the task description. (Show Details)Mar 8 2022, 2:44 PM
dedmen claimed this task.Mar 10 2022, 12:45 PM
dedmen changed the task status from New to Assigned.
dedmen set Ref Ticket to AIII-55002.
dedmen added a comment.EditedMar 10 2022, 1:36 PM

Bullet exploding mid-air does not trigger HitPart ammo event. But Explode is triggered.

shotNVGMarker makes no sense its triggered immediately at creation

Bullet exploding mid-air does not trigger HitPart ammo event. But Explode is triggered.

Well thats bad ish as explode only triggers for explosive bullets. so now you only have deleted event..
But I still think triggers hit in a mid-air self destruction doesn't make sense.
I only trigger Explode for explosive bullets, should we just always trigger on triggerAmmo?
I think I'd prefer just to not have it, then you gotta live with deleted event.

player addEventHandler ["Fired", { 
 params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 
  
systemChat str _projectile;  
 if (isNull _projectile) exitWith {}; 
 _projectile spawn { 
 sleep 0.2; 
systemChat "trigger!";
 triggerAmmo _this; 
  
 } 
}];

this is fun, but it hurts

Also its amazing how many asserts your test code is triggering...

that script doesn't work
it checks if projectile is still alive one frame after it was triggered (btw you can use diag_frameNo instead) but, most projectiles trigger only on next cycle.
And some projectiles just stay alive after getting triggered, like smoke grenades or flares.

I just fixed all of them and tested it, it still reports a large amount as broke, and specifically ALL smoke grenades.

dedmen changed the task status from Assigned to Feedback.Mar 10 2022, 3:21 PM

dev next week, or prof v4, but keep in mind prof is not reliable as everyone would need to have it