getHideFrom – Talk

From Bohemia Interactive Community
Revision as of 08:14, 25 April 2015 by Benargee (talk | contribs)
Jump to navigation Jump to search

From the few tests I've done, this function always returned me [0,0,0]. Has anyone been able to get a correct result?--Whisper 17:21, 10 April 2007 (CEST)

I got a result. But the only result I got, is the position from the enemy... not very helpful.
Friendly Unit: fu1, Enemy: e1
hidepos = fu1 gethidefrom e1;
Now hidepos = (getpos e1). Not exactly the same... but very close!
And nothing to find about it in the www... that's hard...
--HeliJunkie 10:47, 4 December 2008 (CET)
The command is used in the formation.fsm of the characters.pbo. It is used in conjunction with two other commands: getHideFrom -> findCover -> setHideBehind
Could it be that it does not return the real position of the enemy but the suspected one?
--Worldeater 23:47, 25 February 2009 (CET)
It seems to me that the returned position is where object beleives enemy is. Test it while breaking LOS between the units, and the returned position extrapolates the expected postion based on the last known position and speed of the enemy. A returned position of [0,0,0] implies that object does not knowAbout enemy. --Ceeeb 10:58, 22 October 2009 (CEST)

Operation Script Sample

Place a unit in the editor and name him baddy for this example. It may help to give the unit some waypoints in an urban area. This command needs unit movement to function better. Put this into the debug console in a3:

coverMarkerActual = createMarker ["coverMarkerActual", position player];
coverMarkerActual setMarkerType "mil_objective";
coverMarkerActual setMarkerColor "ColorGreen";
coverMarkerActual setMarkerText "Actual Position";

coverMarkerAssumed = createMarker ["coverMarkerAssumed", position player];
coverMarkerAssumed setMarkerType "hd_objective";
coverMarkerAssumed setMarkerColor "ColorRed";
coverMarkerAssumed setMarkerText "Assumed Position";
cover3dMarker = createVehicle ["Sign_Sphere100cm_F", position player, [], 0, "None"];

run = true;
0 spawn {
	while {run} do {
		pos = player getHideFrom baddy;
		cover3dMarker setpos pos;
		"coverMarkerActual" setmarkerpos getPosVisual baddy;
		"coverMarkerAssumed" setmarkerpos pos;	
	};
};

Here you will see two markers. One marker will show the exact position of the unit, the other, the position according to getHideFrom. You will observe that the assumed position is exactly the same ass the default unit marker.You will also notice a sphere indicating the position given by getHideFrom. If the unit prones, you can observe the sphere going down too. If you give the game enough time, getHideFrom will reset back to [0,0,0] when units is out of sight. --Benargee (talk) 09:14, 25 April 2015 (CEST)