Scriptig question on alcoves.
Posted: Wed Jan 23, 2013 7:06 am
I did my first attempt at scripting (not a programmer here, other than basic about 20 years ago, so it's very simple)
I used the scroll alcove script from the modding tutorial to put a scroll in an alcove.
local message = spawn("scroll")
message:setScrollText("The healing properties\nof the\ntarbead plant")
ScienceAlcove1:addItem(message)
Then I made a single cell room with a note explaining how to make health potions and a deactivated teleporter.
Then I connected the alcove to turn on the teleporter when the player picks up the scroll and it puts the note on the floor in front of the player,
and here comes my script
function dropnote()
hudPrint("as you cafefully open the scroll, a note drops to the floor in front of you.")
end
(thanks to Komags video tutorial)
So I have a few (3) questions hopefully someone can answer in a simple fashion. (at this point I should explain I am making a library in my dungeon with a bunch of scroll alcoves)
1. Can the dropnote script be joined with the scroll alcove script,
2. I'm starting to gain an understanding of the alcove script, first line creates the scroll, second tells it what to put on it, and the last line where it goes. What confuses me is why they all say message, instead of message1, message2 etc.
3. I'm using a separate script entity for each alcove (30+), so my map is really cluttered. I was thinking it could probably populate the alcoves with one script entity using a loop, maybe I'm wrong. Something like,
function FillAlcoves()
for n=1 to NumberofAlcoves
local message = spawn("scroll")
message:setScrollText(here I would need some kind of file or array I think)
LibraryAlcove(n):addItem(message)
next n
end
is that something doable?
Thanks
I used the scroll alcove script from the modding tutorial to put a scroll in an alcove.
local message = spawn("scroll")
message:setScrollText("The healing properties\nof the\ntarbead plant")
ScienceAlcove1:addItem(message)
Then I made a single cell room with a note explaining how to make health potions and a deactivated teleporter.
Then I connected the alcove to turn on the teleporter when the player picks up the scroll and it puts the note on the floor in front of the player,
and here comes my script
function dropnote()
hudPrint("as you cafefully open the scroll, a note drops to the floor in front of you.")
end
(thanks to Komags video tutorial)
So I have a few (3) questions hopefully someone can answer in a simple fashion. (at this point I should explain I am making a library in my dungeon with a bunch of scroll alcoves)
1. Can the dropnote script be joined with the scroll alcove script,
2. I'm starting to gain an understanding of the alcove script, first line creates the scroll, second tells it what to put on it, and the last line where it goes. What confuses me is why they all say message, instead of message1, message2 etc.
3. I'm using a separate script entity for each alcove (30+), so my map is really cluttered. I was thinking it could probably populate the alcoves with one script entity using a loop, maybe I'm wrong. Something like,
function FillAlcoves()
for n=1 to NumberofAlcoves
local message = spawn("scroll")
message:setScrollText(here I would need some kind of file or array I think)
LibraryAlcove(n):addItem(message)
next n
end
is that something doable?
Thanks