Trouble with "aggro range" of critters.

lujo

Look, Ma! Two Heads!
Right, so I'm playtesting traps for the Economy & Combat mod, and I like stuff about them but there's one thing keeping me from being able to use them in places where they would be most useful. Some critters "aggro" from a mile off regardless of sneak. It doesn't matter how traps work, it's just that some critters are truly bizzare and I'd love to know what exactly triggers their aggro.


For example there are the deathclaws in the Abbey in RP which aggro from, well, a screen away or more. And there's the wannamingos in the wanamingo mines - the distance they aggro from ranges from very little to only one guy aggros to whole leverl comes at you at once. There are also the Raiders - sometimes you get a whole group of them coming at you, sometimes ony some, and 2 out of 3 guys in combat armors never ever come to help the squad even if you killed everyone else and are looting the hideout.

So, does anyone know what handles these things?
 
I've figured something out, at least - it's possible that "aggro ranges" don't have anything to do with perception, really. Most of them seem to be tied to line of sight with some special cases where stuff sometimes joins combat even if it doesn't clearly see you.

What I was able to do is mod the Deathclaw in the abbey (and also noticed that one of the two is using the random encounter DC script for no discernible reason, lol), anyway, I adjusted it so it doesn't aggro from the other side of the map if you just turn a corner. Now I can place a few traps in a semi-chokepoint, and it doesn't really matter how far you're standing when those things engage, they have a million hitpoints and stats anyway.

What I did was look at the SAD entrance turrets which have a sort of ridiculous range, so much so that they kind of lock you out of the place unless you snipe them with a sniper rifle (most range you can get on a gun, pretty much), and saw that they have this in their critter_p_proc:

Code:
 if ((self_can_see_dude) and (tile_distance_objs(self_obj,dude_obj) <= 17)) then begin      attack(dude_obj);

So the ridicuously long ranged turrets need a special limit on how close you have to be for them to engage, and it's "only" 17 hexes. They have 8 perception, so 8 perception would probably let them engage at more than 17 hexes (if it even does anything). The deathclaw had 10 perception and, if the space was big enough, would probably be engaging from at least 30 hexes away. That's just "initiating combat", not "registering the player and moving in to attack" I think, as critter_p_proc isn't called in combat.

So I gave it:

Code:
 if ((self_can_see_dude) and (tile_distance_objs(self_obj,dude_obj) <= 6)) then begin      attack(dude_obj);

And was able to stand in a spot where I wanted as long as I didn't get too close, or the deathclaw (set to wonder around pretty randomly and pretty far) came too close.




This is actually kinda important because it could allow for more "setpiece" or "commando" fights and random encounters, as opposed to always being forced into a fight. Now if I knew how to make a global aggro range macro XD




EDIT: However, I'm having trouble understanding the self_attack_dude macro, and way too many things seem to work only if the critter in question can see you, so I'm not sure how to make guys (like the raiders captains who loaf in corners despite a battle raging in a cavern they are in) run towards dude untill they can see you and engage in combat.

Strange, command.h seems to have a ton of options, it's just that I'm having trouble understanding where (if at all) these are currently applied.
 
Last edited:
That's a good easy solution to reduce aggro range. I think "self_can_see_dude" is taking perception into account. As for the raider guys, you could probably try using "anim_run_to_tile" command but I think it only works in realtime mode. In combat, critter movement is controlled entirely by the combat AI (will not hurt trying though, as I'm not 100% sure).
 
Well, this solution is deffinitely workable for setpiece fights in enclosed spaces, or animals minding their own bussiness out in the open if you spawn far enough away. :)

I've tried "anim_move_to_tile" on the mercenary captains at the raiders, but it only worked out of combat and the guy kept walking towards me untill he "found me", and I'm not sure if the guys at the far end got stuck in corners.

What I'm wonderign now is where the code for the AI packets is, I tried searhing for it, but no luck. I think if anything is to be done with combat behaivior it has to be modified there. Because the command.h contains a lot of macros which could be used to make better AI (everything being based mostly on "if can see dude" and otherwise retaliating against whoever damaged a critter is really limiting - and it's kinda making tanky NPC's like Lenny not really work).

Because if I knew how to alter combat behaivior using all the macros for everything there is in command.h I could really make combat interesting.
 
Because if I knew how to alter combat behaivior using all the macros for everything there is in command.h I could really make combat interesting.

Entire combat AI is hard-coded in the engine (not scripted). Different AI packets only provide limited ability to alter AI, so if you want to change something, you need to do some hacking.
 
Back
Top