Jump to content
Sign in to follow this  
_qor

Evaluate enemy with a specific vehicle as Target

Recommended Posts

Hey,

 

 

I want to have a code which returns the enemy which has fired at a specific vehicle. So is there any code which works like assignedTarget but in reverse?

The problem with findNearestEnemy is, that another enemy might be nearer to the vehicle but is absolutely unimportant for the scenario.

 

Perhaps there is a way doing the same with findNearestEnemy?

 

Thanks!

Share this post


Link to post
Share on other sites

But I need something that fires even if the rocket fails to hit the vehicle.

 

I thought about using waitUntil {behaviour leader _vehicle ==  "COMBAT"} to then evalute by which unit this has been executed and if this unit is attacking the vehicle.

Share this post


Link to post
Share on other sites

I don't think there is any command for this unfortunately, the firednear eventhandler only work over a short distance and fired doesn't return a target.

 

Line of sight combined with the fired EVH may work although I haven't looked at that for a while.

It may be able to tell what the AI is looking at when he fires the weapon but from past experience it's not 100% reliable.

 

Line of sight would be a function or script made by using the  lineintersects   commands, ther should be examples knocking around.

https://forums.bistudio.com/topic/128002-line-of-sight-example-thread/?hl=lineintersects

Share this post


Link to post
Share on other sites

Didnt know that command, I will give it a try!

But combining lineintersects and "fired" may not be a solution as far as I add the eventHandler to all enemies in game.

So the code should get executed from the vehicle which is under fire.

 

"Max hardcoded distance is 1000m" could be a problem, because it should be about an helicopter and an AA ground unit, which targets the heli when it is about 2000m away.

 

 

 

EDIT: IncomingMissile EVH should work! I realize to post more information next time ;D This EVH works great for this special purpose.

 

But there is another problem: the EVH doesnt work for players firing a not guided missile ._.

Share this post


Link to post
Share on other sites

Maybe a "fired" event handler that evaluates a unit's assignedTarget?

But each intended unit would need to have it, and would fail if target has not been assigned.

Share this post


Link to post
Share on other sites

Ya I solved it with "Incoming Missile" EVH.

 

I guess there is no way to detect unguided missiles which hasnt been targeted at the helicopter without rather complicated scripting.

Its hard to hit a flying chopper with a non guided rocket anway ;D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×