Jump to content
Sign in to follow this  
Sanchez Milsim

Place minefield task

Recommended Posts

Hi, im trying to make a task to be suceeded when player place ATmine near position to a marker.

This is an example of script that im using but no works.

waituntil {(count ((markerpos "putmine1") nearObjects ["ATMine",1])) > 50};

In theory when i place mine and its nearest 50m to marker "putmine1".

But it doesn´t work.

Its possible when player pace a ATmine classname change for other?

Im using AGM, but i check github and no place change classname for these item.

thanks!!!

Share this post


Link to post
Share on other sites

Theorectically you could try a mixture of a "Put" EH and within that have a check on the object placed by the player (_this select 3), and the distance of the player from the marker (in the following example the marker/player distance check is probably incorrect):

player addEventHandler ["Put",

{
if (_this select 3 == "ATMine" && player distance (getMarkerPos "putmine1") < 50) then
{
//set task state to true
};
}];

Share this post


Link to post
Share on other sites

I think the error is the 50 and 1 are swapped....as I'm reading above, you are waiting until 50 AT mines spawn within 1m of the marker location.

Share this post


Link to post
Share on other sites
I think the error is the 50 and 1 are swapped....as I'm reading above, you are waiting until 50 AT mines spawn within 1m of the marker location.

Ahhh, that is a good point, and looking at the wiki page for nearestObjects, the code he is using isn't syntactically correct:

waitUntil {count ((getMarkerPos "putmine1") nearObjects [["ATMine"], 50]) >=1};
//^This is done based off the comment made by Katulobotomia in the wiki for nearestObjects command (in 2013)

//so if that doesn't work, then
waitUntil {count (nearestObjects [(getMarkerPos "putmine1"), ["ATMine"], 50]) >=1};

Edited by JShock

Share this post


Link to post
Share on other sites
He's using nearObjects though =)

Well...reading fast doesn't do me any good does it...missed the missing "est".

Updated my previous post with necessary changes.

Edited by JShock

Share this post


Link to post
Share on other sites

Thanks for answer but have not worked. A lot of syntax errors.

Line on my post works with an ammo truck for example:

waituntil {(count ((markerpos "respawn_west3") nearObjects ["B_Truck_01_fuel_F",15])) > 0};

It works with an fuel truck when it is near than 15 meters of marker, quantity one. I use same with cointainers to move with helicopters and it works.

But i dont know why no work with atmine.

At cfgweapons appear 3 diferent classnames:

  • ModuleMine_ATMine_F

  • ATMine

  • ATMine_Range_Mag

I think its no working because mine change classname when its placed.

Its that true?

Thanks!!!

Share this post


Link to post
Share on other sites
Thanks for answer but have not worked. A lot of syntax errors.

Line on my post works with an ammo truck for example:

waituntil {(count ((markerpos "respawn_west3") nearObjects ["B_Truck_01_fuel_F",15])) > 0};

It works with an fuel truck when it is near than 15 meters of marker, quantity one. I use same with cointainers to move with helicopters and it works.

But i dont know why no work with atmine.

At cfgweapons appear 3 diferent classnames:

  • ModuleMine_ATMine_F

  • ATMine

  • ATMine_Range_Mag

I think its no working because mine change classname when its placed.

Its that true?

Thanks!!!

I'm not too sure myself, have you tried each classname to see if it will work?

Share this post


Link to post
Share on other sites
I'm not too sure myself, have you tried each classname to see if it will work?

Yes but not worked. : (

---------- Post added at 20:45 ---------- Previous post was at 20:23 ----------

Im looking for that

http://forums.bistudio.com/showthread.php?150767-Task-quot-Success-quot-activated-by-deactivation-of-multiple-mines

this is for deactivation and requires the name of placed mine on map.

{mineActive _x} count [mine1, mine2, mine3] == 0

Do you know how to make it work without defining name of mines??

With that "ATMine_Range_Ammo" no works neither.

Share this post


Link to post
Share on other sites

Solution:

waituntil {(count ((markerpos "putmine1") nearObjects ["ATMine_Range_Ammo",50])) > 5};

6 mines of class "ATMine_Range_Ammo" less than 50m marker "putmine1"

Thanks 2nd Ranger finally using ammo name works, before when i check class i did something wrong.

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  

×