Jump to content
Sign in to follow this  
matte54

Respawn / attack / fnc spawngroup

Recommended Posts

Hi im trying to get a script going using functions ive been searching around the forum for information, but i really cant se what im doing wrong.

So i have to crawl to the new topic button so i can get a fresh pair of eyes on this.

This was my first attempt, but this made nothing happen what so ever.

And no script errors.

waitUntil {!isNil "bis_fnc_init"};
if (isServer) then
{
//Arry för kisar
_unitArry =
[
"TK_INS_Soldier_2_EP1",
"TK_INS_Soldier_EP1",
"TK_INS_Soldier_4_EP1",
"TK_INS_Soldier_AT_EP1",
"TK_INS_Soldier_TL_EP1",
"TK_INS_Soldier_AA_EP1",
"TK_INS_Soldier_AR_EP1",
"TK_INS_Bonesetter_EP1",
"TK_INS_Soldier_MG_EP1"
];

//Utångspunkter
_pos1 = getMarkerPos "insbase1";
_pos2 = getMarkerPos "insbase2";
_pos3 = getMarkerPos "insbase3";
_pos4 = getMarkerPos "insbase4";
_insBaseArry = [_pos1, _pos2, _pos3, _pos4];

//Destinationer
_pos5 = getMarkerPos "swebase1";
_pos6 = getMarkerPos "swebase2";
_pos7 = getMarkerPos "swebase3";
_pos8 = getMarkerPos "swebase4";
_sweBaseArry = [_pos5, _pos6, _pos7, _pos8];

//Randomisering
_base = _insBaseArry call BIS_fnc_selectRandom;
_target = _sweBaseArry call BIS_fnc_selectRandom;
_unit1 = _unitArry call BIS_fnc_selectRandom;
sleep 0,2;
_unit2 = _unitArry call BIS_fnc_selectRandom;

//Spawna shittet
//_group = Creategroup East;
//_guy1 = _group createUnit ["_unit1", [(_base) select 0,(_base) select 1,0], [], 3, "FORM"];
//_guy2 = _group createUnit ["_unit2", [(_base") select 0,(_base) select 1,0], [], 3, "FORM"];
_spawnGroup = [_base, EAST, ["_unit1", "_unit2"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;

//Skicka iväg dom till waypoint
_wp = _spawngroup addWaypoint [_target, 0];
_wp setWaypointType "SAD"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointBehaviour "AWARE";

};

so after a bit of hair pulling i thought ill start over and take a diffrent approach so i came up with this.

Makes the group spawn BUT wont get the waypoint.

Same story btw no script errors showing.

waitUntil {!isNil "bis_fnc_init"};
if (isServer) then
{

_pos1 = getMarkerPos "swebase1";
_pos2 = getMarkerPos "swebase2";
_pos3 = getMarkerPos "swebase3";
_pos4 = getMarkerPos "swebase4";
//_sweBaseArry = [_pos1, _pos2, _pos3, _pos4];

while{alive insbase_1} do 
{
_rndNumber =round(random 1);
if(_rndNumber == 1) then
	{

	_spawngroup = [getMarkerpos "insbase1", EAST, ["TK_INS_Soldier_2_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_AR_EP1","TK_INS_Bonesetter_EP1"]] call BIS_fnc_spawnGroup;

	}else{

	_spawngroup = [getMarkerpos "insbase1", EAST, ["TK_INS_Soldier_MG_EP1","TK_INS_Soldier_AT_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_2_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_AR_EP1","TK_INS_Bonesetter_EP1"]] call BIS_fnc_spawnGroup;

	};

	_target = [_pos1, _pos2, _pos3, _pos4] call BIS_fnc_selectRandom;

		_wp = _spawngroup addWaypoint [(_target), 0];
		_wp setWaypointType "SAD"; 
		_wp setWaypointSpeed "FULL";	
		_wp setWaypointBehaviour "AWARE";

		waitUntil {sleep 10; ({alive _x} count units _spawngroup) == 0};
		sleep 10;
};






};

Im starting to think it has something to do with BIS_fnc_selectRandom, but i really dont see how.

Edit: and yes i have functions module out, and a center.

Edited by Matte54

Share this post


Link to post
Share on other sites

I think you have your waypoint stuff wrong.

_wp setWaypointType "SAD";

should be:-

[_spawngroup,1] setWaypointType "SAD";

There might be other errors but that stuck out.

Scripting_Commands

EDIT: You should try to use the code tags when posting code.... otherwise it is too hard to read.

Edited by twirly

Share this post


Link to post
Share on other sites
I think you have your waypoint stuff wrong.

_wp setWaypointType "SAD";

should be:-

[_spawngroup,1] setWaypointType "SAD";

There might be other errors but that stuck out.

Scripting_Commands

EDIT: You should try to use the code tags when posting code.... otherwise it is too hard to read.

Sorry, thought it would be better with spoiler.

Anyway i looked at your proposal, and reason i have my waypoints the way it is, its becouse it works perfect in other scripts that way.

I tried

[_spawngroup,1] setWaypointType "SAD";

as you suggested but it just gives me "type any expected group"

But atleast it gives me a script error :P

For example in another mission this works perfect.

	_group1 = Creategroup East;
	_unit1 = _group1 createUnit ["TK_INS_Soldier_4_EP1", [(getMarkerPos "spawner1") select 0,(getMarkerPos "spawner1") select 1,0], [], 3, "FORM"];
	_unit2 = _group1 createUnit ["TK_INS_Soldier_TL_EP1", [(getMarkerPos "spawner1") select 0,(getMarkerPos "spawner1") select 1,0], [], 3, "FORM"];
	_unit3 = _group1 createUnit ["TK_INS_Soldier_Sniper_EP1", [(getMarkerPos "spawner1") select 0,(getMarkerPos "spawner1") select 1,0], [], 3, "FORM"];

	_wp1 = _group1 addWaypoint [(getmarkerpos "targetins"), 0];
	_wp1 setWaypointSpeed "FULL";
	_wp1 setWaypointType "SAD";
	_wp1 setWaypointCompletionRadius 150;

update : Ive managed to get it to working, by making the script run globaly (ie without the _")

Not sure why, if anyone knows feel free to tell me.

Edited by Matte54

Share this post


Link to post
Share on other sites

In a spawn script of my own, I use copyWaypoints to set the group paths. Saves time on waypoint scripting. You put down any unit in the editor, give him waypoints as if he were the leader of the group you're going to spawn, and in his init line put something like

Plan1Group = Group this; DeleteVehicle this;

Then when you want to set the spawned group's waypoints, you just do

_grp1 copyWaypoints Plan1Group;

Not tested in MP though.

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  

×