Combat highlight vs can_see/can_hear

burn

A Smooth-Skin
Modder
I'm basically trying to recreate default F2 combat highlighting in a script. It seems that obj_can_see_obj corresponds to red outline well, but many more critters are outlined with yellow than I get from obj_can_hear_obj. How are they detected then? Or is it just some generic area radius thing?
 
If you mean the fixed obj_can_hear_obj, it's pretty much like obj_can_see_obj without LOS check.
 
Last edited:
Well, the fix is applied automatically with sfall, right?
To clarify, here are 2 screenshots (default, modified) and the corresponding code:
Code:
foreach obj in list_as_array(LIST_CRITTERS) begin
      color := OUTLINE_NONE; //default
      if is_in_array(obj, party_member_list_critters) and obj != dude_obj then begin
        color := OUTLINE_GREEN_GLOW;
        ndebug(obj_name(obj) + " is party member");
      end else if obj_can_see_obj(dude_obj, obj) then begin
        color := OUTLINE_RED_GLOW;
        ndebug(obj_name(obj) + " can be seen");
      end else if obj_can_hear_obj(dude_obj, obj) then begin
        color := OUTLINE_YELLOW;
        ndebug(obj_name(obj) + " can be heard");
      end
      set_outline(obj, color);
      ndebug("set " + obj_name(obj) + " to color " + color);
    end
 

Attachments

  • 1.jpg
    1.jpg
    328.7 KB · Views: 445
  • 2.jpg
    2.jpg
    324.1 KB · Views: 425
OK, so once it's enabled it does indeed work like you said, but overall highlight still isn't same.
It seems there's some problem either with my code or with obj_can_see_obj? Because I sure can shoot that top left corner raider, but somehow I can't see him?
 

Attachments

  • 3.jpg
    3.jpg
    316.5 KB · Views: 400
@burn
the critter highlight stuff (well at least those beyond LoS) was always related in some way to perception in vanilla I remember going once through the temple of trials with PE1 and the highlight feature worked only for nearby surroundings. Whereas PE10 gives large map coverage (but not full on some really big maps).


As the topic of critter highlighting is touched, Can anybody add feature to sfall so that critters who are non hostile and not aligned to player party be distinguished somehow from enemies (as of now they're all highlighted in animated red when visible).

Let's just pretend Fo/Fo2 manual does not state, that not all red outlined critters are enemies. How about non-hostiles are highlighted in blue and enemies in red hmm? this would totally help karma loss to all those newbs with attention span trouble out there so that when raiders attack caravans kiddos don't shoot caravans by accident and wonder why their karma dropped or something.

For Instance the issue of not recognizing foe or neutral is an issue of game crash during adytown assault in Fo1. There is a neutral dog with 14hp wandering around the town and when people attack regulators they think the dog is on regulators team (because it's outlined red and mooves around during it's turn) the dog is aligned with adytowners just not on player's team when assaulting the regulators. If the dog is dead during the fight, than after the fight game crashes. If the dog is left alive, after all the fighting is done than usually everything is fine. PPL think this fight is bugged but it's mainly because they shoot the dog.

If neutral critters would be highlighted in blue the above would not be the case i think.

How about it @NovaRain @Crafty

is it possible to add such functionality to your sfall's?
 
The guard can hear you because you're not far away.
It's not that guard can hear me, it's I can hear him. But the question is why it doesn't match the original highlight as show in picture 1.

@burn
the critter highlight stuff (well at least those beyond LoS) was always related in some way to perception in vanilla I remember going once through the temple of trials with PE1 and the highlight feature worked only for nearby surroundings. Whereas PE10 gives large map coverage (but not full on some really big maps).

As the topic of critter highlighting is touched, Can anybody add feature to sfall so that critters who are non hostile and not aligned to player party be distinguished somehow from enemies (as of now they're all highlighted in animated red when visible).
Well, yes, it's related somehow. I was looking to understand how.
As for non-hostile highlight:
1) I don't believe there are really any newbs playing F1/2 anymore.
2) However, it would be a convenient feature to have, and I looked into it already. The problem is that there's no reliable way to tell if a critter is hostile. It's determined by its individual script, which sometimes use LVAR_Hostile (local variable, has no name, only number, usually 5, but not always), sometime hostile_bit in LVAR_flags, sometimes personal_enemy_bit in LVAR_flags... or sometimes could be something else, would have to check every script to be sure.
If this problem could be solved, there would be no need to add features to sfall anyway, it could be just scripted.

Что значат цифры сверху?
Здоровье.


On the original question of matching vanilla combat highlight in a script, I went with a hack for now:
Code:
  call disable_highlight;
  if in_combat and get_cursor_mode == CURSOR_TARGETING then begin
    set_cursor_mode(CURSOR_COMMAND);
    set_cursor_mode(CURSOR_TARGETING);
  end
 
Last edited:
В бою видимость рассчитывается немонго по другому в движковой функции, алгоритм в hs_withinperception.ssl
 
Back
Top