OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Malm on 16 Nov 2007, 19:07:05
-
I need a script that can return an array of all the markers for a specific side in coop.
It is my intention then to have an enemy group recon near these markers. Are no coop players present near the marker the enemy group travels to the next marker.
Using forum search I've found that there was a script meant for that. Unfortunally the link is now dead.
Hope you can help
Best regards
Malm
-
If you know the markers that you want to look near, then you must know their names already. If you we able to just get all the markers (Which I am pretty sure you can't do), then this would include all the player-placed markers, so the players could just spam markers on the opposite side of the map to keep the AI away!
Can you please link to the post that mentions a function for finding all the markers in a mission (even if the link is dead)? At a guess, I'd say that it was not doing what you are asking for anyway.
-
Hi Spooner.
The gents I play coop with are well "trained" and behave accordingly to our virtual fighting rules. However if you are not aware that "something" is peeking on your markers why bother spamming it?
The post is all the way back to 2002 and "The new OFP 1.75 menu". Wonder what that has to do with it.
http://www.ofpec.com/forum/index.php?topic=116.msg566#msg566
-
-
That post refers to finding all user-defined markers, that is, markers placed by players in-game in the map screen (which follow a naming convention), rather than by the mission-designer at design or in a script (which have arbitrary naming). To find all the markers placed the player in SP, you could use something like this:
for "_i" from 0 to 1000 do
{
_pos = getMarkerPos (format ["_user_defined #0/%1", _i]);
// Do something if _pos is a valid position.
};
I think what the people in that thread could have been talking about was that in OFP 1.75 you could make your own dialogs or use onMapClick to find out where players wanted to do something. I assume before this was available, mission-devs used to have to find a marker being placed and use that as the location. I have no idea about this though, since I came to scripting for ArmA very recently. Perhaps one of the old-guard can clarify this issue?
So anyway, I don't think this technique will work for you in any way. As I said, if you, the mission-designer, placed the markers, then they will be named and you can easily find them. If you've placed a lot and don't want to manually make a massive array of their names in order to find them, then you could follow your own naming convention, such as "myMarker1", "myMarker2", etc. and use a similar loop to find them all.
for "_i" from 1 to _numberOfMarkersPlaced do
{
_pos = getMarkerPos (format ["myMarker%1", _i]);
// Do something at _pos
};
-
Thanks a lot Spooner,
So if I ran a script looping over _user_defined #0/%1 on each and every client and added their contribution to a public array like publicArray = publicArray + _thisClientMarkers I will end up with an array of all markers placed?
Thats worth a try. I wonder - what does _user_defined #1 do? Just a thought.
Best regards
Malm
-
I am not sure that is what was meant in that other thread. They said that "_user_defined #0/%1" was the pattern used for SP, but that they didn't know the pattern used in MP. Since placed markers are global, they won't be using the same names for markers made by each player. I personally don't know what pattern is used in MP, but there is a good chance that someone here knows...
Incidentally, you can't public an array with publicVariable, but if you can convert it to a string then you can public that and call compile it at the other end to reconstruct the array. Anyway, that is an entirely different issue, so I won't go into details here.