NPC Projectile vs. Player

You can use candamage and put its input to which entity type that your NPC is going to damage.

hostile {type1} {type2} ...

  • Optional.
  • Specifies what types an AI controlled entity will attack and what entities a projectile with the chase subtype will seek (this does not determine what the entity can hit, only what it will intentionally attack).
  • Accepted types are enemy, player, npc, obstacle, shot and you can use as many as you need. If you want entity to be hostile to nothing, just set 'none' here.
  • Be aware if you use this setting, you must provide all types you wish this entity to be hostile towards. That is to say, an enemy with ‘hostile npc obstacle’ will only attack npc and obstacle types, not players.
  • Also 'stealth' feature below affect if the entity will target certain other entities or not.

candamage {type1} {type2} ...

  • Optional.
  • Specifies what types this entity can hit (very similar to hostile, but determines what entity may hit, not what it will intentionally target).
  • Available types are enemy, player, npc, obstacle, shot and you can use as many as you need. If you don't want entity to hit anything, just set 'none' here.
  • Be aware if you use this setting, you must provide all types you wish this entity to be able to hit. That is to say, an enemy with ‘candamage npc obstacle’ will be able to hit npc and obstacle types, not players.

Example:
Code:
candamage player enemy obstacle

or
Code:
hostile player enemy obstacle

Your NPC character is only going to attack/damage against specific entity types which are players, enemies, and obstacles.

Or....

In script, like the standard code of candamage, you can change its candamage value here. This one is basic for this certain entity to attack players, enemies, obstacles, and NPCs only. You should clarify which entity type you are going to use for the entity to attack.

C:
void self = getlocalvar("self");
changeentityproperty(self, "candamage", openborconstant("TYPE_PLAYER"), openborconstant("TYPE_ENEMY"), openborconstant("TYPE_OBSTACLE"), openborconstant("TYPE_NPC"));

But for the "hostle" entity property, I don't know because I don't see any example of using it. It may or may not be used for the entity property. I will let @Kratus enlighten us about it and/or how it works.
 
But for the "hostle" entity property, I don't know because I don't see any example of using it. It may or may not be used for the entity property. I will let @Kratus enlighten us about it and/or how it works.
In SORX I'm using hostile in the same way as the candamage, like this:

C:
changeentityproperty(self, "hostile", "type_player", "type_npc"); //SET HOSTILE
changeentityproperty(self, "candamage", "type_player", "type_npc", "type_obstacle"); //SET CANDAMAGE
 
Back
Top Bottom