Jump to content
Sign in to follow this  
1para{god-father}

BIS_fnc_spawnGroup issue

Recommended Posts

make sure to add a unit of that side on the map, you can set the probability to 0 in the unit placement window so he will not actually be there.

Share this post


Link to post
Share on other sites

Damnit, I was just going to say that I accidentally must have deleted my probability 0 unit from the mission and added him back and everything now works fine, but you're so fast you beat me to it. lol

---------- Post added at 11:20 PM ---------- Previous post was at 10:35 PM ----------

In an Invasion 1944 mission I made, I had a trigger covering just the runway, that when players flew at a certain height over the trigger, it would rearm them, but when I tested it in coop multiplay, for some reason the trigger wouldn't work after players and their vehicles respawned. I never finished working on the mission, but I don't know how to go about fixing it so it works after respawning.

I want to do the same in this mission and be able to rearm, repair and refuel like players do in battlefield 2 when they fly over their runway or carrier. I figure it's the best method since some guys have a lot of trouble landing, plus I wanted to avoid having players cluttering the runway with their planes or crashing into each other etc, especially when others are trying to take off. A simple return to base runway low-flyby and you ready for more action. Maybe set the player damage to 0 too.

I think I used this as the condition:

this && {((getPosATL _x) select 2) < 30} count thislist > 0

I can't remember what I had for "on activation" for setFuel, setVehicleAmmo, setDamage etc. In any case, I need to figure out how to make it work for all players and make sure it works when they respawn.

Share this post


Link to post
Share on other sites

exelent idea, but you should really make a seperate thread for that so others can find it by searching.

Share this post


Link to post
Share on other sites

True.

---------- Post added at 12:55 AM ---------- Previous post was at 12:54 AM ----------

I want to make sure I am doing this correctly. I'm using Takistan map and we start out at the South Eastern Airstrip. I placed 6 markers spread out 3000m apart from each other to the north/north west outer area of the map and named them: "planeGrp1Start", "planeGrp2Start", "planeGrp3Start", "planeGrp4Start", "planeGrp5Start" and "planeGrp6Start". I Then placed 6 more markers spaced 1000m apart near the north/north west inner/center of the map where I want each group of 2 planes planes to patrol and named these markers "planeGrp1Patrol", "planeGrp2Patrol", "planeGrp3Patrol", "planeGrp4Patrol", "planeGrp5Patrol" and "planeGrp6Patrol". I then made 6 copies of the script and named the files "spawnPlaneGrp1.sqf", "spawnPlaneGrp2.sqf", "spawnPlaneGrp3.sqf", "spawnPlaneGrp4.sqf", "spawnPlaneGrp5.sqf" and "spawnPlaneGrp6.sqf". I also change the group names and start and patrol locations in each file, so for example "spawnPlaneGrp3.sqf" would look like this:

_null = [] spawn {

waituntil {!isnil "bis_fnc_init"};
_type = "Su34";
_side = EAST;
_pos = getMarkerPos "planeGrp3Start";
_dir = 180;
_height = 500;

_patrol = getMarkerPos "planeGrp3Patrol";
_range = 1000;

_mainGrp = createGroup _side;
while {true} do {
_vehicles = [];
_amount = 2;
while {_amount != 0} do {
	_amount = _amount - 1;
	_leader = [[_pos select 0,_pos select 1, _height], _dir, _type, _side] call bis_fnc_spawnvehicle;
	_veh = _leader select 0;
	_grp = _leader select 2;
	(crew _veh) joinSilent _mainGrp;
	_veh flyInHeight _height;
	_vehicles = _vehicles + [_veh];
	sleep 3;
	deleteGroup _grp;
};
_patrol = [_mainGrp, _patrol, _range] call bis_fnc_taskPatrol;
waitUntil {({canMove _x} count _vehicles) == 0};
sleep 10;
};

};

I removed the script that was in red.

I then have a trigger at the end of the runway that is set to be activated by BLUFOR "once" with the condition "this", I named the trigger "spawnTrigger" and in the "on activation" field I have this:

_null = [] execVM "SpawnPlaneGrp1.sqf"; _null = [] execVM "SpawnPlaneGrp2.sqf"; _null = [] execVM "SpawnPlaneGrp3.sqf"; _null = [] execVM "SpawnPlaneGrp4.sqf"; _null = [] execVM "SpawnPlaneGrp5.sqf"; _null = [] execVM "SpawnPlaneGrp6.sqf";

Then I have another trigger that then deletes the first trigger 5 seconds later and put in the "on activation" field: "deleteVehicle spawnTrigger;" so the trigger cannot be reactivated by players that join later in the mission. I'm not sure if this is the best method, but it seems to work.

So, everything seems to be working correctly, but am I executing the vehicle group spawn scripts correctly in the trigger, and I'm also not sure if I need to rename some of the variables in each script file, for instance for "SpawnPlaneGrp3.sqf", should "_mainGrp = createGroup _side;" be changed to "_mainGrp3 = createGroup _side;"? What variables would need to be changed in each script file - if any? I just want this mission to be setup perfectly.

Share this post


Link to post
Share on other sites

The way to run this is many, your trigger method would be one of them.

only thing you need to change is the marker names in the code, rest is _local variables, meaning they have no affect on other scripts.

and ofc the different options as height etc and the types of planes spawned if that is not all su34´s.

ive actually just been flying around in takistan battling su34´s with a f35 using this code, its quite fun and relaxing in a twisted sort of way :D

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  

×