Jump to content
Far East Lieutenant

Issues unsolved on my mission

Recommended Posts

Hey guys,

 

Straight to the point to save your time, here are the issues a noob is going through:

1. In-game Loadout changed through Virtual Arsenal disappears upon respawn.

2. Task progress is halted upon respawn.

3. Position Sharing btw BLUFOR squads on the map don't work.

 

So here are the  game set-up and brief scenario.

Set up: Eden Editor and 3den Enhanced Add-on to build my mission.

Scenario: 

1. Squad Alpha and Squad Bravo have to finish given tasks to complete the mission.

2. Both squads start inside rhibs.

 

My assumption on issue #1,#2 is that they come from the same reason: player loses given 'variable name' upon respawn, but I don't know this is true.

 

Issue#1: Partially Addressed, but creates errorbox

Spoiler

A. This is the initial procedure
     1) Click the "Save Loadout" checkbox at editor menu "Attributes - Multiplayer - Respawn" section.

     2) Create two script files

         onPlayerRespawn.sqf

         [player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

         onPlayerKilled.sqf

         [player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

B. So this addresses the issue#1, but generates black error boxes when I run it on Multiplayer:

     1) [BIS_fnc_loadInventory] Inventory "inventory_var" Not Found. - This pops up at the start of the game.

     2) [BIS_fnc_baseWeapon] Class '%All' not found in Cfgweapons - This pops up when I enter the Virtual Arsenal in-game.

 

Issue#2: Partially Addressed, but creates serious flaw in game.(Assuming this is also connected to issue #1)

Spoiler

Let me start with explaining the whole issue for better understanding.

 

1. I used Eden Editor Modules - CreateTask & Set Task State with Triggers to fire them.

2. Squad Alpha has Task Apple - Butter - Charlie to complete the mission and the next task won't pop up until the previous one is completed.

3. Task progress works fine if the player does not die during mission.

4. If the player dies and respawns then the problem starts -   upon completing current task, the next task won't pop up.

5. Current Solution is if you set the owner of the 'Creat Task Module' to 'All playable units', the tasks progress even upon respawn. Other owner settings 'Groups of synchronized objects' and 'Sides of synchronized objects' don't work.

6. But above solution creates a serious flaw in-game - players can also view other squad's tasks and even assign/unassign them.

 

Issue#3: Unaddressed

Spoiler

So I googled up, but really couldn't find any solutions.

 

1. If you right click a unit and click attributes, there is a Object: Electronics and Sensors section.

2. I clicked on all check boxes: Data Link Send, Data Link Receive, Data Link Position.

3. But they don't share positions between squads. Only the members of each squad may find each others position on the map

 

So these are the unaddressed issues.

And If my assumption is right, it will create another problem.

There is a part where squad alpha and bravo merge into a same squad, and i put this script below to a trigger to enable it.

Quote

On Activation.

[p5, p6, p7, p8] join (p1); 

if variable names are lost upon respawn, this part will also get lost too.

 

Thanks for reading it and i would really appreciate any kind of comment. I wish I knew how to do scripting.

Share this post


Link to post
Share on other sites
17 minutes ago, Far East Lieutenant said:

1. In-game Loadout changed through Virtual Arsenal disappears upon respawn.

 

This is probably an easy one:

 

Event Scripts - look at onPlayerRespawn.sqf

 

May also prove fruitful for any other respawn problems.

  • Like 2

Share this post


Link to post
Share on other sites

For issue number 1 I use the same  onPlayerRespawn.sqf and  onPlayerKilled.sqf scripts and it works with no errors. I call both via the init.sqf like this:

 

execVM "onPlayerKilled.sqf";
execVM "onPlayerRespawn.sqf";

 

For issue number 2 I used to use modules but thanks @Grumpy Old Man I now use scripts. It is a bit hard at first but it soon becomes really simple. Here is an example. You call it via the initPlayerLocal.sqf like this:

 

_handleTasks = [] execVM "Tex_fnc_taskHandling.sqf";

and the script goes like this:

//make sure these 3 are identical inside the _makeTaskN arrays
_myTaskIDs = ["Task01","Task02","Task03"];


_makeTask1 = [["Task01"],west,["long description goes here","short task description goes here","Task01Pos"],getMarkerPos "StartHere0","ASSIGNED",3,true,true,"land"];
_makeTask2 = [["Task02"],west,["spoilers","Reach pos Delta","Task02Pos"],ObjNull,"ASSIGNED",2,true,true,"walk"];
_makeTask3 = [["Task03"],west,["spoilers","Hack the Security Center",""],getposATL tv,"ASSIGNED",1,true,true,"interact"];

waitUntil {time > 0};

waitUntil {!(blue0 in tran0)};
sleep 1;

_watchTask1 = [] spawn {

waitUntil {sleep 0.5;when the task will be done condition};
["Task01", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

};

_makeTask1 call BIS_fnc_setTask;

waitUntil {!alive vic5};
sleep 5;

_watchTask2 = [] spawn {

waitUntil {sleep 0.5;!alive vic6};
["Task02", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

};

_makeTask2 call BIS_fnc_setTask;

waitUntil {!alive vic6};
sleep 24;

_watchTask3 = [] spawn {

waitUntil {sleep 0.5;!alive vic7};
["Task03", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

};

_makeTask3 call BIS_fnc_setTask;

The above are all parts of existing missions so they work. Plus please check this one you mentioned:

 

Quote

if variable names are lost upon respawn, this part will also get lost too.

 

If it does not work after respawn it is a major bug since many missions will become unplayable.

 

  • Like 2

Share this post


Link to post
Share on other sites
30 minutes ago, JohnKalo said:

If it does not work after respawn it is a major bug since many missions will become unplayable.

 

It's not a bug.

Tasks assigned via module to objects cease to work, because upon respawn the player becomes a new object.

Can be handled via onPlayerRespawn.sqf or respawn eventhandler etc.

Also you never should execVM either onPlayerRespawn.sqf or onPlayerKilled.sqf since they are automatically executed upon their respective events.

 

Cheers

  • Like 4

Share this post


Link to post
Share on other sites

Don't double post. I gave you a working solution for your loadout.

For your tasks, if you use "WEST" in scripted ones, use BLUFOR in modules. That's the same at the end.

  • Like 2

Share this post


Link to post
Share on other sites

 

54 minutes ago, JohnKalo said:

_myTaskIDs = ["Task01","Task02","Task03"];

 

24 minutes ago, Grumpy Old Man said:

Can be handled via onPlayerRespawn.sqf or respawn eventhandler etc.

 

First, @JohnKalothanks for the reply. Its a shame to be a noob and right at the starting point.

And thanks again to @Grumpy Old Man, now I understand respawned players is a new object, thus cannot carry on given tasks unless you use the method you stated above.

 

So now it makes sense that when I set the module owner to "All playable units", respawned players can still continue with their tasks because they are still playable units. But this cannot be the final solution because different squads will keep getting assigned with tasks of another squad.

 

So if I may ask for more questions,

 

#1 This is rather a simple question, could you give me more answers on how I should use onPlayerRespawn.sqf or respawn eventhandler. Honestly, I really have no idea and I've used modules on this mission or how I should carry this on.

 

#2 In my mission there are two different squads carrying out different set of tasks.

Alpha is tasked with task1, 2, 3 while Bravo is tasked with task A,B,C.

So knowing what issue#2 is,

while setting the owner of the "createTask"Modules to "Groups of synchronized objects",

is it possible to make the re-spawned players to be re-allocated to each squad and their initial task group?

 

So what I want is if a player gets killed and respawns, he can carry on with his tasks.

But it's fun to learn and thanks again for helping me out here. :)

Share this post


Link to post
Share on other sites

And, you don't loose the variable name on respawn. Made test on hosted/dedi. The variable name are persistent.

  • Like 1

Share this post


Link to post
Share on other sites

@pierremgi, my bad I got too many problems popping up so I thought I should compile all those in one post. Sorry if I caused disturbance due to making another post.

 

So I've tried out the scripts by pasting them on onPlayerRespawn.sqf, and it somehow creates a very long black box appear at the start of the game. I will re try your scripts again right away after finishing this post and give you the feedback. 

And I've tried out the scripts that I put in #1, it still creates those small error boxes but kinda works.

 

I also tested setting Blufor as the owner of "CreateTask Modules", but problems are the same. Alpha squad players receive tasks of Bravo and Bravo members viceversa. So I think I should get this done while having the owners set as "Groups of syncronized objects"

Again, sorry if I created disturbance in this sub-forum and thanks to all for helping me out.

Share this post


Link to post
Share on other sites

Very long black box (screen)?  ...

You should upload your mission. IMHO, that could be simpler than trying to find some errors in few lines of codes.

 

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, pierremgi said:

Very long black box (screen)?  ...

You should upload your mission. IMHO, that could be simpler than trying to find some errors in few lines of codes.

 

Currently, this is how additional files are set up.

 

on "onPlayerRespawn.sqf", I put

Spoiler

 

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];
 addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;
   };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];
addMissionEventHandler ["Entitykilled", {
  params ["_victim"];
  removeAllActions _victim;
    _victim setVariable ["ldout",getUnitLoadout [_victim,true]];

}];

 

 

on "initPlayerLocal.sqf"

Spoiler

 

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];

 

addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;

  };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];

 

 

Also in "init", I put

nul = [] execVM "intro.sqf"; // thats the only line I added.

So maybe I messed up the pasting part, because while writing this post I can see It's kinda redundunt

 

Share this post


Link to post
Share on other sites

@pierremgi

 

So, knowing that I messed up the copy & paste, I tried to re-align the files. I hope it makes sense.

 

1. on "init.sqf" - nul = [] execVM "intro.sqf"; // no change

2. on "initPlayerLocal.sqf"

Spoiler

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];

3. on "onPlayerRespawn.sqf"

Spoiler

player enableStamina false;
player setCustomAimCoef 0;
player setVariable ["ldout",getUnitLoadout player];
 addMissionEventHandler ["EntityRespawned", {
  params ["_unit", "_corpse"];
   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
   if (isPlayer _unit) then {
     _unit enableStamina false;
     _unit setCustomAimCoef 0;
   };
    {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
    deleteVehicle _corpse;
}];
addMissionEventHandler ["Entitykilled", {
  params ["_victim"];
  removeAllActions _victim;
    _victim setVariable ["ldout",getUnitLoadout [_victim,true]];

}];

4. on "onPlayerKilled.sqf"

Spoiler

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

and I also got other files "checkFuel.sqf", "description.ext", "intro.sqf", but they are related to intro and sounds so I think they don't matter.

 

Also, if you want, I will upload em on the google drive for you to check.

Forgive my lack of scripting haha...it really feels like a baby learning how to walk

Share this post


Link to post
Share on other sites

No, try to understand "onPlayerRespawn.sqf has same goal as Mission event Handler (MEH) "entityRespawned" for players (entity has a broader scope as AI playable units can respawn also).

If you call the MEH at this place (inside onPlayerRespawn.sqf), that doesn't have sense.

So read and apply what is written:

You need to run the MEHs at start, so in init.sqf or initPlayerLocal.sqf

This way any player will run the MEHs, before dying. (I don't like the respawn on start but you can let it).

 

You don't need the onPlayerKilled.sqf if you have a MEH "EntityKilled" (same goal also). But, here also, depending on whom you want to apply your script (just player(s) or respawning AIs also). You can filter MEH "entityKilled" inside script by if (isPlayer _victim) then {...}

 

Anyway, BIS_fnc_save/loadInventory is a little bit obsolete with get/setUnitLoadout.

 

Some black (delayed) screen could occur opening arsenal; Try to preload it, in init.sqf

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Grumpy Old Man said:

 

It's not a bug.

Tasks assigned via module to objects cease to work, because upon respawn the player becomes a new object.

Can be handled via onPlayerRespawn.sqf or respawn eventhandler etc.

Also you never should execVM either onPlayerRespawn.sqf or onPlayerKilled.sqf since they are automatically executed upon their respective events.

 

Cheers

How exactly can it be handled? 

Because in previous missions of mine players re-spawning and having their own tasks kept on having their tasks. There was never an issue with units losing their tasks.

 

In any case nearly all missions of ours have tasks assigned to BLUEFOR. Pheeeew!

 

@Far East LieutenantIn case you are not aware black boxes showing errors only appear in the editor and not when you play the mission. 

  • Like 2

Share this post


Link to post
Share on other sites
34 minutes ago, JohnKalo said:

 

@Far East Lieutenant In case you are not aware black boxes showing errors only appear in the editor and not when you play the mission. 

 

Script errors will only show if you run the game with the -showScriptErrors parameter (easily enabled through the launcher now days), and will show up anytime there is an error, not just from the editor. 

  • Like 3

Share this post


Link to post
Share on other sites

The next task not appearing is strange since they are still in the same group when they re-spawn for example. So even if there is a glitch and there is yet another player in the group alive they should be synced again? How about syncing the players with the task modules again if they die?

 

Like a repeatable trigger with this as a condition:

 

!alive nameOfPlayer;

and make it activate 0.01 seconds after the player is re-spawned like this:

 

nameOfPlayer synchronizeObjectsAdd [NameOfTaskModule];

so you will have as many triggers as the number of units and it will all work?

 

Sounds weird or too simple but with Arma whatever works and causes no lag or whatever glitch should be used in my humble opinion 

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, JohnKalo said:

so you will have as many triggers as the number of units and it will all work?

 

Sounds weird or too simple but with Arma whatever works and causes no lag or whatever glitch should be used in my humble opinion 

 

This might be a long process, but I will try this right away and get back to you with results. Thanks for the tip! :)

  • Like 1

Share this post


Link to post
Share on other sites
On 2018. 12. 21. at 11:20 PM, JohnKalo said:

so you will have as many triggers as the number of units and it will all work?

 

Sounds weird or too simple but with Arma whatever works and causes no lag or whatever glitch should be used in my humble opinion 

 

@JohnKalo, hey hope you are having good weekend.

 

So  gave a shot on your method, but its not working haha... anyways hers how I tried it:

 

Quote

Player: p1, p2, .... Taskname: Alpha1, Alpha2, .....

 

1. Checked the box to make it a Repeatable trigger, and Set the timer 15.01(Mid)

2. On Condition:
!alive p1

3. On Activation:
p1 synchronizeObjectsAdd [Alpha1];
p1 synchronizeObjectsAdd [Alpha2];
p1 synchronizeObjectsAdd [Alpha3];
p1 synchronizeObjectsAdd [Alpha4];
p1 synchronizeObjectsAdd [Alpha5];
p1 synchronizeObjectsAdd [Alpha6];
p1 synchronizeObjectsAdd [Alpha7];

4. Set the owner of the CreateTask Module Alpha1 to "Groups of synchronized Objects", with a node connected to p1.

 

Then I started as multiplayer.
With Task Alpha1 assigned, p1 re-spawned at the beach.

Finished Task Alpha1, then Task Alpha2 will not be assigned, which makes this one not working.

 

But your theory should be correct because it is supposed to be reconnecting the respawned player to the task again.

I think I'm missing something in the middle, so I will try to give variations like timer set 16 sec and stuff like that.

 

Anyway really thanks for the advice! :)

  • Like 1

Share this post


Link to post
Share on other sites

@JohnKalo, hey man it works!!!!!!!!!

 

While you check the process I applied above with your advice, I gave a few more changes:

 

1. Set timer's Min Mid Max time to 16sec.

2. I set the triggers activation owner to Any Player.

Somehow, after enabled the the task process working!

 

So now, what I'm going to do is to make another trigger for player2, bravo squad leader, and check if the triggers work out for both alpha and bravo.


EDIT1: hey trigger for player2 also works. All I have to do is to make triggers for all 8 players. Thanks man. I think I'll have my mission out in a few days.
So for anyone having a similar problem with me, check this post. So now 2 of the 3 issues are solved. Thanks to everyone.

Quote

Player: p1, p2, .... Taskname: Alpha1, Alpha2, .....

 

1-a. Checked the box to make it a Repeatable trigger, and Set the timer 15.01(Min, Mid, Max)

1-b. Set the triggers activation owner to Any Player

2. On Condition:
!alive p1

3. On Activation:
p1 synchronizeObjectsAdd [Alpha1];
p1 synchronizeObjectsAdd [Alpha2];
p1 synchronizeObjectsAdd [Alpha3];
p1 synchronizeObjectsAdd [Alpha4];
p1 synchronizeObjectsAdd [Alpha5];
p1 synchronizeObjectsAdd [Alpha6];
p1 synchronizeObjectsAdd [Alpha7];

4. Set the owner of the CreateTask Module Alpha1 to "Groups of synchronized Objects", with a node connected to p1.

 

  • Like 2

Share this post


Link to post
Share on other sites

Glad to hear it worked! Yep the weekend seems to be going fine. Spending much time in editing myself. As for issue number 3 let us not leave it unresolved :scratchchin:

 

Here is what you can try,

 

1.] Create any sort of marker you like in the editor and name it nameOfMarker.

2.] You have already named your units so we will use the name directly p1.

2.] In your init.sqf place this line:

 

[] spawn { while{not isnull p1} do {"nameOfMarker" setmarkerpos getpos p1; sleep 0.5;}; };

 

All done for unit p1! The above line will attach the nameOfMarker marker on your p1 unit and its position will be updated on anybodys map after 0.5 seconds.

 

Doing so for all units will give you the exact position in real time for all units you desire. Maybe you only want the leaders' positions so you will add 2 such lines in your init.sqf.

For the units' names you can just add a text to each unit's marker.

For more markers you just copy paste the above as many times as you like like this:
 

[] spawn { while{not isnull drop_plane} do {"Marker_drop_plane" setmarkerpos getpos drop_plane; sleep 0.5;}; };
[] spawn { while{not isnull aa0} do {"marker_aa0" setmarkerpos getpos aa0; sleep 1;}; };
[] spawn { while{not isnull aa1} do {"marker_aa1" setmarkerpos getpos aa1; sleep 1;}; };

[] spawn { while{not isnull hostjet0} do {"marker_hostjet0" setmarkerpos getpos hostjet0; sleep 1;}; };
[] spawn { while{not isnull hostjet1} do {"marker_hostjet1" setmarkerpos getpos hostjet1; sleep 1;}; };
[] spawn { while{not isnull hostjet2} do {"marker_hostjet2" setmarkerpos getpos hostjet2; sleep 1;}; };

[] spawn { while{not isnull aa2} do {"marker_aa2" setmarkerpos getpos aa2; sleep 1;}; };
[] spawn { while{not isnull aa3} do {"marker_aa3" setmarkerpos getpos aa3; sleep 1;}; };

 

It would be wise to just not over-minimize the 0.5 value. That might cause lag if set to 0.001 for example. It will be less realisticly shown in the map too. 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
4 minutes ago, JohnKalo said:

Glad to hear it worked! Yep the weekend seems to be going fine. Spending much time in editing myself. As for issue number 3 let us not leave it unresolved :scratchchin:

 

Here is what you can try,

 

1.] Create any sort of marker you like in the editor and name it nameOfMarker.

2.] You have already named your units so we will use the name directly p1.

2.] In your init.sqf place this line:

 

[] spawn { while{not isnull p1} do {"nameOfMarker" setmarkerpos getpos p1; sleep 0.5;}; };

 

All done for unit p1! The above line will attach the nameOfMarker marker on your p1 unit and its position will be updated on anybodys map after 0.5 seconds.

 

Doing so for all units will give you the exact position in real time for all units you desire. Maybe you only want the leaders' positions so you will add 2 such lines in your init.sqf.

For the units' names you can just add a text to each unit's marker.

For more markers you just copy paste the above as many times as you like like this:
 


[] spawn { while{not isnull drop_plane} do {"Marker_drop_plane" setmarkerpos getpos drop_plane; sleep 0.5;}; };
[] spawn { while{not isnull aa0} do {"marker_aa0" setmarkerpos getpos aa0; sleep 1;}; };
[] spawn { while{not isnull aa1} do {"marker_aa1" setmarkerpos getpos aa1; sleep 1;}; };

[] spawn { while{not isnull hostjet0} do {"marker_hostjet0" setmarkerpos getpos hostjet0; sleep 1;}; };
[] spawn { while{not isnull hostjet1} do {"marker_hostjet1" setmarkerpos getpos hostjet1; sleep 1;}; };
[] spawn { while{not isnull hostjet2} do {"marker_hostjet2" setmarkerpos getpos hostjet2; sleep 1;}; };

[] spawn { while{not isnull aa2} do {"marker_aa2" setmarkerpos getpos aa2; sleep 1;}; };
[] spawn { while{not isnull aa3} do {"marker_aa3" setmarkerpos getpos aa3; sleep 1;}; };

 

It would be wise to just not over-minimize the 0.5 value. That might cause lag if set to 0.001 for example. It will be less realisticly shown in the map too. 

I'd reduce all those loops into a single array and put it into an eachFrame EH so you actually get a realtime update (if this is wanted):

 

//initplayerlocal.sqf
addMissionEventHandler ["EachFrame",{
	_array = [
		["Marker_drop_plane",drop_plane],
		["marker_aa0",aa0],
		["marker_aa1",aa1],
		["marker_hostjet0",hostjet0],
		["marker_hostjet1",hostjet1],
		["marker_hostjet2",hostjet2],
		["marker_aa2",aa2],
		["marker_aa3",aa3]
	];
	{
		if (!isNull _x#1) then {_x#0 setMarkerPos _x#1};
	} forEach _array;
}];

setMarkerPos doesn't eat much performance, you can easily do this for a dozen or so vehicles, as long as it's done locally via initPlayerLocal.sqf.

You can reduce it even further if you plan on creating the markers dynamically, so you don't need to touch the array at all, just a simple setVariable in the object init field would do.

 

Cheers

  • Thanks 3

Share this post


Link to post
Share on other sites

Nice one ^^ ! And soon I shall be releasing a new version of the particular mission which uses the above. I am not changing anything it is just about an add-on that was updated and made the mission unplayable. But since you mentioned it I might implement your solution.

Share this post


Link to post
Share on other sites

@JohnKalo
So I tried your method this way,

Spoiler

[] spawn { while{not isnull p1} do {"PM_1" setmarkerpos getpos p1; sleep 0.5;}; };
[] spawn { while{not isnull p2} do {"PM_2" setmarkerpos getpos p2; sleep 0.5;}; };
[] spawn { while{not isnull p3} do {"PM_3" setmarkerpos getpos p3; sleep 0.5;}; };
[] spawn { while{not isnull p4} do {"PM_4" setmarkerpos getpos p4; sleep 0.5;}; };
[] spawn { while{not isnull p5} do {"PM_5" setmarkerpos getpos p5; sleep 0.5;}; };
[] spawn { while{not isnull p6} do {"PM_6" setmarkerpos getpos p6; sleep 0.5;}; };
[] spawn { while{not isnull p7} do {"PM_7" setmarkerpos getpos p7; sleep 0.5;}; };
[] spawn { while{not isnull p8} do {"PM_8" setmarkerpos getpos p8; sleep 0.5;}; };

It works fine with all player slots, but only one small problem: an error box pops up at the start of the game saying p8 is an undefined variable.

So I played the game with player8 to find out what was wrong. It works just fine,  but again an errorbox pops up this time it says p7 is an undefined variable.

But still your way works and I'll try to find out why "undefined variable"issue pops up even though all players and markers are named correctly without any malfunction.

 

@Grumpy Old Man,

I tried your method too, but I still have a hard time even trying to understand what you wrote haha....

Spoiler

//Markers: PM_1, 2, 3, ...
//Players: p1, 2, 3, ...

 

addMissionEventHandler ["EachFrame",{
    _array = [
        ["PM_1",p1],
        ["PM_2",p2],
        ["PM_3",p3],
        ["PM_4",p4],
        ["PM_5",p5],
        ["PM_6",p6],
        ["PM_7",p7],
        ["PM_8",p8]
    ];
    {
        if (!isNull _x#1) then {_x#0 setMarkerPos _x#1};
    } forEach _array;
}];

 

So I put it this way, but an errorbox pops up  and is not working. Probably I didn't understand your script.

 

Anyways thanks guys for the tips!

  • Like 1

Share this post


Link to post
Share on other sites

You should have a look on every command you want to use and syntax. Here setMarkerPos is waiting for a position,not an object.

On a further step, you'll have to cope with arguments locality and effects, to script for multiplayer.

Just a remark not related here...

except for one thing:

do you think it's better to manage all your markers on server (as you are using global commands for them), then broadcast the positions on each frame?

or createMarkerLocal and let all clients manage the markers locally (setMarkerPosLocal)?

Just to say, your quest for MP scripts will not end soon.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@pierremgi,

Feels like I'm looking at a dictionary again.
Even though I barely understand the relationship between server and client, but what you suggested will have less burden to the server if I may guess. So what I'll do is that I will try to understand the above script, then give a shot on explaining that logic,  change it for my mission and that will be my first update. I'm trying to have my nephews play this on Christmas so I cant delay this much longer.

To your last comment yeah I guess I got a long way ahead of me, but hey, I couldn't even have taken my first step if it were not for you guys. Plus it's always fun to learn. So thanks and Merry Christmas.
 

  • Like 2

Share this post


Link to post
Share on other sites

Wouldn't it make sense to just use while loop when map/GPS is open? Then move markers that way. EachFrame isn't needed or advised here. Having multiple while loop for each marker is insane. @Grumpy Old Man's nested array method with one while loop which runs ONLY when map/GPS is open and you'll be fine. I personally don't run anything unless need to. If you aren't looking at them, don't update. This applies to locally created markers by the way. If you are using marker to teleport for example, then just update hte marker once before teleport.

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

×