Topic: Trying to add new functions to the Move Editor

I'm trying to add a new function to the Move Editor. Basically, I'm trying to add an option to change the players position on a certain frame. I've gotten up to the point where I'm trying to add it into the MoveInfo.cs script, but I'm getting this error:

Error    CS0246    The type or namespace name 'PlayerTransform' could not be found (are you missing a using directive or an assembly reference?)

Is there a script that I need to add to in order to fix this error?

Share

Thumbs up Thumbs down

Re: Trying to add new functions to the Move Editor

Use this instead:

int player = 1;
FPLibrary.Fix64 newX = 5;
UFE.GetControlsScript(player).worldTransform.position.x = newX;

Notice you need to use Fix64 instead of float (UFE uses a different notation to account for deterministic physics)

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: Trying to add new functions to the Move Editor

Mistermind wrote:

Use this instead:

int player = 1;
FPLibrary.Fix64 newX = 5;
UFE.GetControlsScript(player).worldTransform.position.x = newX;

Notice you need to use Fix64 instead of float (UFE uses a different notation to account for deterministic physics)

What part of the script do I put this in?

Share

Thumbs up Thumbs down

Re: Trying to add new functions to the Move Editor

Adding new options to the Move Editor is actually a lot more complicated, so I recommend just using UFE Events to trigger this behavior depending on the move played:
http://www.ufe3d.com/doku.php/code

Create a new script, subscribe to the desired event (ex: OnMove) and use the code above to change the character's position.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: Trying to add new functions to the Move Editor

Mistermind wrote:

Adding new options to the Move Editor is actually a lot more complicated, so I recommend just using UFE Events to trigger this behavior depending on the move played:
http://www.ufe3d.com/doku.php/code

Create a new script, subscribe to the desired event (ex: OnMove) and use the code above to change the character's position.


I see. Thanks for the help!

Share

Thumbs up Thumbs down

Re: Trying to add new functions to the Move Editor

Real quick, would the I be able to use the "OnMove" event on a specific animation frame, or  does it always default to the start of the move?

Share

Thumbs up Thumbs down

Re: Trying to add new functions to the Move Editor

Unfortunately there is no way to do this with events atm. I'll add this to my ToDo list.

For now you can try using one of the pre-set options (preferably one you dont use) and inject the code you need into it.

For example, under ControlsScript.cs, look for this segment:

// Check for Sort Order Overrides
foreach (MoveSortOrder sortOrder in move.sortOrder)
{
   if (mySpriteRenderer != null && move.currentFrame == sortOrder.castingFrame)
  {
      mySpriteRenderer.sortingOrder = sortOrder.value;
   }
}

Replace it with this:

// Check for Sort Order Overrides
foreach (MoveSortOrder sortOrder in move.sortOrder)
{
   if (mySpriteRenderer != null && move.currentFrame == sortOrder.castingFrame)
  {
      mySpriteRenderer.sortingOrder = sortOrder.value;

      worldTransform.position.x = 5;
   }
}

Now just create a new sort layer order under Move Editor -> Sort Layer and pick the frame you want.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: Trying to add new functions to the Move Editor

Mistermind wrote:

Unfortunately there is no way to do this with events atm. I'll add this to my ToDo list.

For now you can try using one of the pre-set options (preferably one you dont use) and inject the code you need into it.

For example, under ControlsScript.cs, look for this segment:

// Check for Sort Order Overrides
foreach (MoveSortOrder sortOrder in move.sortOrder)
{
   if (mySpriteRenderer != null && move.currentFrame == sortOrder.castingFrame)
  {
      mySpriteRenderer.sortingOrder = sortOrder.value;
   }
}

Replace it with this:

// Check for Sort Order Overrides
foreach (MoveSortOrder sortOrder in move.sortOrder)
{
   if (mySpriteRenderer != null && move.currentFrame == sortOrder.castingFrame)
  {
      mySpriteRenderer.sortingOrder = sortOrder.value;

      worldTransform.position.x = 5;
   }
}

Now just create a new sort layer order under Move Editor -> Sort Layer and pick the frame you want.

Alright then. Thanks for the help!

Share

Thumbs up +1 Thumbs down

Re: Trying to add new functions to the Move Editor

Alternatively, you can have your move activate a new move on the frame you want the teleport to happen which then carries out the rest of the motion. This is my approach currently for some logic I have.

Cheers.

Share

Thumbs up +1 Thumbs down

Re: Trying to add new functions to the Move Editor

RetroX wrote:

Real quick, would the I be able to use the "OnMove" event on a specific animation frame, or  does it always default to the start of the move?

I normally use the OnMove() as a trigger where I set a bool if the event was hit with the specific move I was looking for. Then in my Update() method I check if that bool is set to true, and the currentMove is still the move I'm looking for, and the currentMove.currentFrame is the frame I'm looking for, then do the thing I want on that frame, otherwise if currentMove isn't the move I'm looking for, set the bool to false.

Something along those lines.

Though I'm always worried such script additions might cause desyncs in online matchmaking due to possible non-tracking of such things... I'm still hazy on the online code.

Share

Thumbs up Thumbs down

Re: Trying to add new functions to the Move Editor

So I'm trying to experiment with changing the characters position when a move is being used. While I can get the mesh to move, the hitboxes seem to stay at the original position. Is there a way to update the position of both the model and hitboxes through code?

Share

Thumbs up Thumbs down