Einzelnen Beitrag anzeigen
Alt 24.05.2012, 23:11   #19 (permalink)
xezon
10 Jahre hx3
500 Beiträge1000 Beiträge2.500 Beiträge
 
Benutzerbild von xezon
 
Registriert seit: 31.03.2003
Beiträge: 2.533
Standard

So hab jetzt mal versucht nen manager zwischenzulegen aber die particles sind nun weg. Habs erstmal nur aufm player laufen. Ne idee wo es stockt? Execution kommt bei breathlogic.sqf an und läuft auch durch.

breathmanager.sqf
Code:
func_breathCond = compile preprocessFile "scripts\breathcond.sqf";
_func_breathLogic = compile preprocessFile "scripts\breathlogic.sqf";

while {true} do
{
	_near = [player];//nearestObjects[player, ["Man"], 500];
	{
		_hasBreath = _x getVariable["hasBreath", 0]==1;
		_canBreath = _x call func_breathCond;		
		if(!_hasBreath && _canBreath) then { [_x, 0.03] spawn _func_breathLogic; }
	}
	forEach _near;
	sleep 10;
}
breathcond.sqf
Code:
_isAlive = alive _this;
_isOnFoot = vehicle _this == _this;
_isCloseToPlayer = _this distance player<500;
_isCinematic = screenToWorld[0.5, 0.5] distance player>5;

/*return*/ _isAlive && _isOnFoot && (_isCloseToPlayer || _isCinematic)
breathlogic.sqf
Code:
private ["_unit", "_int"];
_unit = _this select 0;
_int = _this select 1; // intensity of fog (0 to 1)

_unit setVariable ["hasBreath", 1];

while {_unit call func_breathCond} do
{
	sleep (2 + random 2);

	_source = "logic" createVehicle (getpos _unit);
	_fog = "#particlesource" createVehicle getpos _source;
	_fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0],
	"", 
	"Billboard", 
	0.5, 
	0.5, 
	[0,0,0],
	[0, 0.2, -0.2], 
	1, 1.275,    1, 0.2, 
	[0, 0.2,0], 
	[[1,1,1, _int], [1,1,1, 0.01], [1,1,1, 0]], 
	[1000], 
	1, 
	0.04, 
	"", 
	"", 
	_source];
	_fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10];
	_fog setDropInterval 0.001;

	_headDir = _unit call CBA_fnc_modelHeadDir;
	_radius = 0.1;
	_headX = sin(_headDir select 1)*_radius;
	_headY = 0.15-sin(abs(_headDir select 1))*_radius;
	_headZ = (_headDir select 2)/360-0.03;
	_source attachto [_unit, [_headX, _headY, _headZ], "neck"];

	sleep 0.5;
	deleteVehicle _source;
	deleteVehicle _fog;
};

_unit setVariable ["hasBreath", nil];
xezon ist offline