Jump to content
Sign in to follow this  
wedge123

Reall basic scriipt help needed

Recommended Posts

As JShock said there is no need to BIS_fnc_MP anything as task creation already does this for you.

You need to change where you have player to true to send it to all clients else your just saying create this task were the object player is local, on a dedicated no one would receive the task and on a hosted only the host would get it.

[
true, //All clients
"task1", 
[ 
	"An enemy tank has been spotted moving into <marker name = marker1> This Town </marker>.Find and eliminate this Armoured threat",
	"Eliminate Enemy Armour",
	"Eliminate Armour"
],
(getMarkerPos "task1"),
true, //Set as current
1, //Task priority
true //Show notification
] call BIS_fnc_taskCreate

Share this post


Link to post
Share on other sites

I would use the FHQ Tasktracker. Easy to use and it works perfectly (at least for me). No need for this nasty BIS_fnc_MP :D

Share this post


Link to post
Share on other sites

Ok sounds good I will try that later .... Funny how I only noticed the player bit when I posted up here!! DUH

Also while I'm asking stupid questions, what's the main difference/reason for using spawn as apposed to call fnc

Thanks

Share this post


Link to post
Share on other sites

When you call a function the code will suspend there until that code is completed and returns a value (whatever that may be), a spawned function is put into a scheduled enviroment, therefore, the code is executed "in the background" and the script contiues with the following lines in the script while the spawned function does whatever.

So main difference is one suspends so a script can get a new returned value and the other schedules the code so the script runs without suspension, this is very similar to execVMing a script. The spawned functions most times contain large loops, sleeps, waitUntils, but the scripter doesn't need the value from the function, he/she nust needs a block of code to run, and sometimes you have to spawn a function because the script is already in a scheduled enviroment and you can't run unscheduled code (suspensions) in a scheduled enviroment (or you'll basically freeze the whole game), so you spawn it to negate the issues with suspension.

Edited by JShock

Share this post


Link to post
Share on other sites

More ridiculous questions coming up im afraid.

Having more trouble with !alive

This time with groups

All i want to do is complete a mission when all 3 enemy squads are dead. Simple huh.....well not for me!! haha

i have

_grp2a = [];

_grp2b = [];

_grp2c = [];

_enemyGrps = ["_grp2a","_grp2b","_grp2c"];

I can make it work with 1 squad using ....

waituntil {{alive _x} count units _grp2a < 1};

However cannot seem to nail it for 3 squads.

Is there a way to do it with an array?? or using && ??

THanks

Wedge

Share this post


Link to post
Share on other sites

Something like this maybe:

{	
{
	_enemyGrps pushBack _x;
} forEach units _x;
} forEach [_grp2a,_grp2b,_grp2c];

Might not work, I'm pretty sure "_x" is local to the scope of each of the forEach loops, but I could be wrong.

Share this post


Link to post
Share on other sites

cant seem to get that to work

Just to explain a little further so im not beating around the bush....

I have 3 enemy squads

_grp2a

_grp2b

_grp2c

and also on friendly squad

_Bravo

so what i really need is a script snippet that says....

wait until _grp2a & _grp2b & _grp2c are dead ["task1", "Succeeded"] call BIS_fnc_taskSetState;

else

If Bravo is dead ["task1", "Failed"] call BIS_fnc_taskSetState;

I really have tried to do this myself and wouldnt waste your time on here but as im still learning and dont get alot of time in the week to do it i really do need some help.

Also would anyone know if i am using this

waituntil {player distance Blah < 2};

will this screw up in MP if i only want it to fire once for the player group in the server???

ie if player one goes it will fire and player 2 will fire it again.

Many thanks once again

Wedge

Share this post


Link to post
Share on other sites

_enemyGrps = [];

{_enemyGrps pushBack _x} forEach units _grp1;
{_enemyGrps pushBack _x} forEach units _grp2;
{_enemyGrps pushBack _x} forEach units _grp3;

while { {alive _x} count units _bravo > 0 } do
{
  if ( {alive _x} count _enemyGrps < 1 ) exitWith {//task complete};
  sleep 10;
};

if ( {alive _x} count units _bravo < 1 ) then {//task failed};

And for your second thing, as long as the script that contains this is only executed once, to a single client, you should be fine, if not, then yes every client that has had this code executed on his machine will have this loop running.

Edited by JShock

Share this post


Link to post
Share on other sites

EDIT!!!

was about to say something stupid. Will try that now thanks Jshock

How easy would it to implement a "remaining enemy #" counter??

---------- Post added at 14:50 ---------- Previous post was at 14:10 ----------

ok so i tried that out and am getting

while { {alive _x} count units #_bravo1 > 0 } do

Error units; type array expected objects,group

_bravo1 has been created as a group earlier in the script

_bravo1 = [getMarkerPos "test2", WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup;

So now im confused as i thought was now classed as a group.

How do i classify _bravo1 as an ingame object?? this maybe where my problems are coming from, not properly understanding how to make things in the script appear as a named object in the game?

Edited by wedge123

Share this post


Link to post
Share on other sites

Try "units group _bravo1" if that does nothing try just "_bravo1".

Share this post


Link to post
Share on other sites

sorry been off for a couple of days.

Tried all the options suggested and it is still telling me its expecting an object?

For instance

Error Group = Type Group, expected object

Im seriously pulling hair out here. :confused:

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  

×