Jump to content

Recommended Posts

21 minutes ago, Rydygier said:

but of course feel free to experiment

 

I will.

 

Thanks

Share this post


Link to post
Share on other sites

If I wanted to run this code at a later time via a trigger and not on initServer  can I do it?

I'm envisioning setting up tasks at different areas of the terrain and spawning an editor placed group via a trigger and at the same time put the code in onAct. Then doing it multiple times as the mission progresses. It should work, right?

 

I would have to change herne.sqf to herne1.sqf and so on.

 

examples;

onAct

call compile preprocessFileLineNumbers "Herne.sqf";

	{
	[_x] call RYD_CH_Herne;
	}
foreach [zomgrp1, smash1];
call compile preprocessFileLineNumbers "Herne1.sqf";

	{
	[_x] call RYD_CH_Herne;
	}
foreach [zomgrp2, smash2];

Or is there a better way? I suspect changes in herne.sqf would be required also.

Share this post


Link to post
Share on other sites
13 minutes ago, major-stiffy said:

If I wanted to run this code at a later time via a trigger and not on initServer  can I do it?

 

Yes, no problem, except this:

 

13 minutes ago, major-stiffy said:

call compile preprocessFileLineNumbers "Herne.sqf";

 

you do only once, no matter, how many hunters you plan to use later on. Keep this line in the initServer.sqf, execute it before you appoint any hunters (best just as it is in the demo, at the mission init).

 

Then, whenever you want to appoint some hunting group, also mid-game, you can do it also without foreach loops:


[zomgrp2] call RYD_CH_Herne;
[smash2] call RYD_CH_Herne;

[someOtherGroupName] call RYD_CH_Herne;


Can be inside onAct trigger field.

  • Like 1

Share this post


Link to post
Share on other sites

Excellent! Now I think I can make a mission with multiple tasks for us two players in MP. Also nice video by Gunter using zombies. 😁

Share this post


Link to post
Share on other sites

OK thanks.
I'm going to do the test again, but then: can only one radius be assigned in 2d?
Are height positions excluded from the code?

Share this post


Link to post
Share on other sites

Search radius is already 2D, height difference doesn't matter when the code searches for the houses nearest to the player. 

 

That's what the "true" here means:

 

private _blds = nearestObjects [_prey, ["house"],30,true];

 

Quote

 

2Dmode: Boolean - (Optional, default false) true for 2D distance, false for 3D distance

 

And when the house is found, all defined in that house positions should be included regardless of elevation:

 

(_bld buildingPos -1)

Share this post


Link to post
Share on other sites

ok thanks, but i tried again and they didn't go up the ladder (indeed it's the building in the picture where i put the player unit).
Even though I shot into the sky, they only went up when I tried again with the ASR AI3 mod.
I repeat, in vanilla mode, they just hang around at ground level.
It's not a criticism, I'm just making the comment in case it's useful.

Share this post


Link to post
Share on other sites

In my mission Desert Ops Run as i had noted on the OP as using part of the code in the script,

is the close quarters aspect, in the mission i have that office building in the center of the arena,

and when you are inside, and the AI know where your at, they will come up them stairs after you.

        They may hang around at ground level sometimes, but it all depends on them

knowing exactly where your at.

In my opinion using the script along with ai mods may hinder or enhance functions in the script,

so best to test them accordingly, know what and how the Herne script functions from seeing the

ai's actions in your tests and then compare notes.

 

Again in my mission using an ai mod like lambs not only reduces the fps, with alot of ai garrisoned it

also makes garrisoned units move from their position, so in relation with this script using lambs or another mod

may make the ai not do what their supposed to do or make them do more, it depends on the functions of the ai mod too.

Share this post


Link to post
Share on other sites
8 hours ago, elpreguntadoro said:

they didn't go up the ladder

 

The ladder? The ladder, I saw there, leads to the roof. And you said, you was not on the roof. Is there any other ladder? I ask, because I need to test same situation in order to analyze and then maybe to fix. Still, if I'll have time and free mind, I intent to try work bit more on this, as there's still room for improvements. Seems this exact building may be a good reference, as it may be properly challenging. The issues to overcome:

 

- currently the group moves cyclically from random house position to another house position. There's no consistency in building search. It's enough in small building, but if there's lots of positions and space to move, it may take ages for them to check everything with no warranty, it will even happen;

 

- also, because of size of the building, AIs may be sometimes redirected to other position before they manage to reach previous one;

 

- there's still the problem of vanilla AI, which I try to "tame" by certain behavior and combat mode, but AIs may still be sometimes not obedient anyway.

Not sure, if/when I would try to improve this though. 

Share this post


Link to post
Share on other sites

Would it be possible to get the bounding box size of the building that the target is hiding in (I think there is a way to determine if a unit is indoors) and adjust your search radius dynamically to that? Say a default value and if hiding in a building that is a bounding box over default, adjust search radius only in that case? 

Share this post


Link to post
Share on other sites
31 minutes ago, accuracythruvolume said:

Would it be possible to get the bounding box size of the building that the target is hiding in (I think there is a way to determine if a unit is indoors) and adjust your search radius dynamically to that? Say a default value and if hiding in a building that is a bounding box over default, adjust search radius only in that case? 

 

The radius, I talk about is to search for the nearest building (the one, player is inside). There's a command (brand new in fact) to determine, if unit is inside a building or not, but it doesn't return a building. So although you could learn the bounding box, you obviously must to know the building already in order to do so. And once the building is known, you don't need any radius, as there's a command provided earlier, that would return ALL house positions in that building. 

 

So the problematic (sometimes) part is to find a building, in which the player hides. 

 

We have also:

 

https://community.bistudio.com/wiki/nearestBuilding

 

But it shares the same problem. Though I would say, wrongly chosen building should be rare enough to ignore/tolerate. 

Share this post


Link to post
Share on other sites

Possible solution would be to gather all near buildings in quite wide radius around the player. Then for bounding box of each building to take its 2D horizontal plane on the ground (a top down rectangle shape of the building) and use inArea check to find out, if player is in the area of that bounding box plane. Although in some cases, say some L- or U-shaped buildings, player may be in the rectangle area of their bounding box while not truly inside, so https://community.bistudio.com/wiki/insideBuilding should be used too. Or some LOS-based "roof over head" check. 

 

Maybe I'll use this, but it means, the code will be considerably heavier due to extra calculations. So only, if this prove to be a serious problem after all. Meanwhile Herne meant to be as simple, as possible...

  • Like 1

Share this post


Link to post
Share on other sites

@Rydygier

 

A bit long but very interesting coding by Genesis especially at 20:00 mark.

 

Share this post


Link to post
Share on other sites
6 hours ago, Gunter Severloh said:

Again in my mission using an ai mod like lambs not only reduces the fps, with alot of ai garrisoned it

also makes garrisoned units move from their position, so in relation with this script using lambs or another mod

may make the ai not do what their supposed to do or make them do more, it depends on the functions of the ai mod too.

I am excited to use this script! @Gunter Severloh from your video, what MOD gets you the FIA Zombies and what HTH are you using?

Share this post


Link to post
Share on other sites
18 minutes ago, Gunter Severloh said:

Whats HTH?

Sorry, Hand to Hand combat...looks like the WebKnight's Zombies and Creatures uses the Improved Melee System.

Share this post


Link to post
Share on other sites
2 hours ago, Soapbox0331 said:

WebKnight's Zombies and Creatures uses the Improved Melee System.

Ya makes it quite more immersive, also hard to get away from.  i thought in my video there when they were coming

up the stairs i could take them down because they were funneled but that proved wrong as they

seemed to sidestep or dodge, almost better to take them at range at least those types.

     Try this and you'll be in for a scare 😄 but go to the video on utube itself, press play from the beginning and then press 8,

before you do that turn your volume up 😂

Share this post


Link to post
Share on other sites

Funny find. Because of this check:

 

((insideBuilding _prey) > 0)

 

Hunters will NOT search the building, if player is on the roof. On the roof means outside the building in terms of insideBuilding command (no wonder, it is positive only, if "interior" sounds would applied to the unit by engine). So described yesterday complex check without insideBuilding usage may be the way after all...

Share this post


Link to post
Share on other sites

The good news is, the above problem should be solved in the next version. Noted though, AIs directed via doMove into the building sometimes ignore that command, do not move at all and prematurely return unitReady true. Maybe it happens only, if they know about the enemy near, not sure. Anyways, that's pretty normal vanilla AI unreliability, if possible to workaround - we'll see...

 

EDIT: actually not bound to known enemy presence. Possible cause: not possible to find a path to a certain house position. A sort of workaround, that seems to help, will be applied: seems, the path to a house position in case of stuck exist, but AI can't find it. So, if such stuck detected, instead AI gets doMove to the position in the half way between current position and the building itself. It looks like, when close enough, it may be able to find a path to the same house position, that was "unreachable" from the bigger distance. Therefore reducing the distance between the AI and the building may help. 

  • Like 1

Share this post


Link to post
Share on other sites

Update

v1.1

From Rydygier

 

Most likely still some stuff to sort out, but main new points seem to work so far:

 

- Properly detects, in which building player is. Even, if on the roof;

- AI seem to not stuck as I saw before;

- Introduced kind of cohesion to the building search (here most likely some todos left), meaning now hunting group should search

the building not at random, but rather systematically, position-by-position, moving ladder-by-ladder from the ground level to the roof.

 

Maybe not quite specfor pro cqb, but bit closer to it, than before.

     From the other hand - it makes the hunters more predictable at house search.

Purple arrows indicate currently designated house positions, so you can monitor the intended search pattern.

In practice there are flaws (too long "stops" for example), but probably possible to improve. 

 

Code-wise script changed a lot, more complex. 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Reference new version 1.1

I'm using the method you helped me with above ie, [task3grp1] call RYD_CH_Herne;

initServer.sqf only contains

call compile preprocessFileLineNumbers "Herne.sqf";

 

I get this error which I didn't on version 1:

 

mpmissions\Hunting_the_hunters.chernarusredux\Herne.sqf..., line 423
19:29:59 Error in expression < %1m\nKnowledge: %2\nTime: %3s",(leader HuntingGroup1 distance  player) toFixed >
19:29:59   Error position: <HuntingGroup1 distance  player) toFixed >
19:29:59   Error Undefined variable in expression: huntinggroup1

 

Sorry, I know this is above and beyond what this was originally intended for but I think others myself will find it useful when spawning AI at various points along a mission.

 

Thanks

 

zombie.jpg

Edited by major-stiffy
added image

Share this post


Link to post
Share on other sites

Yes, this part:

 

[] spawn
	{
	while {alive player} do
		{
		sleep 0.1;
		
		hintSilent format ["Distance: %1m\nKnowledge: %2\nTime: %3s",(leader HuntingGroup1 distance  player) toFixed 0,(HuntingGroup1 knowsAbout player),time toFixed 0];
		};
	};

 

Is only internal debug. 1.1 is wip, hence you have debug stuff here, also those purple arrows. So, you can delete this part. Or if you want to use this debug, instead of HuntingGroup1 you have to put an existing group, you have in the scenario. Only one. 

 

Oh, BTW changed for now default setting, so now by default hunters will enter the building even, if player is not revealed to them. Easier to test. 

 

  • Like 2

Share this post


Link to post
Share on other sites

Herne 1.1 beta 2

 

Improved building search behavior (more fluid (1 sec. cycle intervals insted of 10 sec.), quicker, units doesn't try to return to the formation while waiting for another stage - "glued" to the current house position). 

 

Changes not tested at all outside this particular case, still wip. 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

In the script there is

knowsAbout player

Does this include client on hosted server?

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

×