LogicBricks

Plugins LogicBricks

@Testitou
Ok, to summarize to make sure I got this right. You got:
  1. Two hair presets: One for with helmet, one without
  2. And separately you got a Helmet asset as CustomUnityAtom
Correct?

If yes, I recommend using a StateMachine from LogicBricks as well as ParentHoldLink from my Essentials 8 package:
  1. Add a CustomUnityAsset with your helmet to the scene, name it "Helmet"
  2. Load the helmet on hair preset onto your character.
  3. Place the helmet on the head and align it properly
  4. Add the ParentHoldLink plugin to the Helmet atom. Follow the instructions in the plugin UI to link it to head of your character. Use "head", not "headControl". Then disable the "Reset" checkbox of the plugin. (Important: Make sure to use the newest version Essentials 8, otherwise you won't have that checkbox)
  5. Add a StateMachine plugin somewhere to your scene. E.g. add an Empty atom and name it "StateMachine".
  6. Setup two states for the StateMachine: HelmetON and HelmetOFF
  7. Both states should be set to InfiniteDuration, assuming you want to switch with some external logic, like a button? (Otherwise you would need to setup some more states for other things to do as well transitions between the states)
  8. For the HelmetON state setup the following in "Actions OnEnterHelmetON":
    • Trigger: Person -> HairPresets -> LoadPresetWithPath (and select whatever hair preset you got for helmet on)
    • Trigger: Helmet -> AtomControl -> on (set to checked)
  9. Still for HelmetON state, setup the following in "Actions OnExitHelmetON". (Alternatively you could do it OnEnter of the other state, whatever you like more)
    • Trigger: Person -> HairPresets -> LoadPresetWithPath (and select whatever hair preset you got for helmet off)
    • Trigger: Helmet -> AtomControl -> on (set to unchecked)
  10. From anywhere in the scene you can trigger StateMachine -> plugin#0_MacGruber.StateMachine -> SwitchState (set to the name of the state you want to go to: "HelmetON" or "HelmetOFF")
  11. If you wanna go more advanced, you could also create an animation for taking the helmet on and off, like grabing the helmet and with one of both hands and actually putting it on the head. You would need two ParentHoldLink plugins on the Helmet, one for the head link one for the hand link. You would turn on/off the plugins instead the entire helmet atom. Otherwise its just a thing of doing the switch with the right timing with the animation. Naturally I would recommend IdlePoser for the animation, but it could also be an AnimPattern or Timeline. The StateMachine would need additional states for the animation of course, e.g. with "Wait for TriggerSync" set, so the state waits for the animation to trigger "TriggerSync" on the StateMachine.
 
Hi MacGruber,
It works great.
I begin to understand how its works now.
Thanks very much !

oops, just tried to trig (10) with HelmetON doesn't work. It works on SwitchState "HelmetOFF". Switching state inside the plugin works.
 
Last edited:
oops, just tried to trig (10) with HelmetON doesn't work. It works on SwitchState "HelmetOFF". Switching state inside the plugin works.
Maybe a typo in the state name? The name for the SwitchState trigger needs to be exactly the same as you set in the plugin, same upper/lower case and no additional spaces, no quotes or anything like that. (Note that in VaM Desktop mode you can copy&paste these names through the usual text selection and Ctrl+C and Ctrl+V)
 
Sorry Mac, I need your help again.
How Can I toggle between the two states with only a button (when pressed, it switches to state2, and if pressed again, it switches to state1 and so on)
or with a UIToggle (Checked = state1, unchecked = state2) ?

Thanks
 
There are a number of solutions:
  1. Have two buttons where only one is active/visible. The states would switch the buttons on/off.
  2. In the StateMachine, setup transitions between your two states. Enable "Wait for TriggerSync" and set the duration to zero for both states. Then have your button trigger the "TriggerSync" on the StateMachine. (You can also set a short duration for the states, if you want prevent the user from switching to quickly.)
  3. For the future I have planned a "SelectChoice" brick, it would work similar to the RandomChoice brick, except that you actively set which choice to select. That way you can change what the trigger signal from the button does. Have not needed it myself yet, but there where several questions where people could have used this, so I might add it eventually.
 
Thanks again for this amazing pack of plugins. I use state machine in almost every scene. I also really like the random sound from AB plugin. Question: I notice that there is a way to add an asset bundle. This would seem to suggest that one can make audio playlist assetbundles in Unity. I that true? That would seem like a great way t quickly load music playlists which would be a big deal for me. Thanks for any info.
 
@MacGruber Answering my own question. I loaded up Unity and gave creating an assetbundle with a list of MP3 files and it worked like a charm. I then loaded up a audio sorce with random AB and audio queue empty. Holy shit man that is amazing. It loaded 10X faster than via scene audio. Till now I had been using Audiomate to manage my playlist and your plugins to trigger songs but with CUA playlist all I need are a few presets! Thanks so much for this suite again, I really don't think VAM creators quite realize how powerful logic bricks is. And I am definitely not supporting your patreon enough at $1 a month. Fast audio loading with a random shuffle trigger is a really big deal for me. Thanks again.
 
MacGruber updated LogicBricks with a new update entry:

Version 7

There is now a new more elaborate separate demo scene named CyberNight that shows how to build branching multiple-choice dialogs. Please excuse the poor dialog, I'm a coder, not a Hollywood writer. Anyway, you got a couple of branches (see diagram) that kind of make sense and in the end lead to "happy action"...which is a slightly improved version of the Life demo scene...

Read the rest of this update entry...
 
Hey, thanks for this amazing tool.

I wonder if you could implement a "trigger chance" for random sounds plugin? There are 2 other plugins similiar to your random sound plugin but they cause problems during packaging & playing on other VaMs due to a problem with how they handle the file locations.

So far, your sound plugin is the only one that doesn't create any problems with sound files so with the addition of trigger chances it would make it a perfect tool :D
 
@Androinz The concept I'm trying to follow with LogicBricks is that you combine multiple bricks to achieve want you want rather than one complex overkill brick that has UI so complex nobody is able to use it. Only the StateMachine is an exception of that rule, as you would need way too many bricks otherwise. Anyway, in this case you can just use a RandomChoice brick? It would have two choices, one that triggers the RandomSound and another that does nothing. Tweak the "Relative Probability" sliders to tweak the chance.
 
I understand. I just thought that it would be more practical to have a slider on sound plugin that is optional and ideal for also standalone usage.


I asked for this because other random sound plugins have issues, as I said. So the random sound plugin you got here would make a nice standalone tool :)
 
StateMachine:
Concept of multiple transition sets. By default a state waits for its timer to run out and it would select a random transition, this is now called the "Default Timeout" choice. In addition there are now choices A,B,C,D,E and F which each got their own transition sets. The State will for example select randomly among the A transition set, if it receives a SetChoiceA trigger signal. There is also a SetChoiceA_and_Wait variant, which still lets the state duration run out before switching. Obviously this is what makes branching scenes with multiple-choice dialogs possible, the input could come from buttons, but also collision triggers or whatever you can think of.

StateMachine:
Added Duplicate button to clone a state including all data, transitions and triggers.

Especially those 2 things I was missing the last couple of days. Already considered to ask you about. Great that you implemented that. The Statemachine Changes give me now a solution for a problem I was thinking and trying to resolve recently.
The duplicate featrure will save alot of time.

Thank you so much!
 
MacGruber updated LogicBricks with a new update entry:

Version 8

Just a quick maintenance release.

Changelog
  • StateMachine: Fixed SetStateDisabled trigger not resetting.
  • EventSceneLoad: Added options to trigger only for VR/Desktop mode. Allows you to do different things depending on whether you are in VR or Desktop.
Known Issues
  • EventSceneLoad: When have not yet given LogicBricks permission to run when loading a scene, the plugin will not trigger...

Read the rest of this update entry...
 
MacGruber updated LogicBricks with a new update entry:

Version 9

Another maintenance release.

Changelog
  • StateMachine: Added UI toggle "Show Advanced Options". This hopefully makes this very versatile plugin less intimidating to use, if the more complex options are hidden by default. First I considered releasing a "SimpleMachine" variant of this brick, but a toggle takes less long-term maintenance effort and also you can switch easily at any time. The label turns red if you have some advanced options not at their default but...

Read the rest of this update entry...
 
MacGruber updated LogicBricks with a new update entry:

VaM Triggers and LogicBricks video tutorials

As said in my Monthly Report, I started producing video tutorials. The first 3 cover a bit of LogicBricks as well as a more generic introduction to VaM's trigger system, which is kind of a requirement to understand LogicBricks. Find them here:

Read the rest of this update entry...
 
Hello Sir,
i would like to ask, if its possible to make the timer bricks go for at least 30seconds? I'm using your plugins in every scene but i have to do a timer by using timeline plugin cause i can only go for 10seconds. But yours would be faster to setup.
 
@Mopze All sliders in LogicBricks where it makes sense should have range buttons enabled. These buttons expand or reduce the value range by a factor of 10. You can have any range you want:
1626538575391.png
 
Hi MacGruber, i have another question about logic bricks. Is there a way to reset the timer brick? I'am a PLC programmer and i've got timers with reset input. The only way i found was to enable/disable the brick but the elapsed time won't go to zero. So my Timings are getting out of order sometimes =(.
 

Similar threads

Back
Top Bottom