Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2020-06-17 17:54        
     
Hi.

Im wondering if its possible to run some type of code when a character (player or AI) becomes aware of an enemy.

I believe the property is a level of knowsabout.

What Im hoping to do is execute anything, even a hint, when the knowsabout level increases from 0 to anything above, or vice versa, as long as its "triggered" by knowsabout increase/decrease.

I know some coding but am really clueless how to make the game "monitor" the characters knowsabout level.

Very thankful.

Added 1 hour later:

Ive discovered the function BIS_fnc_enemyTargets.

If I could use the return value, which returns the variable name, and run a command with the variable name in a hint, such as: "bob1 is shooting at you!" or anything it would be huge success!

OK, Ive hit upon:

shot.sqf

_myEnemy = player call BIS_fnc_enemyTargets;

hint str _myEnemy;

Edit2:

So far so good, just have to do add some stuff when I get detected by enemy.
I dont know if an detected by trigger is what I need ATM, but I'm gonna try some stuff.

Edit3:
Im having problems with:
_enemyPos = player call BIS_fnc_enemyTargets;

_pos = player getHidefrom _enemyPos;
Since getHidefrom wont run on an array, is there a workaround for this?

Edit4:
this is the current solution:
_enemyPos = player call BIS_fnc_enemyTargets;

_enemas = selectRandom _enemyPos;

hint str _enemas;

This post was edited by addeps4 (2020-06-17 21:28, 167 days ago)