Jump to content
Sign in to follow this  
Llano

Spawning multiple chemlight in the air.

Recommended Posts

So, i'm trying to spawn 1000 chemlight in the air, that will fall down (cool rain-effect). But i have some problem.

I would like to spawn them in a square, so therefor i made a for-loop.

_unit = _this select 0;
_position = getPos _unit;
_yPos = _position select 1;
_xPos = _position select 0;

_chemY = 0;
_chemX = 1;
for "_x" from 1 to 1000 do
{
if((_chemX / 50) == 1) then
{
	_chemY = _chemY +  1;
	_chemX = 1;
}
_chem = "Chemlight_red" createVehicle [(_xPos + _chemX), (_yPos + _chemY), 100];
_chemX = _chemX + 1;

}

When i run this script, nothing happens. If i remove the if-statement, it spawns 1000 chemlight in a row, 100 distance up in the air.

PS: Yes i'm a noob. Yes i suck at explaining. Yes this is a "for-the-lulz" mission.

Thanks.

Share this post


Link to post
Share on other sites
just a quick visual check: use semicolons after closed brackets "};"

Haha, thank you. It works now!

Share this post


Link to post
Share on other sites

Also -showScriptErrors as start up parameter, that helps immensely.

Share this post


Link to post
Share on other sites
Also -showScriptErrors as start up parameter, that helps immensely.

Ah, alright. Thank you, going to try that out!

Share this post


Link to post
Share on other sites

So how exactly would i go with using this script? That is how do i initialize it? Just wondering.

Share this post


Link to post
Share on other sites
So how exactly would i go with using this script? That is how do i initialize it? Just wondering.

You just put the code in a sqf-file, add a action to your player, and execute the script.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×