Scripts / FREE : LUA script to display an image and a sound during a given time !

Author
Message
Devcore35
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 27th Feb 2015 16:52 Edited at: 27th Feb 2015 16:55
Hello,

WARNING: I am French: I translated this tutorial Google translation; sorry if this tutorial has some translation errors.

I have a script designed to display an image and a sound (eg someone who reads a text) over a period of X seconds (depends on the sounds).
I helped myself script door.lua.
However, not being an expert in this LUA he can half the script is useless =P
So if you want to improve you are welcome ^^

How it work?

1 - Copy the code below and paste it into a text file with name "book.lua" :


CAUTION: Do not put in your code "< br >" tags !!!


Consider changing the following line :

It determines the time the Timer (example: 8000 = 8 seconds 50000 = 50 seconds, etc.)

2 - In "GameGuru\Files\scriptbank\images\" create a new folder called "book". Design your image (such as an open book) and save it in "GameGuru\Files\scriptbank\images\book\" and name it "000.png"
The image should not exceed 1024X768.

3 - Record yourself reading your text on the image and save your sounds under "GameGuru\FIles\AudioBank\music\" and name your file, for example "book_read.wav."

4 - In GameGuru: place a 3D object (book or other) and turn it into Dynamics. Associate the script "book.lua" and sounds "book_read.wav."

5 - In the game when you press the "E" key on your keyboard the 000.png image will be displayed along with the sounds associated with the object. During this time the player has more control over the game (it's Freeze). When the Timer happen by itself the number in the script "book.lua" then the image will remove and the player will again shake (UnFreeze). Then the message that the book has been read will be displayed.

I hope that you enjoy it and share feel free to improve it because there's work ... x'D

Good development at all!
PM
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 27th Feb 2015 21:57
Very nice script. Thanks
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
snowdog
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: London
Posted: 28th Feb 2015 02:42
Nice! That's clever, I'll be certain to use this. Many thanks!
"This you have to understand. There's only one way to hurt a man who's lost everything. Give him back something broken."



Thomas Covenant, Unbeliever
PM
unfamillia
Forum Support
13
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 28th Feb 2015 11:19
Just moved this to scripts.

Very generous of you. Thank you.

Cheers

Jay.




Devcore35
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 1st Mar 2015 13:44
Hello!
It is with pleasure
If I can be of service to certain I would I'm a partisant the free sharing for projects.

For those who have trouble I caused you squarely a video demonstration and explanation, and I put an attachment LUA script "livre1.lua."
Turn the sound in the video during testing to understand the functioning of the script.

VIDEO TUTORIEL SCRIPT BOOK for GameGuru :

[video=youtube]http://youtu.be/NjIp_VyyAwY[/video]

Feel free to improve it ^^

Good development at all!

Attachments

Login to view attachments
PM
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 1st Mar 2015 16:15
nice script. many thanks..

Is it possible to add something like " would you read it again"..

Thanks

Harry
PM
Devcore35
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 2nd Mar 2015 11:23
Hello,

Unfortunately I did not succeed; I am a void can LUA.

By cons I have another idea to offer: rework the script to use it to make short appearances to scare the player.

For example it enters a tunnel during 500ms (0.5 seconds) you made appear a shade (image below) with cries of his may be a few nice things to do ^^

By cons must remove the message "Press E" to put the script in a StoryZone for example.
PM
unfamillia
Forum Support
13
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 4th Mar 2015 10:57
Devcore,

If you want to embed YouTube videos in your post, simply remove the beginning of the link.

Yours looks like this:

[video=youtube]http://youtu.be/NjIp_VyyAwY[/video]

If you remove the highlighted section, you will have this:



Cheers

Jay.




Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 1st Apr 2015 18:37
how does this work with multiple books, if i put 2 books down it only displays 000.png, i thought it would increment to the next 001.png etc

thanks
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Apr 2015 19:02
no it only displays that 1 image, you would need to duplicate the script under a new name and change the path to the image of the second book
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 1st Apr 2015 19:04 Edited at: 1st Apr 2015 19:05
I have just edited the book.lua, to increment from 000.png to 999.png by adding a variable

so ShowImage(0) becomes ShowImage(booknum)

booknum is set to 0 at start of script,

if level 1 of your game uses images 0 to 12 and level 2 would start from image 13, just make a copy of the new book.lua for level 2 called book2.lua change the init and main part to book2, and make the start variable booknum = 13, so this will load the next images in sequence.

Attachments

Login to view attachments
Devcore35
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 2nd Apr 2015 09:45
Thank you very much for your help and have improved the script: D!
PM
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 2nd Apr 2015 10:47 Edited at: 2nd Apr 2015 10:55
It's ok but my add-ons dont take into account the order you find them, so it steps through the books, but depennding on where the player finds the books.

if you put 2 books down in a test map, and pick them up in a different order while testing twice, you will see what I mean. Good for random pages scattered around the level etc.

example:

your script I would use for books 0 to 250 for very specific location based books

and the modified script I would use for 251 to 500 for general story setting books, by setting the start booknum = 251

the numbers are only examples, they could be any number.

that was my 1st edit on lua.....

Check out here, I'll use it in my 1st full project which I'm working on now, I'll give a credit to when it's done.



I'm going to add some book pages around the level to give some atmos, hopefully will upload a new vid soon too

I am still using your original script for more location based pages and books though, great work, thanks devcore
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 3rd Apr 2015 07:18
is there anyway to eliminate the timer and replace with a "press R to exit reading" and close the image when R key is pressed???? or any other key, doesn't have to be R

thanks
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 4th Apr 2015 17:56
Hi Devcore35,

If you permit, I will use your image display system to create messages (in bmp format) that will give more "adventure game style" than the text displayed on the screen (see example image below)

I'll post the script once it's complete...


Attachments

Login to view attachments
PM
Getlucky
9
Years of Service
User Offline
Joined: 9th Apr 2015
Location:
Posted: 9th Apr 2015 21:45
I'm Getting Crazy. I tried to add more images, changing script, changing folder (000.png each folder) but anything work. I didnt understand how to create and use the variable for more pictures.
PM

Login to post a reply

Server time is: 2024-05-23 23:03:31
Your offset time is: 2024-05-23 23:03:31