YesNoOk
avatar

ProjHitTime (Triggers) (Read 2056 times)

Started by Just No Point, October 20, 2015, 03:34:18 pm
Share this topic:
ProjHitTime (Triggers)
#1  October 20, 2015, 03:34:18 pm
  • ******
    • www.justnopoint.com/
This trigger takes an required nonnegative ID number as an argument. If the player's last projectile to make any kind of contact successfully hit the opponent and had the specified ID number, then ProjHit returns the number of ticks since that contact occurred. If the specified ID number is 0, then the projectile ID is not checked. If no projectile meets all the above conditions, then ProjHitTime returns -1.

Format:
ProjHitTime(exprn)

Arguments:
exprn
Expression evaluating to a nonnegative ID number (int).

Return type:
int

Error conditions:
Returns bottom if exprn evaluates to bottom. If a negative ID is specified, then the ID defaults to zero.

Examples:
Code:
1. trigger1 = ProjHitTime(1234) = 1
  Triggers if a projectile with ID 1234 just made successful
  contact with the opponent.
2. trigger1 = ProjHitTime(0) != -1 && ProjHitTime(0) < 15
  Triggers if any of the player's projectiles made successful
  contact with the opponent within the last 15 ticks.

Related SCTRL:
Projectile (SCTRL) 1.0 + 1.1b

Related Triggers:
NumProj (Triggers)
NumProjID (Triggers)
ProjCancelTime (Triggers)
ProjContact(*,***) (Triggers)
ProjContactTime (Triggers)
ProjGuarded(*,***) (Triggers)
ProjGuardedTime (Triggers)
ProjHit(*,***) (Triggers)
Last Edit: November 25, 2015, 04:01:25 am by Odb718
Re: ProjHitTime (Triggers)
#2  February 17, 2016, 03:22:07 am
  • ****
  • it's me
  • Maybe something different
    • Chile
    • koakoa@jabber.org
    • Skype - koakumadevil69
    • cowabungamugenteam.weebly.com
Okay so during a test I notice some rather questionable behavior:

We were using this controller to play a sound on Projectile with ID 1000 hit in statedef -2:

Code:
[State Hitto]
type = PlaySnd
trigger1 = ProjHitTime(1000) = 0
value = 1,2
channel = 2
ignorehitpause = 1

We thought this code was solid enough to use since ProjHitTime(1000) works as a timer, yeah right... turns out we were duped, this scenario happenned:

I devised the following DisplayToClipboard, NOTE THE IGNOREHITPAUSE = 1:

Code:
[State -2, Debug]
type = displaytoclipboard
trigger1 = 1
text = "ProjHitTime(1000) = %d / ProjGuardedTime(1000) = %d"
params = ProjHitTime(1000), ProjGuardedTime(1000)
ignorehitpause = 1

First, we hit P1 with the projectile with ID 1000, this causes it to become non -1, AKA, it begins counting upwards as normal, then I hit P2 at the EXACT MOMENT ProjHitTime(1000) = 0 and I notice something... The sound suddenly spams itself MULTIPLE TIMES.

As it turns out by the debug ProjHitTime(1000) was frozen IN THE SAME TIME DURING P1'S PAUSETIME, at first I thought, I probably butched the ignorehitpause = 1, not really, it was there all along. So it seems ProjHitTime(exprn) does NOT increment during P1's hitpause, so be wary of this.