[CUSTOM] dialog system (working/tutorial pending)

  • #40, von afrlmeMittwoch, 28. September 2016, 16:46 Uhr vor 8 Jahren
    The dialog thing I did recently (freelance) was just to take a conversation from some Lua tables we generated & have it iterate through the entire conversation automatically. In this case we used

    tag to force the player to skip texts manually as there's no voice over, each time a text ended we checked the incrementing index value against the conversation table entry total to see if we wanted to display the next text or close the dialog interface & kill the loop.

    Basic principal is some Lua tables for storing texts, animation names & so on. Then you need a couple of functions to init the dialog system, then one to update / quit the dialog system. Finally you need a called by other action block which contains something like...

    if values 'dialog_index' less than or equal to values 'dialog_total'
     execute a script > updateDialog()
     display narration text ' <p>
     pause for 150ms
     jump to action part #1
    end if
    

    Obviously that doesn't show you how I wrote my functions, but it should be enough to get the general idea.

    In regards to text effects, flying in, fading in out. I believe there's supposed to be some built in text transition options in the next version. What exactly!? I've no clue!

    Foren Imperator

    7285 Posts


  • #41, von sebastianMittwoch, 28. September 2016, 17:38 Uhr vor 8 Jahren
    you forgot to increment the dialog_index value in your pseudocode. or does the script do that, too? But a nice approach smile . Would definitely allow Ke4 allow to get his lua table texts in a conversation. the loop is handled by an action instead of lua

    Thread König

    2346 Posts

  • #42, von afrlmeMittwoch, 28. September 2016, 18:15 Uhr vor 8 Jahren
    The update function checks & updates everything. The idea was to reduce the amount of actions required as they were using hundreds of action parts for each visual novel style dialog cutscene. 1 or 2 to show the required character animations, some to hide previously playing animations, then display text & some other stuff. This was per display text & some of the conversations had loads of lines in them.

    I think the called by other action block ended up being about 10 actions total because we had to add a few other things to it, but 10 actions -ish per conversation is better than 100+ action parts. I could have made it more global too, but then it would have required doing something like what you've done, so they can add custom actions, conditions, values, etc to be started or manipulated. But they want it simple as possible for the person that's sorting out the dialog scripts in a third party app, such as Sublime Text.

    Foren Imperator

    7285 Posts

  • #43, von ke4Mittwoch, 28. September 2016, 19:39 Uhr vor 8 Jahren
    Yeah to be honest i don't really need this custom dialogue system. I'm having second thoughts as i'll have voiceovers and this works for texts but i can't assign the soundfiles to a display text action part dynamically.

    But it's fun to code some complex stuff, i don't have other stuff to code at this moment. The animations for the dialogue interface would be cool though. It's the same like having a small "zooming" animation for items when they are being hovered. Small details but it makes the game better.

    It would be really nice if there would be an option to execute the display text action with lua, set the text, sound file & character.

    Tastenjunkie

    810 Posts

  • #44, von afrlmeMittwoch, 28. September 2016, 20:22 Uhr vor 8 Jahren
    Well you could link the sound files inside of the Lua tables. Could potentially add any information you like into them, you just need to come up with some method to take that information & output it.

    Foren Imperator

    7285 Posts

  • #45, von sebastianMittwoch, 05. Oktober 2016, 01:27 Uhr vor 8 Jahren
    my brother created a python script for me which converts .graphml files (flow charts) from yED to my custom dialog tree structure. So now all dialogs can be created in a diagram. I recognized one issue when creating the dialogs via a graph editor: The pointers back to the parent nodes (or wherever back to prior dialog options) are difficult to visualize. To much arrows are involved in big dialog structures... hmmm...

    Thread König

    2346 Posts

  • #46, von afrlmeMittwoch, 05. Oktober 2016, 02:15 Uhr vor 8 Jahren
    Can't help you there mate. yED is quite nice, but it felt a little limited to me so I ended up switching over to mindmaple lite which is similar but has a few more features. I no longer use that much anymore either as I bought articy draft last year, so I only really use mind maple for the odd quick chart if I want to mock one up for some reason or other.

    Anyway, sounds interesting with the python script. I'm not savvy in Python myself - hate snakes too ( razz ) - so again I'm afraid I can't help you with that!

    Is Chat Mapper not a viable option? I'm not sure if it's still free or not. Also I believe it's only available for windows, but if you've got a windows machine laying around or access to VM or Bootcamp, then might be worth looking into.

    By the way, you should be able to create dialogs in something like microsoft excel or the open office equivalent of that. If you create a test document & add a few texts here & there, then export as a csv file (I believe that's the correct format to export texts as), then you should be able to open the exported file in one of the programs I mentioned above & get an idea of how to create texts in that. Should be able to import them back in too - then again I think I'm way of base as you are probably talking about the python script generating the table things you mentioned, yes?

    Foren Imperator

    7285 Posts

  • #47, von sebastianMittwoch, 05. Oktober 2016, 06:27 Uhr vor 8 Jahren
    the python script isnt the problem itself because it just converts the xml data down to all neccessary data and output a new file. bullshit in, bullshit out grin. creating the connections from a node back to the prior level looks ugly in the graph editor because i have to "wire" this node to all the prior entries back which should be displayed. Im not sure how to explaims this correctly here xD.

    Thread König

    2346 Posts

  • #48, von sebastianSonntag, 09. Oktober 2016, 19:20 Uhr vor 8 Jahren
    added conditiontype "item" which checks for items in inventory.
    function check(conditionstring)
    	-- print("Passed String: "..conditionstring)
    	if conditionstring == " " then return true end
    	local value = {}
    	for x in string.gmatch(conditionstring, '([^|]+)') do						--for each given condition
    		-- print("checking for "..x)	
    		if string.starts(x,"!c_") then									--condition is "not true"				
    			x = string.sub(x, 4)
    			if not Conditions[x].ConditionValue then else return false end
    		elseif string.starts(x,"c_") then									--condition is "true"
    			x = string.sub(x, 3)
    			if Conditions[x].ConditionValue then else return false end
    		elseif string.starts(x,"!v_") then								--value Int is "not X"
    			x = string.sub(x, 4)
    			value[1] = nil;value[2] = nil
    			for w in string.gmatch(x,'([^=]+)') do table.insert(value, w); print(w) end
    			if Values[value[1]].Int == tonumber(value[2]) then return false else end
    		elseif string.starts(x,"v_") then									--value Int is "X"
    			x = string.sub(x, 3)
    			value[1] = nil;value[2] = nil
    			for w in string.gmatch(x,'([^=]+)') do table.insert(value, w); print(w) end
    			if Values[value[1]].Int == tonumber(value[2]) then else return false end
    		elseif string.starts(x,"!vs_") then								--value String is "not XXX"
    			x = string.sub(x, 5)
    			value[1] = nil;value[2] = nil
    			for w in string.gmatch(x,'([^=]+)') do table.insert(value, w); print(w) end
    			if Values[value[1]].String == value[2] then return false else end
    		elseif string.starts(x,"vs_") then								--value String is "XXX"
    			x = string.sub(x, 4)
    			value[1] = nil;value[2] = nil
    			for w in string.gmatch(x,'([^=]+)') do table.insert(value, w); print(w) end
    			if Values[value[1]].String == value[2] then else return false end
    		elseif string.starts(x,"i_") then									--item "XXX" is in current characters inventory
    			x = string.sub(x, 3)
    			if ininv(x) then else return false end
    		elseif string.starts(x,"!i_") then									--item "XXX" is not in current characters inventory
    			x = string.sub(x, 4)
    			if not ininv(x) then else return false end
    		end
    	end
    	return true
    end
    
    function ininv(item)
    	local charitems  = game:getLink(VGameCurrentCharacter):getLinks(VCharacterItems)
    	for k,v in pairs(charitems) do 
    		if v:getName() == item then print("TRUE"); return true end
    	end
    	print("FALSE"); return false
    end
    


    Checking for value < or > still missing. Also the function is not cleaned up (redundant stuff)

    Thread König

    2346 Posts

  • #49, von afrlmeSonntag, 09. Oktober 2016, 19:30 Uhr vor 8 Jahren
    Out of interest why are you still using the longhand getObject() method for some of the things? I've noticed you've used a mixture of both long & shorthand. Pretty much everything bar the odd few things should be accessible & editable with shorthand in the current build of VS.

    Foren Imperator

    7285 Posts

  • #50, von sebastianSonntag, 09. Oktober 2016, 19:44 Uhr vor 8 Jahren
    You mean inside the ininv function? Yeah it was frankensteined together from pieces I found in the wiki and own stuff (the for loop).

    Sometimes I can't get the shorthand version to work for some reason and end up to use a mixture of long and short... The wiki itself is not straight when I search up things I need. So it ends up quite funky.

    Thread König

    2346 Posts