Jump to content
Shai

Using ForEach with mission.sqm classes

Recommended Posts

Hey all - I have a bunch of markers that are being captured in my mission.sqm - 70 or so. I'd like to keep track of who owns each marker.

I could do something like -

_color = GetMarkerColor "S1_83_1_1";

If (_color == "ColorBlue") Then { _BlueCount = _BlueCount + 1;};

But I don't want to have to do that dozens of times. I'd rather do something like -

{
_Color = GetMarkerColor _x;
If (_color == "ColorBlue") Then { _BlueCount = _BlueCount + 1;};
} ForEach Mission.sqm Class;

But I don't know if such a thing is possible. If I could load all of the mission objects into an array, I could check to see if they fit the criteria of a capture marker (rectangular, one of three colors, etc). But how do I grab all of the mission objects/classes?

Share this post


Link to post
Share on other sites

You should pick apart Insurgency to see how they handled their markers for this kind of thing.

Share this post


Link to post
Share on other sites

Put the marker names in an array manually, that's the only way.

Actually, if you don't have any other markers aside from these you could use allMapMarkers. And even if you do, just copy the result from the debug console and then remove the markers you don't want, beats doing all of it manually.

Edited by Deadfast

Share this post


Link to post
Share on other sites
Put the marker names in an array manually, that's the only way.

Actually, if you don't have any other markers aside from these you could use allMapMarkers. And even if you do, just copy the result from the debug console and then remove the markers you don't want, beats doing all of it manually.

Does this include markers placed by players and is there a way to see which side this marker belongs to? (Placed in side chat etc.)

Share this post


Link to post
Share on other sites

*sigh*. The guy who made the map made no sensible pattern to what he called the markers; I was hoping to do an

_Array = AllMapMarkers;

{

_StringCheck = _x Resize 7;

If (_StringCheck != "Capture") Then {_Array = _Array - _x;};

} For Each _Array;

but he named them all sorts of things, from S1_87 to shouse. I just had the trigger capture pass the string of the name of the marker as an execVM arg, so I could periodically check it for color.

Share this post


Link to post
Share on other sites
5 hours ago, Master-Shiv said:

{ //your code here// } foreach (allMissionObjects "//class name//");

For an 8 year old necro this doesn't help at all.

  • Haha 1

Share this post


Link to post
Share on other sites
3 hours ago, beno_83au said:

For an 8 year old necro this doesn't help at all.

Lol, true. But it's just makes it funnier. Wish i could help at time.

Share this post


Link to post
Share on other sites

Provide links to the BIKI, you animal! 😉

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

×