Jump to content
Sign in to follow this  
0ps

Need different set of objectives for different people/squads in multiplayer coop..

Recommended Posts

So more specifically.. I want to be able to have two small squads on the same side, each will be played by at least one human player leading it. I then want to be able to have different objectives and intel shown in the diary for each squad.

Each squad will then be able to look at their map and only see objectives listed that they are supposed to doing. The mission will finally end when both squads have completed all objectives. I have already thought out how this would work within the context of story and game play, I just need to get these separate objectives worked out.

I already know how to add one set of objectives for one team.

Thanks for any help. ;)

Share this post


Link to post
Share on other sites

Here's the basic idea of the briefing.sqf

waituntil {!isnull player};
switch (group player) do {
 case myGroupOne: {
   tsk1 = player createsimpletask...
 };
 case myGroupTwo: {
   tsk2 = player createsimpletask...
 };
};

Share this post


Link to post
Share on other sites

Thanks.

Currently my breifing.sqf looks like this:

player createDiaryRecord[.....
tskobj_1 = player createSimpleTask[....

So what does this do:

waituntil {!isnull player};

Would the following be correct?

switch (group player) do {
 case myGroupOne: {
   player createDiaryRecord[.....
   tskobj_1 = player createSimpleTask[....
};
 case myGroupTwo: {
   player createDiaryRecord[.....
   tskobj_1 = player createSimpleTask[....
 };
};

And where do I reference these "myGroupOne" names in the editor?

Edited by 0ps

Share this post


Link to post
Share on other sites

So what does this do:

It waits that the player has actually got the control of the unit he picked in lobby. It's used to make sure that the next (group player) command is not run too early.

Would the following be correct?

No. It will work, but if you use same variable for different tasks, you will make it unnecessarily hard to update tasks later.

And where do a reference these "myGroupOne" names in the editor?

It's the name of the player groups. Names can be whatever you want. You assign them with

myGroupSomething = group this

in the units init field

Share this post


Link to post
Share on other sites

Thanks, got it working.

Now I need multiple respawn points that advance as objectives are completed. Also need a set of respawns for each squad. :D

I found this in an old post...

Alpha Player init:

nul = _player addEventHandler ["killed", {nul = [] execVM "Respawn_Alpha.sqf"}];

Respawn_Alpha.sqf

_unit = _this select 0;

// Move

_unit setpos getmarkerpos "Respawn_Bravo";

Bravo Player init:

nul = _player addEventHandler ["killed", {nul = [] execVM "Respawn_Bravo.sqf"}];

Respawn_Bravo.sqf

_unit = _this select 0;

// Move

_unit setpos getmarkerpos "Respawn_Bravo";

Not guaranteed to work but worth a shot, someone will correct me if anything doesn't work and it probably won't as I'm knackered! :P

When I tried it I got an error.. something like "error: global variable in local space" at "_player". Any ideas getting this to work or an alternative?

Edit: Just to clarify, I want one respawn location for each squad. Once an objective has been completed by that squad their spawn point will move closer to the next objective. Also I need to set a respawn delay.

Thanks.

Edited by 0ps

Share this post


Link to post
Share on other sites

init.sqf

fnRespawn = {
 waituntil {alive player};
 switch (group player) do {
   case myGroupOne: {
     player setpos getpos respawnOne;
   };
   case myGroupTwo: {
     player setpos getpos respawnTwo;
   };
 };
};

unit init

this addEventHandler ["killed", {nul = [] spawn fnRespawn}];

Place two Empty>Objects>H (invisible), name them respawnOne and respawnTwo.

In the objective triggers move those helipads to correct positions.

Respawn delay is defined in the description.ext file.

respawndelay=123;

Edited by Shuko

Share this post


Link to post
Share on other sites

Doesn't seem to be working. When I die in editor the mission ends.. i'm guessing you can't respawn in editor preview? I tried again after exporting it to multiplayer and when I die I turn into a bird then the mission instantly ends.

As far as I can tell even if this works it only provides one static spawn per squad. I need the respawn to change to a new location after an objective has been completed.

Also I don't really understand the following part.

In the objective triggers move those helipads to correct positions.

Thanks again for taking the time to help with this.

Share this post


Link to post
Share on other sites

For respawn and other stuff: http://community.bistudio.com/wiki/description.ext

For moving helipads: http://community.bistudio.com/wiki/setPos

Respawn doesn't work in single player. It's always set to side respawn regardless of description.ext settings (meaning you can swap to other playable units at any time, including after you die). In description.ext this will be achieved by setting respawn=SIDE; What you probably want is respawn=BASE; which is not possible in single player, be it single player editor or scenarios. You can always edit missions in multipleyr->new->create server->editor which will then be saved in mpmissions rather than missions, and will play like a hosted multiplayer mission (though also mean you cannot use certain single player features such as speeding up time at will).

Edited by galzohar

Share this post


Link to post
Share on other sites

Respawn doesnt work in preview.

Create description.ext file if you dont have one yet. Put these lines in it:

respawn=2;

respawndelay=2;

Place 2 invisible helipad to the position you want the spawn points to be after an task is completed. Name them respawnNewPosOne respawnNewPosTwo.

In the trigger that sets the task as completed, add this in it:

respawnOne setpos getpos respawnNewPosOne

So you will have something like this in the on act line:

tskObj1 settaskstate "succeeded"; respawnOne setpos getpos respawnNewPosOne

When task 1 is done the respawn point for group 1 will be moved to the position of the respawnNewPosOne helipad.

Same logic for the another task and group.

Share this post


Link to post
Share on other sites

Done all that, now I respawn where I died... slightly better I guess but not what i'm aiming for.

I have a headache now. :k:

Share this post


Link to post
Share on other sites

respawn=2 will respawn you where you died. You need the above event handler to re-position your player after the respawn to the helipad position.

Share this post


Link to post
Share on other sites
respawn=2 will respawn you where you died. You need the above event handler to re-position your player after the respawn to the helipad position.

I actually tested all of this myself. Works just fine, even with 2.

---------- Post added at 04:38 PM ---------- Previous post was at 04:06 PM ----------

Test mission: http://derfel.org/arma2/respawnMove.utes.rar

Same in video form:

Share this post


Link to post
Share on other sites

I'll go over what i've done as looking back i'm finding it hard to keep track (and have probably missed something).

ini.sqf:

//begin init.sqf

//Add briefing
execVM "briefing.sqf";

if(true) exitWith {}; 

// Respawn script

MultiRespawn = {
 waituntil {alive player};
 switch (group player) do {
   case GroupPilot: {
     player setpos getpos PilotRespawn;
   };
   case GroupAssualt: {
     player setpos getpos AssualtRespawn;
   };
 };
};

description.ext:

// Mission Header
class Header
{
 gameType = Coop;
};

onLoadMission = "Multi Ojective Airport and Base Attack v1";
OnLoadMissionTime = FALSE;

respawn=2;
respawndelay=2;

Group leader init:

this addEventHandler ["killed", {nul = [] spawn MultiRespawn}]; GroupPilot = group this;

Objective trigger:

"1" objStatus "DONE"; tskobj_1 setTaskState "SUCCEEDED"; obj_1 = true; publicVariable "obj_1"; player setcurrenttask tskobj_2; PilotRespawn setpos getpos PilotRespawnPos1

Invisible helipad named "PilotRespawnPos1".

Another trigger + helipad for next objective set up in same way.

I'm only working on one group for now to get that working first.

Share this post


Link to post
Share on other sites

Because of the unnecessary "if(true) exitWith {}; " in your init.sqf the script will never get to the part where the MultiRespawn is defined. SQF scripts do not need the exitwith.

"1" objStatus "DONE"; is unnecessary as well, it doesn't break anything, but nor does it do anything in Arma 2.

Share this post


Link to post
Share on other sites

Yeah, I didn't say it won't work with respawn=2, just explained what would happen if you just use respawn=2 without doing anything else to reposition the players, which is what I think he tried as he did say players were respawning where they died, though it might just be his bogus init.sqf.

Share this post


Link to post
Share on other sites

Thats what I get for using someone elses example mission to learn from. Those things were already there. -.-

Thanks people. :yay:

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  

×