Page 205 of 400
Re: Ask a simple question, get a simple answer
Posted: Tue Jul 04, 2017 11:15 pm
by Badgert
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?
Re: Ask a simple question, get a simple answer
Posted: Wed Jul 05, 2017 12:06 am
by Isaac
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()
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.
Re: Ask a simple question, get a simple answer
Posted: Wed Jul 05, 2017 1:58 am
by Torquemada
Isaac 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()
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.
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 thing

Re: Ask a simple question, get a simple answer
Posted: Wed Jul 05, 2017 2:29 am
by Torquemada
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?
Try this code, it checks the contents of both altars each time you put new item on either one.
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
Posted: Wed Jul 05, 2017 3:21 am
by Isaac
Badgert wrote:I planned to use 2 identical subjects (2 skulls).
Are these generic (anywhere in the dungeon) 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
Posted: Wed Jul 05, 2017 6:59 am
by Badgert
Torquemada
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
Posted: Thu Jul 27, 2017 9:59 pm
by Nathaniel
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?
Re: Ask a simple question, get a simple answer
Posted: Sat Jul 29, 2017 9:47 am
by zimberzimber
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?
If you know the name of the light spell LightComponent, then its easily modifiable like any other light source.
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
Posted: Mon Jul 31, 2017 6:52 am
by Isaac
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?
Re: Ask a simple question, get a simple answer
Posted: Mon Jul 31, 2017 9:09 am
by zimberzimber
Didn't meddle in GUI much, but wouldn't no click sound, and have the sound be played through whatever it triggers work?