YesNoOk
avatar

ParentDist (Triggers) (Read 3684 times)

Started by Ricepigeon, October 13, 2015, 07:51:25 pm
Share this topic:
ParentDist (Triggers)
New #1  October 13, 2015, 07:51:25 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
This trigger is only valid for helper-type characters. ParentDist returns the distance from the helper to its parent. It works similarly to P2Dist.

Format:
    ParentDist [component]
Arguments:

    [component]
        X, Y

Return type:
    float
Error conditions:
    Returns bottom if the player does not have a parent (e.g., if the parent was destroyed or KO'd).
Details:
    For comparing the Y-distance, ParentDist gives the difference in the heights of the players' Y-axes. A negative value means that the parent is above its child. For comparing the X-distance, ParentDist gives the X-distance of the parent's axis from the child's axis. A positive value indicates the parent is in front of the child.

Examples:
Code:
trigger1 = ParentDist X != 0
  Triggers if the parent is not at the exact same x-position as the
  helper character.

PARENT SCTRL
Helper

RELATED TRIGGERS:
IsHelper
NumHelper
RootDist

RELATED SCTRL:
BindToParent
BindToRoot
DestroySelf
ParentVarAdd
ParentVarSet

Additional Notes
If the parent of the helper is the root (the Player), then this trigger is functionally identical to the RootDist trigger.

Because there is no ParentExist trigger to detect if a helper's parent exists (for instance, if the parent calls the DestroySelf SCTRL), there may be instances where calling the ParentDist trigger will result in a debug error logged to the console. In MUGEN 1.1b, this issue can be circumvented with the use of recursive DestroySelf, but in MUGEN 1.0 and earlier versions, you will need to keep track of the helper's parent by using the ID and PlayerIDExist triggers.
Last Edit: December 12, 2015, 02:07:58 am by Just No Point