Forum Jump :

Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location: Ft. Bragg
Occupation: 14 T patriot ls operator us ARMY
Age:
In-game name: o0ster or eric

 
#1 Posted at 2014-03-23 04:47        
     
is there any way to extend the life of a chemlight or make a chemlight last for ever? i saw on bi forums these scripts.
_chemLight = createVehicle ["Chemlight_green", _somePosition, [], 0, "CAN_COLLIDE"]; 

waitUntil { isNull _chemLight }; 

hint "ChemLight has been deleted!";  


while {true} do
{
   _chemLight = "Chemlight_green" createVehicle (position LOGICNAME);
   sleep 900;
   deleteVehicle _chemLight;
};

but i have no idea what im suppose to do with these scripts or where to put them

help please

This post was edited by Big (2014-03-23 05:42, ago)

derp

Author Message


Posts: 317
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: BrotherhoodOfHam

 
#2 Posted at 2014-03-23 13:16        
     
Hi :-)
Create a file in your mission folder called chemlight.sqf and put inside of it:

private ["_position", "_type", "_chemLight"];
_position= [_this, 0, (getPos (_this select 0)), [[], objNull]] call BIS_fnc_param;
_type= [_this, 1, "Chemlight_green", [""]] call BIS_fnc_param;

while {true} do
{
   _chemLight = _type createVehicle _position;
   sleep 900;
   deleteVehicle _chemLight;
};

To execute it, create a Game Logic at where you want to place your chem light and put in its init line:
nul= [getPos this] execVM "chemlight.sqf";

If that does not work then replace the stuff inside chemlight.sqf with this:

private ["_position", "_type", "_chemLight"];
_position= _this select 0;
_type= _this select 1;

while {true} do
{
   _chemLight = _type createVehicle _position;
   sleep 900;
   deleteVehicle _chemLight;
};

And then replace the stuff inside the gameLogic with this:

nul= [getPos this, "Chemlight_green"];

Let me know how it goes, I haven't tested it yet ;-)

Some delicious stuff:
3D marker script
Some WIP delicious stuff:
Modular Customization Interface

Advertisement


Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location: Ft. Bragg
Occupation: 14 T patriot ls operator us ARMY
Age:
In-game name: o0ster or eric

 
#3 Posted at 2014-03-23 19:45        
     
neither scripts worked :L

derp

Author Message


Posts: 317
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: BrotherhoodOfHam

 
#4 Posted at 2014-03-23 20:08        
     
:-(
Worth a shot.
Create a file called init.sqf and then put

while {true} do
{
   _chemLight = "Chemlight_green" createVehicle (getPos object);
   sleep 900;
   deleteVehicle _chemLight;
};

Make sure you place an object and then name it object

Some delicious stuff:
3D marker script
Some WIP delicious stuff:
Modular Customization Interface

Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location: Ft. Bragg
Occupation: 14 T patriot ls operator us ARMY
Age:
In-game name: o0ster or eric

 
#5 Posted at 2014-03-23 20:15        
     
so do i have to make like multiple lines for multiple chemlights like this?

while {true} do
{
   _chemLight = "Chemlight_green" createVehicle (getPos object);
   sleep 900;
   deleteVehicle _chemLight;
};
while {true} do
{
   _chemLight = "Chemlight_green" createVehicle (getPos object2);
   sleep 900;
   deleteVehicle _chemLight;
};

Added 10 minutes later:

it didnt work... um what if i changed the sleep value? to like 10000

nvm that didnt work either


wow im dumb i forgot to save my init as all file types instead of .txt give me a few minutes

le 5 minutes later

ok so that works, my only question i have left is the sleep value if i just change that... but i'll test that for another time


thank you so much for explaining this to me

Added 21 minutes later:

ok so how do i do this for multiple chemlights i tried the script that i posted in the previous post but that didnt work only 1 chem light works

This post was edited by o0ster (2014-03-23 21:23, ago)

derp

Author Message


Posts: 317
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: BrotherhoodOfHam

 
#6 Posted at 2014-03-23 22:23        
     
For multiple chemlights replace _chemlight with _chemlight1... _chemlight2... etc. And also you have to use the command spawn so the loops will run parallel:

[] spawn 
{
	while {true} do
	{
	   _chemLight = "Chemlight_green" createVehicle (getPos object);
	   sleep 900;
	   deleteVehicle _chemLight;
	};
};

[] spawn 
{
	while {true} do
	{
	   _chemLight2 = "Chemlight_green" createVehicle (getPos object2);
	   sleep 900;
	   deleteVehicle _chemLight2;
	};
};

That SHOULD work but I am not sure. Also the sleep bit just leave alone. What it means is that after 900 seconds a new chemlight spawns when the old one stops.
But yeah give it a go.

Some delicious stuff:
3D marker script
Some WIP delicious stuff:
Modular Customization Interface

Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location: Ft. Bragg
Occupation: 14 T patriot ls operator us ARMY
Age:
In-game name: o0ster or eric

 
#7 Posted at 2014-03-23 23:25        
     
it worked! thanks again man

derp

Author Message


Posts: 317
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: BrotherhoodOfHam

 
#8 Posted at 2014-03-23 23:30        
     
No problem, glad I could help. :-D

Some delicious stuff:
3D marker script
Some WIP delicious stuff:
Modular Customization Interface