Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Meyumi39

A trigger that activates when an opfor unit is killed by the player?

Recommended Posts

Hello there, I'm a bit new to these forums but I couldn't find a solution for what I'm trying to do so I figured I would make an account an ask.

I'm looking to make a trigger that activates when an opfor unit within a specified zone is killed specifically by the player. Previously I used a trigger that activated when there was simply 1 less opfor unit within its radius, but this has proven to be extremely prone to activating when its not supposed to. 

Is there any way to do this? I've come across some vaguely similar posts asking about triggers being activated by civilians killed by the player, but unfortunately my coding skills are not good enough to rework that into what im attempting to do.

Share this post


Link to post
Share on other sites

Hi, if you mean that an activator is triggered, when an AI dies, you can use the !alive. In the activator put:

!alive objetive;

I don't know if that's what you meant.

Share this post


Link to post
Share on other sites
8 minutes ago, CPT_ALPHA said:

Hi, if you mean that an activator is triggered, when an AI dies, you can use the !alive. In the activator put:


!alive objetive;

I don't know if that's what you meant.

Thats partly what Im looking for, but i'm more specifically looking for a way for the game to be able to tell if the enemy has been specifically killed by a player.

Share this post


Link to post
Share on other sites

Likely better off using an event handler for this rather than a trigger.

Something like...

//initServer.sqf

TheZone = /* trigger, marker, location or area [ [ x, y ], radiusX, radiusY, dir, isRectangle ] */ ;

addMissionEventHandler[ "EntityKilled", {
	params[ "_killed", "_killer", "_instigator", "_useEffects" ];
	
	if (isNull _instigator) then { _instigator = UAVControl vehicle _killer select 0 };
	if (isNull _instigator) then { _instigator = _killer };
	
	if ( !isPlayer _killed && { isPlayer _instigator && { side group _killed isEqualTo east && { _killed inArea TheZone }}} ) then {
		//Do what ever here
	};
}];

 

  • Like 2

Share this post


Link to post
Share on other sites
On 6/20/2023 at 10:42 AM, Larrow said:

Likely better off using an event handler for this rather than a trigger.

Something like...


//initServer.sqf

TheZone = /* trigger, marker, location or area [ [ x, y ], radiusX, radiusY, dir, isRectangle ] */ ;

addMissionEventHandler[ "EntityKilled", {
	params[ "_killed", "_killer", "_instigator", "_useEffects" ];
	
	if (isNull _instigator) then { _instigator = UAVControl vehicle _killer select 0 };
	if (isNull _instigator) then { _instigator = _killer };
	
	if ( !isPlayer _killed && { isPlayer _instigator && { side group _killed isEqualTo east && { _killed inArea TheZone }}} ) then {
		//Do what ever here
	};
}];

 

This seems to do exactly what I was hoping for! Thank you so much

Share this post


Link to post
Share on other sites

×