Jump to content

Recommended Posts

Brilliant work! Been wanting to dig into this for months...

Been trying all morning. How would I create/move/attach a Trigger to these?

fnc_createMarker = {
	private ["_pos","_m"];
	_pos = _this select 0;
	_m = createMarker [format["mPos%1%2",(floor(_pos select 0)),(floor(_pos select 1))],_pos];
	_m setmarkerColor (_this select 1);
	_m setMarkerShape "Icon";
	_m setMarkerType "mil_dot";
};

_count = 1 + random 4; // how many

for "_i" from 1 to _count do {
		_p = ["mkr1",0] call SHK_pos;
		[_p,"ColorRed"] call fnc_createMarker;
}; 
sleep 1;

//need triggers on ALL SHK Markers
	_trgRecon = createTrigger["EmptyDetector",getPos _m];
	sleep 2;
	_trgRecon setTriggerArea[25,25,0,false];
	_trgRecon setTriggerActivation["WEST","PRESENT",false];
	_trgRecon setTriggerTimeout [1,1,1,false];
	_trgRecon setTriggerStatements["({_x in thisList} count (playableUnits + switchableUnits) > 0) && ((getposATL Player select 2) < 33);", 
	"hint 'Recon: CHECK!';", "hint 'X';"];

Share this post


Link to post
Share on other sites

Something like?

fnc_createMarker = {
 private ["_pos","_m"];
 _pos = _this select 0;
 _m = createMarker [format["mPos%1%2",(floor(_pos select 0)),(floor(_pos select 1))],_pos];
 _m setmarkerColor (_this select 1);
 _m setMarkerShape "Icon";
 _m setMarkerType "mil_dot";
};
fnc_createTrigger = {
 private ["_pos","_trg"];
 _pos = _this select 0;
 _trg = createTrigger["EmptyDetector",getPos _pos];
 _trg setTriggerArea[25,25,0,false];
 _trg setTriggerActivation["WEST","PRESENT",false];
 _trg setTriggerTimeout [1,1,1,false];
 _trg setTriggerStatements["({_x in thisList} count (playableUnits + switchableUnits) > 0) && ((getposATL Player select 2) < 33);", "hint 'Recon: CHECK!';", "hint 'X';"];
};

_count = 1 + random 4; // how many

for "_i" from 1 to _count do {
 _p = ["mkr1",0] call SHK_pos;
 [_p,"ColorRed"] call fnc_createMarker;
 [_p] call fnc_createTrigger;
};

Edited by Shuko

Share this post


Link to post
Share on other sites

Negative. (guessing the bottom should be [_p] call fnc_createTrigger; )

Anyway, nope! I don't understand how to actually use this. I've tried everything I could find and think of.

I can get it working just fine; its just HOW to use in an actual Mission/Map? I can't get anything to spawn in or

use/move triggers with this.

I just wanted to add Recon into my Mission Generator so the player would go into an area of about 4km and

scout anywhere from 1-5 recon points that are all on land. Then I remembered Shuko already had this...

But I feel the more I tinker with it, the worse it gets. I'm missing something simple/syntax I'm sure. :confused:

Share this post


Link to post
Share on other sites

Ah yes, indeed it should be.

Well, you say you know how to use it, which I assume means you load it correctly.

What exactly is the problem? Can't get random positions generated? Can't do anything with the positions? Not even the markers show up?

I mean, I didn't test it nor have I've scripted in months, but the code seems pretty valid.

Share this post


Link to post
Share on other sites
Ah yes, indeed it should be.

Well, you say you know how to use it, which I assume means you load it correctly.

What exactly is the problem? Can't get random positions generated? Can't do anything with the positions? Not even the markers show up?

I mean, I didn't test it nor have I've scripted in months, but the code seems pretty valid.

Yes it is valide, using it for months now...

Share this post


Link to post
Share on other sites

You've been using my triggers and recon mission for months? How kooky! :p

HIS code IS fine... Its my setup that is NOT. Care to share HOW exactly you're

using this? Creating a bunch of colored dots doesn't win battles or the war.

I'm trying to create a RECON Mission where that player has to rely on good

navigation to find those random locations. I wanted to place fairly small

triggers on them so the player can know he did indeed navigate to the right

spot.

I believe you can not use local variables on the triggers? Part of the problem?

Share this post


Link to post
Share on other sites

So, the problem is with the triggers.

Does the mission have AI units on the players' side?

Have you tested if the triggers are created correct and actually fire (with some simple condition)?

Share this post


Link to post
Share on other sites

How would I create a path similar to the road position thing from Object A (Player) and Object B? (Destination a few towns over)

This would give the player a rail to follow.

Also, choosing one of those random points and using it for a script? For example, calling this.

["helispawn1", "RandomPositionAlongRoad", 1, 8, 1, "Box_East_AmmoVeh_F", 0] execVM "ailift.sqf";

Share this post


Link to post
Share on other sites

Shuko's code looks good. So what is NOT working Goblin? Are markers not created? Are the triggers not created? Are you getting any errors? Look in your .RPT file to see what might be wrong if anything.

Share this post


Link to post
Share on other sites

Hey !

How is the road position stuff actually working, as far as i understand a _pos is searched for around an anchor point (lets say a invincible H and 400m distance).

So now 399m away from the anchor point a position is found, now if the pos must be road the road search radius is used (default = 200m) so the generated roadpos could be nearly 600m away from the anchor point, correct ?

Share this post


Link to post
Share on other sites
Hey !

How is the road position stuff actually working, as far as i understand a _pos is searched for around an anchor point (lets say a invincible H and 400m distance).

So now 399m away from the anchor point a position is found, now if the pos must be road the road search radius is used (default = 200m) so the generated roadpos could be nearly 600m away from the anchor point, correct ?

Correct

Share this post


Link to post
Share on other sites

Just wanted to say thanks!

Using your buildingPos script. Wondering if there is a later version.

running this one:

SHK_buildingpos.sqf

Shuko of LDD Kyllikki (kyllikki.fi)

IRC: shuko @ quakenet

Version: 0.12

Share this post


Link to post
Share on other sites

It seems I have version 0.2 on my harddrive, but I can't remember what's the difference, or if it's even finished. :)

All I can remember is that I never got the building stuff work as well as I would have wanted.

Share this post


Link to post
Share on other sites

Hello everyone,

I have a problem with a patrol running with position find by SHK_pos(big thank to you Shuko for these great scripts) the script stop run when he must find patrol position, maybe it is the for command or incompatible position but i can't say how doesn't work so i request you help please

The Patrol script

if (!isServer) exitWith {};

_patrolgroupcentral = creategroup east;

_patrolgroupside1 = creategroup east;

_patrolgroupside2 = creategroup east;

_patrolgroupside3 = creategroup east;

_guard1 = creategroup east;

_mark = _this select 0;

_marksize = getMarkerSize _mark;

_markaxisA = _marksize select 0;

_sure = _markaxisA;

_sure2 = _markaxisA/2;

_range1 = round (Random 450);

_range2 = round (Random 300);

_spawnpos = getmarkerpos (_mark);

_pos1 = [getmarkerpos _mark,[_markaxisA/2,_sure],[0,90]] call SHK_pos;

_allunits = ["O_G_medic_F","O_G_officer_F","O_G_Soldier_A_F","O_G_Soldier_AR_F","O_G_Soldier_exp_F","O_G_Soldier_F","O_G_Soldier_GL_F","O_G_Soldier_LAT_F","O_G_Soldier_lite_F","O_G_Soldier_M_F","O_G_Soldier_SL_F","O_G_Soldier_TL_F"];

_allammoboxOPFOR = ["O_supplyCrate_F","Box_IND_Support_F","Box_East_Support_F","Box_IND_Wps_F","Box_East_Wps_F","Box_IND_WpsSpecial_F","Box_East_WpsSpecial_F","I_supplyCrate_F","C_supplyCrate_F","IG_supplyCrate_F","Box_IND_AmmoOrd_F","Box_East_AmmoOrd_F","Box_IND_Grenades_F","Box_East_Grenades_F","Box_IND_WpsLaunch_F","Box_NATO_WpsLaunch_F","Box_East_WpsLaunch_F","Box_IND_Ammo_F","Box_East_Ammo_F","Box_NATO_AmmoVeh_F","Box_IND_AmmoVeh_F","Box_East_AmmoVeh_F","Box_NATO_Support_F","Box_NATO_WpsSpecial_F","Box_NATO_Wps_F","B_supplyCrate_F","Box_NATO_Grenades_F","Box_NATO_AmmoOrd_F","Box_NATO_Ammo_F"];

_max = (count _allunits)-1;

_maxAmmo = (count _allammoboxOPFOR)-1;

_officier1 = _patrolgroupcentral createUnit [_allunits select (round random _max),_pos1, [], 0,"NONE"];

_officier1 setskill ["commanding",1];

_officier1 setskill ["general",1];

_patrolgroupcentral setBehaviour "SAFE";

_patrolgroupcentral setSpeedMode "LIMITED";

_patrolgroupcentral setCombatMode "RED";

_patrolgroupcentral setFormation (["STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "DIAMOND"] call BIS_fnc_selectRandom);

//Guard

for "_j" from 0 to Numbermedian do {

_unit1 = _patrolgroupcentral createUnit [_allunits select (round random _max),position _officier1, [], 5, "FORM"];

[_unit1] join _patrolgroupcentral;

_unit1 setskill ["spotDistance",0.7];

_unit1 setskill ["spotTime",0.7];

};

for "_j" from 0 to 6000 do {

_posP1 = [getmarkerpos _mark,[150,_markaxisA],[0,90],0] call SHK_pos;

_posP2 = [getmarkerpos _mark,[150,_markaxisA],[90,180],0] call SHK_pos;

_posP3 = [getmarkerpos _mark,[150,_markaxisA],[180,270],0] call SHK_pos;

_posP4 = [getmarkerpos _mark,[150,_markaxisA],[270,0],0] call SHK_pos;

_wp1 = _patrolgroupcentral addWaypoint [_posP2, 0];

_wp1 setWaypointType "MOVE";

_wp2 = _patrolgroupcentral addWaypoint [_posP1, 0];

_wp2 setWaypointType "MOVE";

_wp3 = _patrolgroupcentral addWaypoint [_posP2, 0];

_wp3 setWaypointType "MOVE";

_wp4 = _patrolgroupcentral addWaypoint [_posP3, 0];

_wp4 setWaypointType "MOVE";

};

Sorry i don't say how is the spoiler code.

Great thank for your help!

Share this post


Link to post
Share on other sites

You have probably gotten this question before, but is there a way to check for positions in buildings (only) to place an object?

Share this post


Link to post
Share on other sites
You have probably gotten this question before, but is there a way to check for positions in buildings (only) to place an object?

I tried to make a script for it, but since it has some issues, I haven't made a thread for it. However, if you want to have a go: http://derfel.org/arma2/scripts/SHK_buildingpos.sqf

Share this post


Link to post
Share on other sites
Hm, I don´t get it. Can you give some example codes for the usage of this script?

if you look at the examples pictures in first post of this thread, at the top there are usauge examples that achieved the result. big help becuase it is quite obtuse to understand at first.

Share this post


Link to post
Share on other sites

this script is very useful.

a question though. I am trying to get objects spawned in random distance that's between a minimum distance and maximum distance and is in the angle range between 20' and 180'. I have a line that seems to work 70% of the time, but occassioanly it selects a spot much less than the minimumdistance. it should not spawn in water and never does so thats nice.

the parameters im using are

[code
_pos = [_referencePos,[_referenceSize * 1.8,_referenceSize * 3 ], [20,180] ] call SHK_pos;
_pos2 = [_referencePos,[_referenceSize * 1.8,_referenceSize * 3 ], [200,360]] call SHK_pos;
[/code]

Share this post


Link to post
Share on other sites

Is there water between the anchor and minimum distance?

Share this post


Link to post
Share on other sites

thanks for the answer. yes, occassionally there is water but it happens more often when the land is a thin strip of terrain or at the edge of the land/water border. there is other empty land available but it isnt considered for some reason. I have put in a minimum distance check and that seems to prevent it so far but without that check shk_pos will occassionally spawn things within the minimum distance parameter.

---------- Post added at 10:59 ---------- Previous post was at 09:18 ----------

The script uses findEmptyPosition to find the empty space. The command takes vehicle type as a string. If you want to have space for a MRAP for example, then find out the vehicle type of it. One type of MRAP is called "O_MRAP_02_F", for example.

i am trying this but get the error 2legs/log: ERROR: #2: Default "C_Offroad_01_repair_F" is type STRING, must be OBJECT"

and im calling it like thi s

_armousSpawnPos = [_centerPos, random _baseSize,"C_Offroad_01_repair_F"] call SHK_pos;

Share this post


Link to post
Share on other sites

If you have water positions disallowed, and the random position is in water, the script will try to find land by circular search with increasing radius. This can, in some cases, make the returned position being outside of the given parameters. I should probably update the script and make it start from the beginning in those cases.

As for the error. You are giving the object type as 3rd parameters, when it's place is 6th. The zeros are for not allowing water position and not forcing road position. As for direction you can replace it with random 360.

_armousSpawnPos = [_centerPos, random _baseSize, _directionFromAnchor,0,0,"C_Offroad_01_repair_F"] call SHK_pos;

Share this post


Link to post
Share on other sites
If you have water positions disallowed, and the random position is in water, the script will try to find land by circular search with increasing radius. This can, in some cases, make the returned position being outside of the given parameters. I should probably update the script and make it start from the beginning in those cases.

As for the error. You are giving the object type as 3rd parameters, when it's place is 6th. The zeros are for not allowing water position and not forcing road position. As for direction you can replace it with random 360.

_armousSpawnPos = [_centerPos, random _baseSize, _directionFromAnchor,0,0,"C_Offroad_01_repair_F"] call SHK_pos;

awesome, thanks a lot for the answer. really useful script you made!

edit - just checking - i got an error message when using the code supplied. an array was wanted rather than a number for road checking. so i put in [0] and it worked great. just so you know. thanks again!

Edited by twisted

Share this post


Link to post
Share on other sites

Shuko, I am back again. ;) Is there a way to have a timeout for the script? Is there a timeout parameter? So say I wanted to spawn a Tank but script can't find big enough position, I then want to just terminate the script. That way I can spawn something else instead.

The way it works now it will hold in memory the tank spawn and perform eventually when I no longer want it.

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

×