Jump to content

triggered_effect syntax


Recommended Posts

I had asked a question and then enlightened myself through thought.  I'm sorry for the confusion but I suppose I can alter my perception of the question.  I know that triggers require some sort of interaction like a mouse click or key press.  Is it possible to create your own triggers and bind them to a key?  This may have already been covered somewhere.  My original question was, just to show some humility:

 

"Hello, I'm newish in attempting to mod.  I need some guidance on how to write the syntax to activate a trigger on an animator, if it is possible.  I can make a bool work just fine but I'd like to know how to write for a trigger.  I mostly just testing, trial and error and playing around.  Even if my mods never get released I'm having fun doing it.  I certainly don't think I have enough meat and potatoes in them to release lol.  The bool example looks like:

 

<triggered_effect trigger="onSelfPrimaryActionStart" action="AnimatorSetBool" target="self" property="DoThis" value="true"/>

 

How can I write this line to use a trigger instead of a bool please?

 

<triggered_effect trigger="onSelfPrimaryActionStart" action="AnimatorSetTrigger" ??? />

 

I've been trying to figure it out on my own, watching videos, looking at game code, and other mods but I just cant seem to figure this one out.  Still not even sure if you can activate a trigger this way.  If anyone has some insight to guide me along I would be very grateful."

 

So after the fact, I understand how the triggers function.  WeaponFire is left click, and UseItem is right click, i.e.: Action 0 and Action 1.  Perhaps to salvage the post, can you create your own triggers and tie them to a click or press?

 

 

Edited by HitmanDrummer
I didn't think hard enough before I posted. (see edit history)
Link to comment
Share on other sites

You can't create your own actions without writing C# code.

 

However, there is already an action called "AnimatorFireTrigger". The "property" attribute should be the name of the trigger to fire.

 

Its purpose is to call the Unity Animator.SetTrigger method:

https://docs.unity3d.com/ScriptReference/Animator.SetTrigger.html

 

That sounds like what you want.

 

EDIT: I'm assuming that's what you meant by "creating your own triggers?" It's a bit confusing because a "trigger" could also mean something like "a key press" and not "a trigger on the entity's animator."

 

If you want a new kind of key event (like, open your own window by pressing the "k" key or something), then that also requires C# code. I don't know how to do it specifically, but if you join Guppy's Discord, there are other 7D2D code gurus who probably know.

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

Thank you so much for your reply.  I guess I should have mentioned the syntax is for the XML script files.  I managed to figure out what I was trying to achieve using animator properties(parameters) that are tied to the 7D2D game functions.  It was not an end result for my task but I'm glad it's resolved.

 

In addition, I read somewhere that you weren't allowed to have C# scripts on your prefab models, so I just haven't even bothered to try.  I'm quite familiar with all of the big names in modding as I do a lot of research.  Guppy actually helped me a while back when I first tried modding.  None-the-less, thank you so much for your reply khzmuzik, feels like one of those...I had to ask first and then figure it out moments.

 

I will share some of what I have discovered for anyone else interested.  For people familiar with the game it should be simple to figure out how the parameters take effect in the game.  I'm not sure if its okay to share the image so I apologize if its against forum rules.  I'm not entirely familiar with forum etiquette.

spacer.png 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...