HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: ONFXSTART event cant query FX by name  (Read 936 times)

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
ONFXSTART event cant query FX by name
« on: Sep 04, 16, 01:33:03 AM »

Quote
shared function _FxEventOccurance(event as String, fxName as String, theFxGroup as NodeRef of Class _FxGroup)
    if(fxname == "XXXXXXXXX" and event == "ONFXSTART")
      fx as NodeRef of Class _Fx = theFxGroup.FindFxByName("XXXXXXXXX")
      println(fx)
   .
.

This always returns 0. Even if I swap XXXXXXXX for a value that was initiated before this FX.

Can you not query an FX by name during the onfxstart event?

Thanks

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: ONFXSTART event cant query FX by name
« Reply #1 on: Sep 04, 16, 05:26:27 PM »

Here are some tips for using _FxEventOccurance(), based on my experience using it:

For
Code: [Select]
shared function _FxEventOccurance(event as String, fxTaskName as String, theFxGroup as NodeRef of Class _FxGroup)---------------------------
 event
      - what event is happening, e.g. ONFXSTART, ONFXSTOP, ONFXTIMEOUT, etc.

 fxTaskName
      - the name of the task that issued the event.

 theFxGroup._fxName
      - the name of the overall FX (as named in the FxGroup Properties dialog.
        That might be different from the Spec Name that shows in the List).
        fxTaskName == theFxGroup._fxName ensures that the event is for the ENTIRE FX.
        For ONFXSTOP of the group, that happens at the end of the Fire Rate time, not the timeout.

 theFxGroup.FindFxTaskByName(fxTaskName) as NodeRef of Class _FxTask
      - gets the actual _FxTask, if it is a task. If not this returns None.
        task.GetFxGroup() will always return the _FxGroup, which is the same as passed in above.
        task.GetOwnerOfFxTask() will return the _FX that contains the task.
          If the task is a direct child of the _FxGroup, then that _FxGroup is returned.
          Else the task is in an _Fx (subgroup) and that subgroup is returned.

 theFxGroup.FindFxByName(theName as String) as NodeRef of Class _Fx
      - gets the actual _Fx (subgroup), if it is a _Fx. If not this returns None.

 resourceTask.GetMyFxAsset() as NodeRef of Class HBNode
      - gets the hb node that was created for this resource.
        assumes that resourceTask is of Class _FxResource or derived from that.

 theFxGroup.FindFxNodeByName("CASTER") as NodeRef of Class HBNode
      - gets the node of the caster.

 theFxGroup.FindFxNodeByName("TARGET") as NodeRef of Class HBNode
      - gets the node of the target.

 theFxGroup.FindFxNodeByName(fxTaskName) as NodeRef of Class HBNode
      - gets the asset instance for the named task, assuming it inherits from fxResource.

 theFxGroup._fxDynData
      - possible dynamic data passed when the fx was played.
« Last Edit: Sep 08, 16, 03:55:22 PM by FI-ScottZ »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: ONFXSTART event cant query FX by name
« Reply #2 on: Sep 04, 16, 05:38:12 PM »

Some other helpful functions you might want to handle in an fx callback script:

shared function _OnFxGroupPreLoad(theFxGroup as NodeRef of Class _FxGroup)
  //----------------------------------------------------------------------
  // Called just before resources are loaded into prop buckets
  // This call allows you to dynamically change the resources to be loaded
  // This is called before OnFxGroupPreStart
  //----------------------------------------------------------------------

shared function OnFxGroupPreStart(theFxGroup as NodeRef of Class _FxGroup)
  //----------------------------------------------------------------------
  // Called just before the fx begins, passing in the entire group
  // which allows you to modify anything within however you like.
  // This is called after _OnFxGroupPreLoad (resources have now been loaded).
  //----------------------------------------------------------------------

shared function _FxScriptCallEvent(event as String, fxTaskName as String, theFxGroup as NodeRef of Class _FxGroup)
  //----------------------------------------------------------------------
  //  This is called by _FxScriptCall tasks.
  //----------------------------------------------------------------------
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: ONFXSTART event cant query FX by name
« Reply #3 on: Sep 07, 16, 08:36:44 PM »

I used theFxGroup.FindFxTaskByName(fxTaskName) to solve this.

I am still unsure if theFxGroup.FindFxByName() is broken or I am using it wrong but the above function was what I wanted.