Jump to content
Sign in to follow this  
HazJ

Distance + Marker Array

Recommended Posts

How do I use distance for a player but with a marker array? I have tried forEach and other ways which I found but nothing works, I am prob doing it wrong tho...

Dirty Haz

Share this post


Link to post
Share on other sites

{player distance (getmarkerpos _x);<....other code here.....>} foreach _markerarray

Share this post


Link to post
Share on other sites

You want to get the distance from the player to specific markers?

_markers = ["mark1", "mark2", "mark3"];
_ranges = [];

{
_ranges set [count _ranges, (player distance getMarkerPos _x)];
} forEach _markers;

player sideChat format["%1", _ranges];

Share this post


Link to post
Share on other sites

Thank you, I will test shortly... What is _ranges?

Dirty Haz

Share this post


Link to post
Share on other sites

Thank you. I'm not sure if this is working with the way I am doing it which is with the waitUntil command... Nothing after the waitUntil command is being read/used?

waitUntil {{_ranges set [count _ranges, (player distance getMarkerPos _x)];} forEach _markers};
hint "Test?";

Dirty Haz

Share this post


Link to post
Share on other sites

When x from marker array (one which is the actual IED - it picks random) then create explosion, I have the rest of it.

Dirty Haz

Share this post


Link to post
Share on other sites

Why not just make it easier and say once you're within range of a central point spawn the IED at one of the markers randomly rather than trying to check all three since it's gonna randomly spawn anyway so the marker you're closest to doesn't matter. Just like put a trigger and have that run your IED spawn script (limiting it to only the server spawning it of course).

Share this post


Link to post
Share on other sites

Thanks!

Why not just make it easier and say once you're within range of a central point spawn the IED at one of the markers randomly

How would I do that?

Dirty Haz

Edit/Update: Solved! I have used KevsnoTrev's way which I did not see before... Thank you to both of you though!!!

Dirty Haz

Edited by Dirty Haz
Edit/Update

Share this post


Link to post
Share on other sites

Trigger BLUFOR PRESENT ONCE

Condition:

this && isServer

OnAct:

ied = createVehicle ["Land_HumanSkull_F", getMarkerPos "mark1", ["mark2", "mark3"], 0, ""];

Change "mark1" - "mark3" to be your marker names. Change the humanskull to whatever your IED is. :)

Share this post


Link to post
Share on other sites

This is kinda neat. How would you getPos the Map cord of the Marker?

Have a "Recon" idea in the works also that was further down my list...

At some point would like to rely more on Map navigation than the magic

glowing Markers on the Map. Would have Random Markers with alpha 0.

I guess you would also have to create (or instead of the Markers) Triggers to know

exactly when you reached that invisible Recon point, huh?

Share this post


Link to post
Share on other sites
How would you getPos the Map cord of the Marker?
_mapCoords = mapGridPosition (getMarkerPos "myMarkerName");

I guess you would also have to create (or instead of the Markers) Triggers
A nice easy way is
_trigger = [objnull, "myMarkerName"] call BIS_fnc_triggerToMarker;

This will make a new trigger that is the same size and position of the passed in marker name (marker has to be of type "RECTANGLE" or "ELLIPSE").

Share this post


Link to post
Share on other sites

Al right! Throwing up the white flag. I think I'm lost in my smallest script.

I feel like I'm going backwards...

For the RECON scenario, I gave up on the Marker angle for this one and

was using Objects instead. I can do a bit more and faster with the Object

variation. I can get this to work with 1 object, but not from a list (array).

//RECON: Find and Record Intel at Random Locations
///////////////////////////////////////////////////
_reconTest = ["reconObj1","reconObj2"];
{
_mapCoords = (getPos _reconTest);
} forEach _reconTest;
player sideChat format["%1","%2", _mapCoords];

For testing I'm using 2 of the Road Cones so I can find them and check the Trigger.

When I change it from the 1 to the 2 Cones it doesn't spit out the Map Cords text.

Oh! AND how would you delete the Object/Trigger/Location after you found it?

I'm using Radio Triggers to see the List. But once you find the location and Trigger

it; the next time you use the Radio Trigger it should be removed from the list.

Edited by Goblin
grammar

Share this post


Link to post
Share on other sites

o.O Basically every line in that is wrong. :)

First line is technically correct, you're creating an array with two elements, both strings. This is fine on it's own. However you wanted those to be objects, so you'd need to drop the " " around them, otherwise they are strings.

The problem comes in when you try to use getPos _reconTest. That's actually two problems. First is that getPos requires an object not an array. And even if you'd properly replaced _reconTest with _x as the current element it would still be wrong because then you'd be trying to getPos on a string, which again requires an object.

The forEach is technically correct, just used wrong. :)

The format is incorrect, you have two " " areas and %2 for the second element but you only give it one element, the _mapCoords, which would end up being undefined since you tried to getPos an array or string.

_reconTest = [reconObj1,reconObj2];
_mapCoords = [];
{
_mapCoords set [count _mapCoords, (getPos _x)];
} forEach _reconTest;
player sideChat format["%1", _mapCoords];  

// Would print out something like:
// [[1234, 1234, 0], [4321, 4321, 0]]

// Then you could do this to list both locations of objects:
{
player sideChat format["Object %1 is at location %2", _reconTest select _x, _mapCoords select _x];
} forEach [0, 1];

The main problem with this is the base idea is wrong. This just doesn't seem like the proper approach for whatever you're trying to do. :) You would already have the object name and object location of the road cones from when you created them. No need to look them up later, mash them together and print them out again.

What is this radio trigger you're talking about? Are you trying to do something like delete roadcones around you by using a radio trigger as you move?

Share this post


Link to post
Share on other sites

Perhaps a little more context...

One thing I really strive for is more immersion and simulation. I want to take out as much of the 'game' as possible to get that maximum suspension-of-disbelief. No hand-holding, no Tasks, no crosshairs, no help. Only 1 Life! Just you verses the Mission. For me, a large part of that immersion and deeper satisfaction comes from not at shooting cartoon bad guys. That can get monotonous and numbing. But from just trying to beat the Map itself. Solving puzzles, problem-solving, planning. I'm interested in the strategic side as much as the tactical side.

For my RECON system (WIP and will be expanded upon) I needed to generate a list of random locations for each and every time you may be assigned this type of mission by upper command. Using Markers was problematic. The orange road cones were just for testing so I could see and find them. Obviously you wouldn't be hunting these dangerous squishy construction accessories in an actual Mission.

In my Black-Ops, you'd be on a lot of smaller, surgical-style missions that are very organic and always in flux. For EXAMPLE: Command may call you up and send deep behind enemy lines just to gather Intel. You are always advised to NEVER engage the enemy unless its absolutely necessary. They brief you and hand you the file. You only know X, Y, and Z. They need you to go in and get eyes-on these specific locations. Then get back out alive with that first-hand Intel. Maybe they saw something on SAT Photos that they need you to verify. Maybe they need to know the terrain in these spots for a future "official" larger-scale mission. You just never know...

So, I need a series of random locations to check and record. The object placement just was easier to setup and manipulate in the Editor. (Plus other variations on this theme with objects) I wanted to pull-up the random map-cords (3-7) in text only format so YOU as a human player have to navigate to each one without any bright marker to walk toward and hold-your-hand so-to-speak. Real life navigation. That make sense? Feel like I'm babbling now.

The Radio Trigger is used to show you all the spots you need to check via text only. Now we have another layer to the combat. Can you find them? You may end up in the middle of nowhere. Who knows?...

The DELETE thing was just to cross them off the list the next time you check with your Radio Trigger. When the Radio Trigger finally returns nothing you'd know its time to sneak back into NATO territory. Not really necessary at this point. Was just wondering. I wasn't even planing on this section of my epic list; but since some asked I thought I'd jump in and widdle away for a day or two on it.

o.O Basically every line in that is wrong.

I'm pretty sure I nailed the first two comment lines, thank you very much! :cool:

Share this post


Link to post
Share on other sites

Ok, so it sounds like you want to generate a mission with x number of objectives. They objectives are given to the player as grid coordinates based on an object location in game. You want to be able to bring up a list of coordinates via radio trigger (or whatever) and want a way to remove completed objectives from the radio list? Basically a simplified task list via radio.

In some cases it'll be recovery of an item, in others it's simply being there to detect or not enemy units, perhaps other times it's "taking a picture" of a vehicle or building.

As I'd suspected this concept is a bit out of scope for this thread. I'd be happy to help you work on the parts you'll need for your mission though. Poke me on Steam or PM maybe?

Share this post


Link to post
Share on other sites

Bingo!

The original idea was to use Markers + Distance in concert with the Recon.

A harder variation is you ONLY get the distance. Can you imagine trying to find that?

This would simulate a good 'homing-beacon', Downed Pilot, etc Mission...

Anyway, Thanks again! (Always have you in mind for my SQF quagmire woes.)

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  

×