My solution for this was to essentially disconnect all the macros and return the default value. For what it’s worth, this pretty much just disables vibration and color options at runtime.
I’m not sure if we’ll be using 4.11, so I’m probably going to end up creating a Function with the same inputs and logic as the macros and replacing them in the blueprints, as a Wildcard Array Input is only unsupported in a macro.
Sort of. I’m not quite following you, though. When you say “this getter,” what do you mean? Am I changing the txtText variable, or creating a new one? I’m willing to wait for the update too, if you think it will solve everything.
Hi there, I just bought this dialogue system and so far it’s been working as intended.
I’ve run into a simple problem. I can’t get the conditions in the branches to work. I’ve read the previous post about putting in “variableName==true” in the condition box but it seems to automatically set the “variableName” to true rather than check for it even if I’ve set it to false in the script handler.
Basically, I have a part where you speak to an NPC, choosing dialogue option A will set a boolean to true, while B will set it to false. Then the next time you speak to the NPC, dialogue option C will be visible if the boolean is true, otherwise option C is hidden.
Where am I supposed to put the variables? At the moment they are non-local variables in my Dialogue component. Am I not accessing it right? Or do I need to put the variables somewhere else?
EDIT: PLEASE DISREGARD IMAGE, IT WAS FOR A PREVIOUS ISSUE THAT IS NOW SOLVED.
I’d really appreciate if someone could explain where to declare variables like VisitCount. I’m trying to set up a similar system to this but I can’t get my Condition to see any variable I make in the blueprints. Is there a special place to make them or a special way to call them?
Hi Loose_Moose, sorry for the delay (the forums decided I didn’t need an email update on this…)
Hmm, my test cases are passing this scenario. I imagine the quotes aren’t in the actual script? (just checking)
The script assumes that everything that is not 0 or false to be true, and if a variable isn’t set to be a string literal (which is always true), if that helps at all?
There is no way to read blueprint variables from the script, the ScriptInterpreter stores it’s own variables to be used in the script. You can use your inherited dialogue component’s GetScriptInterpreter function and using it’s SetVariable function to add/edit variables from blueprint, or in the dialogue tables use the assignment operator “=” to do the same (eg. MyVariable = “Hello World”;).
In the upcoming update there will also be a way to delete the variables or test them to see if they exist.
As for the new line, I’m sorry to say it’s not currently directly possible. My thought was to parse the text for a [/br] tag and replace it with an empty text element with the length of the remaining line, but this is surprisingly tricky
Thinking on this a bit more, it could be much simpler if I dynamically add multiple wrap boxes (with at least one item to force the height). I’ll be looking into this soon, I’d really like to have this option. [Note though that I think this would be a slight breaking change, for custom UI_Dialogue setups]
Looked into this tonight, I added [br] tags for new line, which create basic user widget containing the wrap box (a user widget because I don’t think you can create wrap boxes dynamically).
This should be in the next update. I’m just waiting for 4.11 to test and release on
Unfortunately, this requires a C++ function, so Blueprint only projects can not use it. If anyone knows of a way to do this without C++, please let me know!
Feel kinda silly for asking but I’m running against a wall right now. Recently started using the system and it’s working beautifully except for the Conditions between conversations.
My intent is to have a conversation start with the first entry on the table. Then, provided the player accepts a Quest, I set a variable to true. The first line is only displayed if that variable is false. If the variable is set to true, I’d like the NPC to start with a different line. Is that possible? If yes, I am not finding the correct way to do it. I set the variable to true during the last lines of the conversation when accepting the quest.
Yep, that’s how conditions are supposed to work. One gotcha though is that if the variable isn’t set before the condition runs, the script will assume it is a string (and a string is not 0 or “false”, making it evaluate to true), this might be what you’re encountering.
In the ***new ***version I’ve submitted to epic (I’ll have update notes soon), there’s a new intrinsic function called “IsValid” to test if a variable exists, so you could put in your condition: IsValid(my@variable) && my@variable == false
Keep me posted if this worked or not
PS: Sorry for the delay in responding btw, this thread doesn’t update me anymore for some reason!
New Update Available:
This version supports UE4 4.9, 4.10, and 4.11
v1.3 Changelog:
General Changes:
Improved extendibility for UI Dialogue text and response items, as well as inline images
Speaker names will now process variables (BBCode-like option tags are not supported)
Added OnAllTextDisplayed events (UI and BPC)
New Features:
Added function SetActive(true/False). This function will enable or disable the dialogue it is executed on
Added script functions SetBranch to set the current state, and SetInitialBranch to update the next branch to use on next interaction.
Added passive dialogue mode. Passive dialogues do not capture input and automatically flow to the next valid branch after a configurable delay.
SetBranch now supports cross component branching
ExecuteScript calls can now be nested. This is especially helpful if a custom script function executes a new set of scripts on external ResponseHandlers (usually BPC_Dialogues).
Script function to control passive dialogues added - SetPassive(bool enabled, [optional]number Delay)
Added Scriptable “Use Condition” functions to help control when a dialogue should be usable: SetUseCondition(Key, ConditionScript), GetUseCondition(Key), RemoveUseCondition(Key), ClearUseConditions().
[INDENT]Note: ConditionString should be wrapped in quotation marks to be dynamic (eg. SetUseCondition(“MyDynamicCon”, “x == 42”)). Otherwise, it will evaluate to true or false before storage (eg. SetUseCondition(“MyStaticCon”, x == 42) will result in SetUseCondition(“MyStaticCon”, “true”))
Added dialogue skipping. This will skip all following dialogue until a user response is expected or the dialogue is exited. To use, call SetSkipDialogue(true) in BPC_Dialogue. Note: Pre and Post actions are still executed
Added intrinsic functions IsValid and Delete.
IsValid(var) will test to see if a variable exists and is not empty (note: spaces are not considered empty)
Calling Delete(var) on a variable will destroy the variable (eg. IsValid(x) == true; Delete(x); IsValid(x); == false). (note: if a namespace is emptied, it will also be deleted). It can become important to delete variables if variables are used extensively: because of the linear nature of arrays, it can be costly to find or add when there are a large number of variables, reducing the number of unused variables can help this.
Added [br] line-break option to skip to a new line. IMPORTANT: BREAKING CHANGE: This is a breaking change. Inheriting UI’s must expose a vertical box to the GetTextAreaVerticalBox function and replace the wrap box with a vertical box in the designer.
Fixes:
Fixed Cooking Build Error with BPI_DialogueAwareNodes
Fixed script interpreter not returning the result of a custom function
Set Keyboard Focus call moved to Input event management. It will no longer be called if control scheme is unmanaged.
Fixed ternary operator scenario with nested functions that confused the operands (Details: “a = pow(2, 1 < 3 ? pow(2,2) : pow(3,3))” would falsely count the function arity as 3 instead of 2. This was caused by the ? operator being listed as a unary operator)
Documentation:
Added information about using line breaks in CSV documents for easier reading (some C++ required)F.A.Q
This is certainly do-able, we have a scenario like this in our game Dwarrows (seen in my sig), which uses the dialogue system. Our character collects tokens of sorts (those little yellow glowy things in the trailer), the system has access to the number of tokens and that number is used as a conditional to choose which dialogue certain characters will use.
The dialogue can access variables from the “ScriptInterpreter” packaged with the system (not blueprint or c++ variables), so to do this you can either update the variable in the interpreter in blueprint: either using the myInterpreter.SetVariable through blueprint, or calling myInterpreter.ExecuteScript(“varName = varName+1”) from blueprint (this is probably more convenient because it has implicit conversions for the math portion), OR have a Custom Function that can be accessed through the script to get the amount.
So I went with the Execute Script variant, and I’ve been trying very hard to get it to work for the past 6 hours, but no luck so far.
I put this in my Item Blueprint, because I couldn’t think of a better place for it:
So when the player collects the item, it adds a variable (or rather, it should) and is then destroyed. The handler is the BPC_Dialogue blueprint as described in the documentation.
But what to do with the Execute Script node? What goes in the Script String field? It’s pure guesswork, nothing makes any sense to me.
And finally what needs to go in the Condition column in the data table?
Neither in the documentation nor the sample scene did I find any useful information on that.
I really hoped this would be easier. After all, it’s one of the most basic things to do in a game.
The script is running code in the dialogue’s script engine, so if you want to increment a variableyou’d say “MyVariable = MyVariable + 1”. In your case, make sure you declare the variable in the script interpreter before this script is run (eg. “itemCount = 0”) and when you overlap, “itemCount = itemCount + 1”.
I gave it another try, but the NPC just says whatever comes first in the data table and disregards all I’ve done. (I left the “initial branch” setting at “auto_select” in the bpc_dialogue component inside the NPC. I hope that’s not wrong.)
The overlap event in the item’s event graph:
And another thing: What would I write inside the Execute Script node if I wanted to set a variable to true or false instead of adding numbers? I couldn’t find an answer in the documentation. The Execute Script node is never mentioned anywhere. I had no idea it existed until today.
auto_select will use the first valid dialogue entry, so that’s fine.
What you did should work, so far as I can think. You can try outputing the resolved string of execute script to see what it turns out (or use GetVariable and print out the value), to make sure it’s properly set before the dialogue comes in.
Something else to try, I usually have a blank ‘hub’ entry in my data tables that have the possible branches in the ‘Branches’ column and has the ‘silent’ trait. (eg. row 0 would have blank text, ‘KeyFound’ in the branches column, and 'silent trait) - I can’t test right now, but I’m wondering if there’s maybe an issue with conditions running on the initial dialogue.
PS: I don’t recommend changing the base files of the system, in case of updates (a new one is coming soon - waiting Epic’s approval).