ProjContact(*,***) (Triggers) (Read 6242 times)

Started by Just No Point, October 20, 2015, 03:29:18 PM
Share this topic:
ProjContact(*,***) (Triggers)
#1  October 20, 2015, 03:29:18 PM
  • ******
This trigger takes an optional ID number as a suffix. If the ID number is omitted, ProjContact returns true if any of the player's projectiles either successfully hit the opponent or were guarded by the opponent. When the ID number is specified, ProjContact returns true only if any of the player's projectiles with the specified ID number either successfully hit the opponent or was guarded.

1.) ProjContact[ID] = value
2.) ProjContact[ID] = value, [oper] value2

Optional ID number.
value (boolean)
Value to compare against. 0 for false, 1 for true.
=, !=, <, >, <=, >=
Time value to compare against.

Return type:
boolean int

Error conditions:

ProjContact will trigger once for each hit of the projectile, so a multi-hit projectile can trigger multiple times.
The first form of ProjContact shown above is only valid for one tick after contact, unlike MoveContact.
For the second form, ProjContact returns true if the projectile made contact n ticks ago, where n is a nonnegative number satisfying the relation "n [oper] value2". Specifying an ID number of 0 gives the same behavior as if the ID number is omitted (check all projectiles).

1. trigger1 = ProjContact1234 = 1
  Triggers if a projectile with ID 1234 just made contact with the
2. trigger1 = ProjContact456 = 0, < 15
  Triggers if no projectile with ID 456 made contact in the last 15

Related SCTRL:
Projectile (SCTRL) 1.0 + 1.1b

Related Triggers:
NumProj (Triggers)
NumProjID (Triggers)
ProjCancelTime (Triggers)
ProjContactTime (Triggers)
ProjGuarded(*,***) (Triggers)
ProjGuardedTime (Triggers)
ProjHit(*,***) (Triggers)
ProjHitTime (Triggers)
Last Edit: November 25, 2015, 04:11:42 AM by Odb718
Re: ProjContact(*,***) (Triggers)
#2  February 24, 2019, 08:36:52 PM
  • avatar
  • *
    • Ukraine
It should be noted that the first form of ProjHit/ProjContact/ProjGuarded may not work properly under some circumstances.
I had an instance where I had a helper that spawned a projectile for two ticks for hitcheck purposes (I could've just used HitDef, but that'd render me vulnerable to the Omega Tom Hanks Killer) every second tick and I wanted this helper to self-destruct the moment the projectile successfully connected.

[State Self-Destruct]
type = DestroySelf
trigger1 = root,projcontact1000 = 1

The code above should work just right, shouldn't it? Except it didn't in my case. The helper just went through the opponent dealing 4 to 5 hits when I needed one. However, the second form worked as intended:

[State Self-Destruct]
type = DestroySelf
trigger1 = root,projcontact1000 = 1, = 1

The helper disappeared the moment it hit the enemy. Hope this helps someone struggling with this bug like I had.