Scripts / Hint scroll script help

Author
Message
Skyye13
User Banned
Posted: 12th Feb 2016 19:30
Hey guys,
I attempted to modify smallg's read note script to give it a fantasy theme, and make it easier to use. For example, I added info about making different folders for each note you want the player to read, so the script doesn't just activate the same note every time you read a different note.

The script is supposed to enable a player to read a note by approaching it and pressing "e". This then causes an image to appear on the screen, the image being the note you want the player to read, in PNG format, in the folder specified in the script.

So I modified the script, so it looks like this:

[_code]
--smallg & Ghetto Kitty
--script to read a hint scroll found in game
--image must be in folder "scriptbank\images\hint1" & named "000.png" / "001.png" / "002.png" etc
--Create new folders for each set of hints like so: "scriptbank\images\hint2", "scriptbank\images\hint2" etc
--Must replace all instances of "hint1" in script with the name of the folder of the image you want for each hint.

--how far away from note it can be read
local use_range = 120
--key press to read note
local use_key = "e"
--maximum notes to display (use key will cycle through)
local max_page = 1


local pressed = 0
local reading = {}

function hint1_init(e)
LoadImages("hint1",0)
reading[e] = 0
end


function hint1_main(e)
if GetPlayerDistance(e) <= use_range then
if reading[e] == 0 then
PromptLocal(e,"Read scroll? *" ..use_key.."*")
if GetInKey() == use_key and pressed == 0 then
Hide(e)
pressed = 1
reading[e] = 1
LoadImages("hint1",0)
SetImageAlignment(0)
SetImagePosition(50,50)
ShowImage(0)
end
elseif reading[e] >= 1 then
if GetInKey() == use_key and pressed == 0 then
pressed = 1
HideImage(reading[e] - 1)
reading[e] = reading[e] + 1
if reading[e] > max_page then
reading[e] = 0
Show(e)
else
ShowImage(reading[e] - 1)
end
end
end

else
if reading[e] > 0 then
HideImage(reading[e] - 1)
reading[e] = 0
Show(e)
end
end
if pressed == 1 and GetInKey() == "" then
pressed = 0
end


end

function hint1_exit(e)

end
[_/code]

Unfortunately, I tested it, and it doesn't work. I put a note entity onto the map, gave it this script, and tested it, and nothing came up when I approached the note.

I made sure to create a "hint1" folder in "scriptbank\images" and placed my png file (named 000.png) in the folder. I don't know if it matters, but the PNG file has transparency via an alpha channel.

Why isn't the script working? Is there something I missed?

Thanks, and thanks very much smallg for creating the script!
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Feb 2016 22:01
here's a new 1 that should work for you
https://forum.game-guru.com/thread/207801?page=12#msg2541219
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Skyye13
User Banned
Posted: 12th Feb 2016 22:31
Wow thanks smallg! X3 *hugs you*

your new script is awesome, it made the whole process so much easier, and it works! I've been having such a rough day getting any of my scripts to work, finally I have something I can actually use in the final game <3

Thanks again for your help!

Login to post a reply

Server time is: 2024-05-03 15:06:32
Your offset time is: 2024-05-03 15:06:32