Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
I planned to use 2 identical subjects (2 skulls).
Tried to substitute in your script
skull_placed = false
skull_placed = false
function checkAltar(altar, item)
if altar.go == altar_3 and skull.go == skull then
skull_placed = true
else
if altar.go == altar_4 and skull.go == skull then
skull_placed = true
end
end
if skull_placed == true and skull_placed == true then
castle_secret_door_1.door:open()
end
end
- I have a bug. What did I do wrong?
Tried to substitute in your script
skull_placed = false
skull_placed = false
function checkAltar(altar, item)
if altar.go == altar_3 and skull.go == skull then
skull_placed = true
else
if altar.go == altar_4 and skull.go == skull then
skull_placed = true
end
end
if skull_placed == true and skull_placed == true then
castle_secret_door_1.door:open()
end
end
- I have a bug. What did I do wrong?
Re: Ask a simple question, get a simple answer
It only needs updated to use your specific object ids. I'd say re-copy/paste the original script, then alter only those to match the ones you will use.
Example (excerpts):
if altar.go == altar_3 and item.go == skull_1 then
if altar.go == altar_4 and item.go == skull_2 then
if item1_placed == true and item2_placed == true then
castle_secret_door_1.door:open()
Example (excerpts):
if altar.go == altar_3 and item.go == skull_1 then
if altar.go == altar_4 and item.go == skull_2 then
if item1_placed == true and item2_placed == true then
castle_secret_door_1.door:open()
SpoilerShow
Technically (but not required)...
item1_placed == true and item2_placed == true
...could be replaced with:
item1_placed and item2_placed
( But that's just needlessly showing off.
)
It never occurred to me to just compare the table names instead of the ids; which is pretty neat, and seems to work across save & reloads.
@Torquemada
It is most certainly adding extra bloat... but I find that it can sometimes make mystery-black-box scripts a lot easier for the unsure to customize, by defining what they need to edit as simple strings when possible, (and best near the top?). Using those string variables in the script; eliminating the need for them to edit function blocks.
item1_placed == true and item2_placed == true
...could be replaced with:
item1_placed and item2_placed
( But that's just needlessly showing off.

It never occurred to me to just compare the table names instead of the ids; which is pretty neat, and seems to work across save & reloads.
@Torquemada
It is most certainly adding extra bloat... but I find that it can sometimes make mystery-black-box scripts a lot easier for the unsure to customize, by defining what they need to edit as simple strings when possible, (and best near the top?). Using those string variables in the script; eliminating the need for them to edit function blocks.
-
- Posts: 25
- Joined: Fri Apr 05, 2013 10:52 pm
Re: Ask a simple question, get a simple answer
I agree, but I tried to make the script as simple as possible, magic numbers and in this case magic strings are never a pretty thingIsaac wrote:It only needs updated to use your specific object ids. I'd say re-copy/paste the original script, then alter only those to match the ones you will use.
Example (excerpts):
if altar.go == altar_3 and item.go == skull_1 then
if altar.go == altar_4 and item.go == skull_2 then
if item1_placed == true and item2_placed == true then
castle_secret_door_1.door:open()
SpoilerShowTechnically (but not required)...
item1_placed == true and item2_placed == true
...could be replaced with:
item1_placed and item2_placed
( But that's just needlessly showing off.)
It never occurred to me to just compare the table names instead of the ids; which is pretty neat, and seems to work across save & reloads.
@Torquemada
It is most certainly adding extra bloat... but I find that it can sometimes make mystery-black-box scripts a lot easier for the unsure to customize, by defining what they need to edit as simple strings when possible, (and best near the top?). Using those string variables in the script; eliminating the need for them to edit function blocks.

-
- Posts: 25
- Joined: Fri Apr 05, 2013 10:52 pm
Re: Ask a simple question, get a simple answer
Try this code, it checks the contents of both altars each time you put new item on either one.Badgert wrote:I planned to use 2 identical subjects (2 skulls).
Tried to substitute in your script
skull_placed = false
skull_placed = false
function checkAltar(altar, item)
if altar.go == altar_3 and skull.go == skull then
skull_placed = true
else
if altar.go == altar_4 and skull.go == skull then
skull_placed = true
end
end
if skull_placed == true and skull_placed == true then
castle_secret_door_1.door:open()
end
end
- I have a bug. What did I do wrong?
Link the onInsertItem to checkAltars function, you only need to edit the id names in checkAltars function
Code: Select all
function hasSkull(altar)
for i,item in altar.surface:contents() do
print(item.go.name)
if item.go.name == "skull" then
return true
end
end
return false
end
function checkAltars()
if hasSkull(altar_1) and hasSkull(altar_2) then
dungeon_secret_door_1.door:open()
end
end
Re: Ask a simple question, get a simple answer
Are these generic (anywhere in the dungeon) skulls?Badgert wrote:I planned to use 2 identical subjects (2 skulls).
Skulls that could come right out of a Minotaur's inventory?
Or are they specific skulls that the player has to find?
Re: Ask a simple question, get a simple answer
Torquemada
Thank you so much! Everything works fine!
Isaac
I plan to use 2 fancy_skull from the zim_assets.
Thank you so much! Everything works fine!
Isaac
I plan to use 2 fancy_skull from the zim_assets.
Re: Ask a simple question, get a simple answer
Hi guys! 
Tell me please how to change the color of lighting, which "turns on" when you select the "Light" spell. Is it possible to choose a color with the help of the RGB palette?

Tell me please how to change the color of lighting, which "turns on" when you select the "Light" spell. Is it possible to choose a color with the help of the RGB palette?
Legend of Grimrock 1.3.7
Legend of Grimrock II 2.3.3
Legend of Grimrock II 2.3.3
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
If you know the name of the light spell LightComponent, then its easily modifiable like any other light source.Nathaniel wrote:Hi guys!
Tell me please how to change the color of lighting, which "turns on" when you select the "Light" spell. Is it possible to choose a color with the help of the RGB palette?
But if you want more control over what happens within the component (onUpdate) then you'll have to add a new LightComponent to the party object, and replace vanilla light spell with your own, which would interact with it (fadeIn/colors/fadeOut).
Re: Ask a simple question, get a simple answer
Is there a way to alter game sounds dynamically during play? Meaning the sounds the game uses during regular play... not object or user assigned sound components. For instance, if I wanted to change the sound the game will use for player damage—or falling, or menu-ticks, etc... and then change it back to the default. How can these sounds be accessed by script during the game?
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Didn't meddle in GUI much, but wouldn't no click sound, and have the sound be played through whatever it triggers work?