Presentation and request for help

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
conan71
Posts: 5
Joined: Wed Jun 18, 2014 7:15 pm
Location: Italy

Presentation and request for help

Post by conan71 »

Hello everyone, I introduce myself, my name is Lucio, I'm 43 years old and I am a fan of fantasy role-playing old style (like Eye of the Beholder or Dungeon Master for instance).
This is my first post even though I surf regularly within this forum.
I played Legend of Grimrock and finished some time ago, and now I was thinking to try my hand at creating my own mod.
The project I've already started and is progressing well, the only thing that I can not solve is this: I need to insert some pauses between a series of texts that scroll across the screen to sync with spoken sequences, but I can not using LUA find any useful command for this purpose.
I came across a site where we talk about an extension for LUA called LUUP, which has numerous functions, including a helpful I think in my case that is called SLEEP.
The problem is how do I implement this extension in the Grimrock editor to use that or other functions?
I hope I explained, I'm sorry but I'm Italian and my English is not quite perfect :D
Thank you and see you soon. :)

conan71
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Presentation and request for help

Post by msyblade »

Try splitting the hudPrints into different scripts, each with seperate timers activating them. In this sense, the external timers you use to trip each script will be the "sleep" function.
ie:

player steps on a plate.
That triggers the first set of hudPrints (in a script fuction), AND a timer set to 10 seconds.
That timer will:
ACTIVATE a second script function with the hudPrints you want 10 seconds after the first.
DEACTIVATE itself, so as not to loop infinitely.
And Activate ANOTHER timer set to 15 seconds.

Now this 2nd timer performs:
ACTIVATE a 3rd script funtion, with the hudPrints you want 15 seconds after the 2nd set.
DEACTIVATE itself to kill the loop
And possibly, open a door, close a pit, point to a 3rd timer, whatever you want to do, really.

Hope this helps simplify the process rather than complicate it further!
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Presentation and request for help

Post by Isaac »

This is essentially MsyBlade's suggestion, but done in code, such that it's all configurable in one script, with no timers on the editor map.

*To use it, place the code in a script object, call the longSpeech() function, and it will present a default conversation. This is customizable up to nine statements without modification.
(Of course, you can just make another copy of the script to support an additional nine statements.)

**Updated with later changes.

Code: Select all

--[[ This script supports up to nine statement entries, with pauses between them. 
	Add or remove the entries as needed. Set the pauses to what seems natural; each
	pause is the number of seconds to wait, before printing the next statement.		

--]]
	
	statement = {
				"This is the first statement.",
				"And this is the second, after a brief pause.",
				"[clears throat]",
				"and in closing, this is the final statement."
				}
							
	pauses = {0,5,7,2}  --Pause #1 should always be zero.














	
	function statementPrint(caller) screenClear() hudPrint(tostring(statement[tonumber(string.sub(caller.id,-1))])) caller:destroy() end

	function delayEval(x)
			local temp = pauses[1]
			if x ~= nil then
				 for y = 1, x do
					 temp = temp + pauses[y]
				 end
			end
		return temp
	end
							
	function longSpeech()
		for x= 1, #pauses do
			local delay = delayEval(x)
			local name = 'timer_['..getStatistic('play_time').."]_"..x
			spawn('timer', party.level, 1,1,1, name )
			:setTimerInterval(delay)
			:addConnector("activate", self.id, "statementPrint")
			:addConnector("activate", "name", "destroy")
			:activate()
		end
	end
	
	function screenClear() hudPrint("") hudPrint("") hudPrint("") hudPrint("") hudPrint("") end
Last edited by Isaac on Fri Aug 08, 2014 10:29 am, edited 2 times in total.
User avatar
conan71
Posts: 5
Joined: Wed Jun 18, 2014 7:15 pm
Location: Italy

Re: Presentation and request for help

Post by conan71 »

Very well, thank you, I have just a moment of time, I make some attempt with your advice.
Thank you very much.

conan71
User avatar
conan71
Posts: 5
Joined: Wed Jun 18, 2014 7:15 pm
Location: Italy

Re: Presentation and request for help

Post by conan71 »

Hi, I made this script entity and linked it to an hidden pressure plate, that activate the longSpeech function, but nothing happens.
Messages I've inserted under the section statement does not appear on the screen, here the code:

Code: Select all

--[[ This script supports up to nine statement entries, with pauses between them.
       Add or remove the entries as needed. Set the pauses to what seems natural; each
       pause is the number of seconds to wait, before printing the next statement.      

    --]]
       
       statement = {
                "Wery well ...",
                "You are now inside the Fortress of Uttermost,on the second floor of the central building.",
                "I have been there only once in the past, but I think whether it's meeting room.",
                "YOU MUST BE CAREFUL!",
		"I feel a strong flow of negative energy throughout the area, it seems a sort of denial of magic itself ...",
		"If I can discover more, I will try to get in touch with you to warn of potential dangers.",
		"GOOD LUCK!",
		"And remember: Your main goal is to find the Captain Ethius and try to understand what is happening in that area.",
		"Honestly, I think they are evil forces at play in this place and ... I hope the Captain is still alive ..!"
                }
                         
       pauses = {0,3,7,6,4,7,6,6,6}  --Pause #1 should always be zero.

       
       function statementPrint(caller) screenClear() hudPrint(tostring(statement[tonumber(string.sub(caller.id,-1))])) caller:destroy() end

       function delayEval(x)
             local temp = pauses[1]
             if x ~= nil then
                 for y = 1, x do
                    temp = temp + pauses[y]
                 end
             end
          return temp
       end
                         
       function longSpeech()
          for x= 1, #pauses do
             local delay = delayEval(x)
             local name = 'timer_['..getStatistic('play_time').."]_"..x
             spawn('timer', party.level, 1,1,1, name )
             :setTimerInterval(delay)
             :addConnector("activate", "dialog", "statementPrint")
             :addConnector("activate", "name", "destroy")
             :activate()
          end
       end
       
       function screenClear() hudPrint("") hudPrint("") hudPrint("") hudPrint("") hudPrint("") end
Definitely something wrong, but I can not figure out what :roll:

conan71
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Presentation and request for help

Post by Isaac »

The problem is the naming of the script... as typed it had to be "dialog"; name it 'dialog', and it works as intended.

I have changed a line in the script that now auto-updates the timers to link to the script ~whatever name [id] that you give it. So now, you could call it "dialog1" or 'encounter_17', and it should work as intended. Image

Code: Select all

--[[ This script supports up to nine statement entries, with pauses between them.
       Add or remove the entries as needed. Set the pauses to what seems natural; each
       pause is the number of seconds to wait, before printing the next statement.      

    --]]
       
       statement = {
                "Wery well ...",
                "You are now inside the Fortress of Uttermost,on the second floor of the central building.",
                "I have been there only once in the past, but I think whether it's meeting room.",
                "YOU MUST BE CAREFUL!",
		"I feel a strong flow of negative energy throughout the area, it seems a sort of denial of magic itself ...",
		"If I can discover more, I will try to get in touch with you to warn of potential dangers.",
		"GOOD LUCK!",
		"And remember: Your main goal is to find the Captain Ethius and try to understand what is happening in that area.",
		"Honestly, I think they are evil forces at play in this place and ... I hope the Captain is still alive ..!"
                }
                         
       pauses = {0,3,7,6,4,7,6,6,6}  --Pause #1 should always be zero.

       
       function statementPrint(caller) screenClear() hudPrint(tostring(statement[tonumber(string.sub(caller.id,-1))])) caller:destroy() end

       function delayEval(x)
             local temp = pauses[1]
             if x ~= nil then
                 for y = 1, x do
                    temp = temp + pauses[y]
                 end
             end
          return temp
       end
                         
       function longSpeech()
          for x= 1, #pauses do
             local delay = delayEval(x)
             local name = 'timer_['..getStatistic('play_time').."]_"..x
             spawn('timer', party.level, 1,1,1, name )
             :setTimerInterval(delay)
             :addConnector("activate", self.id, "statementPrint")
             :addConnector("activate", "name", "destroy")
             :activate()
          end
       end
       
       function screenClear() hudPrint("") hudPrint("") hudPrint("") hudPrint("") hudPrint("") end
User avatar
conan71
Posts: 5
Joined: Wed Jun 18, 2014 7:15 pm
Location: Italy

Re: Presentation and request for help

Post by conan71 »

Great! Now it works perfectly, thank you very much! :mrgreen:

conan71
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Presentation and request for help

Post by Isaac »

conan71 wrote:Great! Now it works perfectly, thank you very much! :mrgreen:

conan71
viewtopic.php?f=14&t=3099&p=70809#p70809

Further updated script; [not a bug fix].
No need to change what you have already working.
This one calculates the pauses; but they can still be set manually.
User avatar
conan71
Posts: 5
Joined: Wed Jun 18, 2014 7:15 pm
Location: Italy

Re: Presentation and request for help

Post by conan71 »

Ok thanks, Isaac :)
Post Reply