Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Guard Behavior
#1
Was looking through the code today, and I noticed the guard code,

In modGameLogic, Sub AttackNpc:
Code:
' Now check for guard ai and if so have all onmap guards come after'm
        If Npc(MapNpc(MapNum, MapNpcNum).Num).Behavior = NPC_BEHAVIOR_GUARD Then
            For i = 1 To MAX_MAP_NPCS
                If MapNpc(MapNum, i).Num = MapNpc(MapNum, MapNpcNum).Num Then
                    MapNpc(MapNum, i).Target = Attacker
                End If
            Next i
        End If

This doesn't send ALL guard npcs after the player, it only sends guards of the same number. Is this just a misleading caption or a bug?


The fix would be as follows:

Change

Code:
If MapNpc(MapNum, i).Num = MapNpc(MapNum, MapNpcNum).Num Then

To

Code:
If Npc(MapNpc(MapNum, i).Num).Behavior = NPC_BEHAVIOR_GUARD Then

Again, optional. Personally I won't put this in, but the caption does say ALL.


-Bradyok
Reply
#2
It's for if you have different factions.


Lets say you have Guards, and Thieves set as guards. Attack one, and they all come, but the other doesn't.


Wouldn't make sense if you attacked a guard, and the thieves attacked you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)