Płonące obiekty - particleEffects

Edytor Arma3 - dyskusje i zapytania o tworzeniu misji, skryptów oraz programowaniu.

Moderator: Inkwizytor

ODPOWIEDZ
Awatar użytkownika
Sejtan
Posty: 112
Rejestracja: 03 kwietnia 2007, 20:54
ID Steam: sejtan24
Numer GG: 6538171
Lokalizacja: Starogard Gdański

Płonące obiekty - particleEffects

Post autor: Sejtan »

Witam.
W pierwszej odsłonie kampanii w jednej z misji dochodzi do ataku na Camp Maxwell. Po ataku obóz płonie... Widać mniejsze, lub większe pożary. Udało mi się dokopać do skryptu odpowiedzialnego za te ogniska...

Kod: Zaznacz cały

[] spawn
{
	sleep 0.01;

	private["_fn_createEffect"];

	_fn_createEffect =
	{
		private["_effect","_pos","_fire","_smoke"];
		private["_light","_brightness","_color","_ambient","_intensity","_attenuation"];

		//["[PARTICLE EFFECT CREATED]: %1",_this] call BIS_fnc_logFormat;

		_pos 	= _this select 0;
		_effect = _this select 1;

		_fire	= "";
		_smoke	= "";
		_light	= objNull;

		/*
		_color		= [1,0.85,0.6];
		_ambient	= [1,0.45,3];
		*/

		_color		= [1,0.85,0.6];
		_ambient	= [1,0.3,0];


		switch (_effect) do
		{
			case "FIRE_SMALL":
			{
				_fire 	= "SmallDestructionFire";
				_smoke 	= "SmallDestructionSmoke";
			};
			case "FIRE_MEDIUM":
			{
				_fire 	= "MediumDestructionFire";
				_smoke 	= "MediumDestructionSmoke";

				_brightness	= 1.0;
				//_color	= [1,0.85,0.6];
				//_ambient	= [1,0.3,0];
				_intensity	= 400;
				_attenuation	= [0,0,0,2];
			};
			case "FIRE_BIG":
			{
				_fire 	= "BigDestructionFire";
				_smoke 	= "BigDestructionSmoke";

				_brightness	= 1.0;
				//_color	= [1,0.85,0.6];
				//_ambient	= [1,0.45,3];
				_intensity	= 1600;
				_attenuation	= [0,0,0,1.6];
			};
			case "SMOKE_SMALL":
			{
				_smoke 	= "SmallDestructionSmoke";
			};
			case "SMOKE_MEDIUM":
			{
				_smoke 	= "MediumSmoke";
			};
			case "SMOKE_BIG":
			{
				_smoke 	= "BigDestructionSmoke";
			};
		};

		if (_fire != "") then
		{
			_eFire = "#particlesource" createVehicleLocal _pos;
			_eFire setParticleClass _fire;
			_eFire setPosATL _pos;
		};

		if (_smoke != "") then
		{
			_eSmoke = "#particlesource" createVehicleLocal _pos;
			_eSmoke setParticleClass _smoke;
			_eSmoke setPosATL _pos;
		};

		//create lightsource
		if (_effect in ["FIRE_BIG","FIRE_MEDIUM"]) then
		{
			_pos   = [_pos select 0,_pos select 1,(_pos select 2)+1];
			_light = createVehicle ["#lightpoint", _pos, [], 0, "CAN_COLLIDE"];
			_light setPosATL _pos;

			_light setLightBrightness _brightness;
			_light setLightColor _color;
			_light setLightAmbient _ambient;
			_light setLightIntensity _intensity;
			_light setLightAttenuation _attenuation;
			_light setLightDayLight false;
		};
	};

	#define FIRE_SMALL	"Sign_Pointer_Yellow_F"
	#define FIRE_MEDIUM     "Sign_Arrow_Large_Cyan_F"
	#define FIRE_BIG        "Sign_Arrow_Large_Pink_F"
	#define SMOKE_SMALL     "Sign_Pointer_Green_F"
	#define SMOKE_MEDIUM    "Sign_Pointer_Blue_F"
	#define SMOKE_BIG	"Sign_Arrow_Large_Blue_F"

	private["_helperClass","_effectType"];

	{
		_helperClass 	= _x select 0;
		_effectType 	= _x select 1;

		{
			[getPosATL _x,_effectType] call _fn_createEffect;
		}
		forEach (allMissionObjects _helperClass);
	}
	forEach
	[
		[FIRE_SMALL,"FIRE_SMALL"],
		[FIRE_MEDIUM,"FIRE_MEDIUM"],
		[FIRE_BIG,"FIRE_BIG"],
		[SMOKE_SMALL,"SMOKE_SMALL"],
		[SMOKE_MEDIUM,"SMOKE_MEDIUM"],
		[SMOKE_BIG,"SMOKE_BIG"]
	];
};

... ale za cholerę nie wiem jak tego użyć :/
Zwykłe n = [pos1, "SMOKE_MEDIUM"] execVM "skrypt.sqf" nie działa :/
Ktoś wie, jak zrobić z tego użytek?
Awatar użytkownika
Sejtan
Posty: 112
Rejestracja: 03 kwietnia 2007, 20:54
ID Steam: sejtan24
Numer GG: 6538171
Lokalizacja: Starogard Gdański

Re: Płonące obiekty - particleEffects

Post autor: Sejtan »

Problem rozwiązany... Jak by kogoś to interesowało, to... To wpisujemy np. w init.sqf:

Kod: Zaznacz cały

BIS_fn_createFireEffect = {
	private["_effect","_pos","_fire","_smoke"];
	private["_light","_brightness","_color","_ambient","_intensity","_attenuation"];

	_pos 	= _this select 0;
	_effect = _this select 1;

	_fire	= "";
	_smoke	= "";
	_light	= objNull;
	_color		= [1,0.85,0.6];
	_ambient	= [1,0.3,0];

	switch (_effect) do {
		case "FIRE_SMALL" : {
			_fire 	= "SmallDestructionFire";
			_smoke 	= "SmallDestructionSmoke";
		};
		case "FIRE_MEDIUM" : {
			_fire 	= "MediumDestructionFire";
			_smoke 	= "MediumDestructionSmoke";
			_brightness	= 1.0;
			_intensity	= 400;
			_attenuation	= [0,0,0,2];
		};
		case "FIRE_BIG" : {
			_fire 	= "BigDestructionFire";
			_smoke 	= "BigDestructionSmoke";
			_brightness	= 1.0;
			_intensity	= 1600;
			_attenuation	= [0,0,0,1.6];
		};
		case "SMOKE_SMALL" : {
			_smoke 	= "SmallDestructionSmoke";
		};
		case "SMOKE_MEDIUM" : {
			_smoke 	= "MediumSmoke";
		};
		case "SMOKE_BIG" : {
			_smoke 	= "BigDestructionSmoke";
		};
	};

	if (_fire != "") then {
		_eFire = "#particlesource" createVehicleLocal _pos;
		_eFire setParticleClass _fire;
		_eFire setPosATL _pos;
	};

	if (_smoke != "") then {
		_eSmoke = "#particlesource" createVehicleLocal _pos;
		_eSmoke setParticleClass _smoke;
		_eSmoke setPosATL _pos;
	};

	//create lightsource
	if (_effect in ["FIRE_BIG","FIRE_MEDIUM"]) then {
		_pos   = [_pos select 0,_pos select 1,(_pos select 2)+1];
		_light = createVehicle ["#lightpoint", _pos, [], 0, "CAN_COLLIDE"];
		_light setPosATL _pos;

		_light setLightBrightness _brightness;
		_light setLightColor _color;
		_light setLightAmbient _ambient;
		_light setLightIntensity _intensity;
		_light setLightAttenuation _attenuation;
		_light setLightDayLight false;
	};
};
a tak to wywołujemy:

Kod: Zaznacz cały

[getPosATL pos1,"FIRE_BIG"] call BIS_fn_createFireEffect; 
i jeszcze krótki opis... Skrypt umożliwia uzyskanie efektu:
"FIRE_BIG" - duży ogień
"FIRE_MEDIUM" - średni ogień
"FIRE_SMALL" - mały ogień

"SMOKE_BIG" - duży dym
"SMOKE_MEDIUM" - średni dym
"SMOKE_SMALL" - mały dym
W tym przypadku nazwa płonącego obiektu to pos1. I to by było na tyle :)
Flanker
Posty: 38
Rejestracja: 08 listopada 2008, 19:43
ID Steam:
ID gracza: 0

Re: Płonące obiekty - particleEffects

Post autor: Flanker »

Ale mam pytanie, jak zrobić żeby przez ten skrypt co podałeś ogień pozostawał na ruchomym pojeździe, bo jak widzę przy odpaleniu skryptu ogień pozostaje, tam gdzie został aktywowany na pojeździe ?




Jest jeszcze prostszy sposób wpisując w inicie jednostki :

Kod: Zaznacz cały

wokka = "test_EmptyObjectForFireBig" createVehicle position this; wokka attachTo[this,[0,4,-1]];
szybszy sposób, ale gorszy efekt, np. w nocy nie widać jak się obiekt pali, w dzień wszystko dobrze śmiga.
Awatar użytkownika
Sejtan
Posty: 112
Rejestracja: 03 kwietnia 2007, 20:54
ID Steam: sejtan24
Numer GG: 6538171
Lokalizacja: Starogard Gdański

Re: Płonące obiekty - particleEffects

Post autor: Sejtan »

A podpaliłeś pojazd czy np element logiczny który stoi w miejscu pojazdu? Jeśli tak to sprawę powinieneś załatwić komendą attach.
Flanker
Posty: 38
Rejestracja: 08 listopada 2008, 19:43
ID Steam:
ID gracza: 0

Re: Płonące obiekty - particleEffects

Post autor: Flanker »

zrobiłem tak jak napisałeś wyżej, dałem w aktywacji wyzwalacza

Kod: Zaznacz cały

[getPosATL pos1,"FIRE_BIG"] call BIS_fn_createFireEffect; 
i niestety pojazd, w moim wypadku samolot nie palil się, a ogien został w miejscu pojazdu tam gdzie się aktywowal. Jak razem użyć tego z attach ? Na dodatek tam gdzie pojawil sie ogien (w powietrzu, na bylej pozycji A-10), na ziemi tez pojawil sie czarny dym... nie wiem jak z tym sobie poradzic


EDIT
dałem komendę na ogień do obiektu logicznego i przyłączyłem obiekt komendą

Kod: Zaznacz cały

pos1 attachTo[h1,[0,0,0]];
do pojazdu, ale dalej i tak nie działa, ogień pojawia się tylko tam gdzie przedtem stał pojazd
Grippen
Posty: 110
Rejestracja: 16 czerwca 2015, 19:17
ID Steam:

Re: Płonące obiekty - particleEffects

Post autor: Grippen »

Sejtan pisze:A podpaliłeś pojazd czy np element logiczny który stoi w miejscu pojazdu? Jeśli tak to sprawę powinieneś załatwić komendą attach.
A probowales podpinac ten skrypt pod BlastCore? Bo zauwazylem ze z BC nie dziala i wg mnie wyglada dziadosko skromnie z daleka :)
ODPOWIEDZ

Wróć do „Edycja - tworzenie misji, skrypty oraz programowanie”