Jump to content
Sign in to follow this  
TRexian

JTD Building Search script

Recommended Posts

Yeah, try (getPos (leader _grpUnit)) in your wrapper script.

But, I just took another look at what you posted. For AHP, you used this line:

[_grpunit,[radius],[5,15],99,[0,0],0.1,FALSE,["Land_Water_Tank","Land_Vez"]] execVM "AHP\AHP.sqf";

For the building script, it may be as simple as:

[_grpunit,100,"RANDOM"] execVM "JTD_buildingSearch.sqf";

The rest of the defaults should work (the leader of the group's position will be used as the center of the search radius).

I'm just not sure how that interacts with VTS. :) But, as long as you have that sorted, that's what counts! :D

Edit:

@ rainf

Ok, mate, here's what I've worked up. It is a wrapper that allows you to hit an addaction, open a map, then click a spot. At that point, the closest group on your same side will execute a 'block search' around that area. This is 'lightly' tested. :) You will need to have either an init.sqf or in the init line of your unit have the command:

_aaMapSearchIndex = player addAction ["Search here", "JTD_searchOnMapClick.sqf","",10,false,true,""];

Then, cut and paste this bit into a file called "JTD_searchOnMapClick.sqf" and put it in the mission root folder.

// JTD trigger search from onMapClick
// by TRexian

// executed by addaction
// _aaMapSearchIndex = player addAction ["Search here", "JTD_searchOnMapClick.sqf","",10,false,true,""];

private ["_aaMapSearchIndex", "_grpFM", "_FunctionsManager", "_pos", "_mapPos", "_tempMen", "_group", "_l", "_testBool", "_searchFunc"];

if (isNil "JTD_bldgsrchPath") then {JTD_bldgsrchPath = "";};
if (isNil "bis_fnc_init") then
{
createCenter sideLogic;
_grpFM = createGroup sideLogic;
_FunctionsManager = _grpFM createUnit ["FunctionsManager", [1, 1, 1], [], 0, "NONE"];
waitUntil {!isNil "bis_fnc_init"};
};
if (isNil "JTD_bldgSearchFunc") then
{
JTD_bldgSearchFunc = compile preprocessFileLineNumbers (JTD_bldgsrchPath + "JTD_buildingSearch.sqf");
};

JTD_searchMapMarker = createMarkerLocal ["JTD_searchMarker", (getPos player)];
hint "Click on MAP to designate search area";

onmapsingleclick "JTD_searchMapMarker setMarkerPosLocal [_pos select 0, _pos select 1]; click = 1; closeDialog 0;";

waituntil {click == 1};

_mapPos = getMarkerPos JTD_searchMapMarker;
//diag_log text format["Mapclick: %1", _mapPos];

// need to get nearest allied unit
_tempMen = nearestObjects [_mapPos, ["MAN"], 100];
//diag_log text format["Mapclick temp men: %1", _tempMen];
_group = group player;
if ((count _tempMen) == 0) exitWith {
diag_log text "Mapclick: No men near.";
};

_l = 0;
_testBool = true;
while {_testBool} do
{
if ((side (_tempMen select _l)) == side player) then
{
	if ((group player) != (group (_tempMen select _l))) then
	{
	_testBool = false;
	_group = group (_tempMen select _l);
	};
};
_l= _l +1;
if (_l > (count _tempMen)) then {_testBool = false};
};

//diag_log text format ["Mapclick: search group %1", _group];
if (_group in JTD_lockedSearchGroups) exitWith {
diag_log text "Mapclick group already committed";};

_searchFunc = [_group, _mapPos, 50] execVM (JTD_bldgsrchPath + "JTD_blockSearch.sqf");
if (JTD_searchDebug) then
{
diag_log text "Mapclick search initiated";
};

Hope that helps!

Edited by TRexian

Share this post


Link to post
Share on other sites

Been away for a while. I have since downloaded the latest version...are the blocksearchers still being used? I don't ever see them move. I really enjoy this script, I was wondering if you would consider an option to have the AI goto rooftops and fight from the rooftops of zargabad :P Also it seems there is issues with the larger 3 story buildings they dont seem to enter and hold position or maybe it is having trouble selecting that specific building with "NEAREST". Any chance on entering a building ID?

Share this post


Link to post
Share on other sites

Hmmm... blocksearch should still be implemented. Will check that.

In terms of getting AI specifically to the rooftops, I'm not sure. If there isn't a buildingposition there, it gets tricky. Off the top of my head, I think I'd have to figure out the 'top' of the building using boundingbox or something, then setpos the unit there. That seems risky, though, and somewhat immersion-killing if you see a guy suddenly appear on a rooftop. :)

With the larger buildings, with many building positions, the 'occupy' option will only put units in the 'last' numbered positions. They may or may not be on the roof of a building.

I can try to get something that works on buildingID. That isn't a bad idea. :)

Edit:

Certain circumstances beyond my control mean that it may be awhile before any updates. I mean, longer than usual for me...

Share this post


Link to post
Share on other sites

Hey man no problem, keep up the great work! Any update you can provide is a service to the community it does not matter how fast you work. Thanks for your hard work.

---------- Post added at 05:32 PM ---------- Previous post was at 04:35 PM ----------

If I am using "[group this,getPos this, 25] call BIS_fnc_taskPatrol;" in one of the opfor units waypoints will they still be used for building search dutys? Or since they are busy with a patrol they wont be pulled from that script? Im needing to know if I need to have different groups for the patrol/defends and just have the building searchers on a cycle waypoint. sorry for so mayn dumb questions :rolleyes:

Share this post


Link to post
Share on other sites

haha

That's not a dumb question at all. :) I had to think about it for a minute.

I think that whichever is the last script to be called will be the one executed. So, if that is run after the building search, it will probably take precedence.

BUT, it may also just really confuse the sh!t out of the AI, so I'm not sure what they might do. :)

I would suggest having different groups for the two functions, at least for now, unless and until I figure out how to really create a checkin/checkout function.

Share this post


Link to post
Share on other sites

I have enemy AI spawning out of 8 town construction modules on proving grounds working right now. i host a server map name is Welcome_to_CQB_Test. ya 1st post.

if you want the 157 kb map join the server i cant upload here. or IM me at blackmamba57@hotmail.com using msn messenger. id be glad to give it to you all, Im using JTD building position script and crb unit cacheing 2.0 bout 400 enemy ai all spill out of various bldgs. these AI are not at all confused and if you wake them up they leave you bleeding profusely in a ditch full of holes in your underwear. if you was a fan of old rogue spear aggressive AI mods you will like this. thanks TRexian, crb guys and shuko and all the guys who script all this stuff for us... awesome. I use 98 second delay so all 8 towns load. tried usin bldg search script but it seems like it turns into ghost town nobody shows up to fight, actually there is no need for it since they send out groups of maybe 12 guys. you think town is empty cuz those twelve are dead ? big mistake.........

Edited by blackmamba

Share this post


Link to post
Share on other sites

haha

Glad you like it. Sounds like a fun mission. :)

Share this post


Link to post
Share on other sites

Can we get an example of how to implement this? The example mission are not working for me. I cant open them in the editor and look at the code being used.

To make it easier can you give me an example of the code I need to trigger a group to patrol around an area and enter buildings.

Share this post


Link to post
Share on other sites

So this is the code I use for the block search with no results.

search = [sQD, TL, 200] execVM "JTD_blockSearch.sqf";

SQD = the group name

TL = the group leader's name

200 = the radius

I have all .sqf in the mission folder. The group is given the order to block search once they reach a way point near the buildings I want them to search. Im trying to get them to search the factory in Chernarus.

Share this post


Link to post
Share on other sites

wait nevermind, I thought I had a solution lol

Edited by Shammy2010

Share this post


Link to post
Share on other sites

Hi there,

Nice work with the script it looks really lifelike but a problem I cannot get passed seems to be that the ai kinda never moves after their first waypoints. I assume this because they just kinda stops and that's it, they dont even enter the buildiing, I have it like this:

0 = [hotshot,15,"NEAREST", "dude1", true, false] execVM "JTD_buildingSearch.sqf";

I also have all the sqf files in the main root of my mission folder (yes every file is in the same folder) but I can get passed that if I look at your sample mission. But that's not the problem I cannot get passed, it's the same problem vision1776 is having. blocksearch isn't working... I tried this code...

0 = [hotshot, "dude1", 100] execVM "JTD_blockSearch.sqf";

EDIT:

Also wanted to ask if it's possible to somehow end the script via trigger.... what will the on act be? thankyou

Edited by Shammy2010

Share this post


Link to post
Share on other sites

SHammy, were you able to open the example in the mission editor to look at the code he uses? I couldnt open the examples in the mission editor it says: "Read only"

Share this post


Link to post
Share on other sites

I opened them with something I found on armaholic called "PBO View 0.8" here use this link:

http://www.armaholic.com/page.php?id=1434

and I've found a solution to the jtd_blocksearch.sqf, which is using just exec code and not execVM, for example:

[hotshot, "dude1", 100] exec "JTD_blockSearch.sqf";

still I want to end the script at a certain point through a trigger because I'm guessing the one that works (the one in the example mission) is an older version and makes every unit search every building position which can take some sweet time and get alot of ai killed in the process strange enough because arma 2 has the worst decal ever and ai's will fall off buildings through walls. I'm guessing the new version was meant to fix the ai searching every position but it only makes them go to positions only once and not move up at all.

What would be nice is if it was possible to have all the ai go to certain building locations and not send any other ai to that position but to send them to different positions and move up position numbers up until one of them reaches the last position. I also think that this is in here but I do not know how to use it due to lack of instruction...

Share this post


Link to post
Share on other sites

Sorry I've been out of this for so long. Not sure when I'll be able to spend more time on this, but I'm gratified that there's still interest!

I'll try to determine whether I have a newer version that I can post. I seem to recall it working quite well - notwithstanding AI issues falling off of rooftops.

Share this post


Link to post
Share on other sites

there must be some variable that turns true when done. Just use that as the precondition for a way point. But I have no idea what that variable would be.

Share this post


Link to post
Share on other sites

try using:

scriptdone JTD_script

where JTD_script is the name of the script handle when you execVM it (spawn, etc)

Share this post


Link to post
Share on other sites

how can i start it from a trigger? Especially for JTD_buildingSearch.sqf and JTD_blockSearch.sqf... The description is only telling which parameters are needed, but not how the array has to look like. I tried

[grpx, (getMarkerPos "blockMarker"), 250] execVM "JTD_buildingSearch.sqf";

but nothing happened...:confused:

Share this post


Link to post
Share on other sites

@Shammy

The scriptdone is probably the best way, maybe used conjunction with waituntil (scriptdone scriptvariablename). There is a global variable that keeps an array of units that are still occupied, and that may help. In all honesty, though, I never could figure out a way to have a group go through waypoints, take a break to search a building, then continue on with the waypoints.

@ KING

I would start by setting up the trigger, and onActivate have it start the script. You can use the group of the first unit in thisList as the group, then use the radius that you want. If you want to get fancy, you can probably have it use the radius of the trigger itself.

Sorry that I can't be more helpful with the syntax. Six months out of scripting, and my script-fu is full of fail....

Share this post


Link to post
Share on other sites

thank you, appreciate it, I'm just waiting for the new updated version now so I can put up my mission, it's going to be pretty intense so I want everything to be perfect lol

Share this post


Link to post
Share on other sites

@TRexian

ah ok... but thank you. This script seems to be pretty good! For the next release, it would be cool if you would provide more information how to implement it. You are just telling the parameters which have to be used, but you dont give an example how the array/syntax has to look like. And to check your example missions is not that easy, because they are compressed as pbo. Why not release them as editor mission?

Dont consider this as criticism, it is just a little tip... cool script

Share this post


Link to post
Share on other sites

No worries!

I'm glad people are still interested! :) I appreciate the patience.

In going through the documentation myself, trying to figure out what I did, I realized that my documentation was pretty poor.

Will try to post something soon, even if it is still pretty rough.

Share this post


Link to post
Share on other sites

Ofcourse we are still interested to have a random patrol go indoors and not just walk outside. It makes it much more realistic.

I sure hope Arma 3 has this implemented. This game is also missing some stopping power. Wonder if there is a script for that. I shoot an AI that is running and all I see is blood squirt but the guy keeps running.

But sorry to change the subject.

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  

×