Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Thanks a bunch! I tried looking through LOG2DOC but I know zero coding so it's mostly putting together bits and pieces from other people's scripts published on the forum and trying to add my own little widgets to them.
Re: Ask a simple question, get a simple answer
What is the method behind "walk this specific path on the floor" puzzles?
I tried doing it with triggers, a counter and a timer, incrementing the counter on a wrong step and giving a relatively short time to walk the right steps before the timer resets the counter, but this still allows trial and error double-triggering of correct tiles within the counter time. Sadly, I have no idea how to script it.
[Edit] Also, how do I go about filling a room with poison (gas)? I did it with 10 spawners that produce poison_cloud_medium triggered by the same floor tile, but it's a pain to set up in the editor and I suspect the code for the same effect would be 5 lines long, plus I can't have the poison stay on longer and can't kill it on opening the door (to simulate airing the room)![Neutral :|](./images/smilies/icon_neutral.gif)
Lastly, why doesn't editor entity castle_tall_wall_corridor_end do its job? It's supposed to mask ceiling height differences in castle tiles, as in, going from a ceiling-1 to a ceiling-2 room, but it shows up buggy for me, even though I have it set up exactly the way it's in the original game. For me, the original ceiling's vertical bar doesn't go away and it bugs the view, as seen here: https://i.imgur.com/oDxdjL6.jpg --- https://i.imgur.com/X8j7LnK.jpg [/Edit]
I tried doing it with triggers, a counter and a timer, incrementing the counter on a wrong step and giving a relatively short time to walk the right steps before the timer resets the counter, but this still allows trial and error double-triggering of correct tiles within the counter time. Sadly, I have no idea how to script it.
[Edit] Also, how do I go about filling a room with poison (gas)? I did it with 10 spawners that produce poison_cloud_medium triggered by the same floor tile, but it's a pain to set up in the editor and I suspect the code for the same effect would be 5 lines long, plus I can't have the poison stay on longer and can't kill it on opening the door (to simulate airing the room)
![Neutral :|](./images/smilies/icon_neutral.gif)
Lastly, why doesn't editor entity castle_tall_wall_corridor_end do its job? It's supposed to mask ceiling height differences in castle tiles, as in, going from a ceiling-1 to a ceiling-2 room, but it shows up buggy for me, even though I have it set up exactly the way it's in the original game. For me, the original ceiling's vertical bar doesn't go away and it bugs the view, as seen here: https://i.imgur.com/oDxdjL6.jpg --- https://i.imgur.com/X8j7LnK.jpg [/Edit]
Re: Ask a simple question, get a simple answer
Maps have a module height setting in the level properties. Most levels are set to a height of 3, but castle levels are set to 4.
Right-click on your level, in the editor, and choose Properties, and set the module height to 4.
___
Scripting is the way to go with all but the simplest puzzles, and placements.
There is a wealth of scripted resources in the asset packs, and the user forum. It's well worth spending the time to learn to read scripts, to understand how to structurally alter them; and to later devise them. Grimrock uses the Lua scripting language, and there are many tutorials to start learning it. You can begin at Lua.org, and find video tutorials on Youtube.
Spend a week following some Lua tutorials, and reading the asset pack, the forum scripts, and asking more questions. By the end, you will likely have written your own scripts in the editor.
Right-click on your level, in the editor, and choose Properties, and set the module height to 4.
___
Scripting is the way to go with all but the simplest puzzles, and placements.
There is a wealth of scripted resources in the asset packs, and the user forum. It's well worth spending the time to learn to read scripts, to understand how to structurally alter them; and to later devise them. Grimrock uses the Lua scripting language, and there are many tutorials to start learning it. You can begin at Lua.org, and find video tutorials on Youtube.
Spend a week following some Lua tutorials, and reading the asset pack, the forum scripts, and asking more questions. By the end, you will likely have written your own scripts in the editor.
Also, how do I go about filling a room with poison (gas)? I did it with 10 spawners that produce poison_cloud_medium triggered by the same floor tile, but it's a pain to set up in the editor and I suspect the code for the same effect would be 5 lines long, plus I can't have the poison stay on longer and can't kill it on opening the door (to simulate airing the room)
Code: Select all
--POISON GAS multi-tile placeable region (place the script_entity at the top-most left corner)
cloud = {} --a table of detail parameters; used for each of the clouds.
cloud.region = {} --tiles; starts from top-left, at script placement
--___________________[user variable EFFECT settings]
cloud.region.x = 7 -- number of tiles West to East
cloud.region.y = 7 -- number of tiles North to South
cloud.type = "poison_cloud_large"
cloud.duration = math.huge --seconds; effectively infinite
cloud.cloudFadeOut = 2.5 --seconds
cloud.attackPower = 5
cloud.damageType = "poison"
cloud.damageInterval = 0.4
--___________________
cloud.members = {} --will hold the id strings of the spawned clouds; used later, to affect their settings
function triggerGasCloud()
for x = self.go.x, self.go.x + cloud.region.x do --sets the range of x to start where you place the script
if x < 32 then --skip loops where x exceed the edge of the map
for y = self.go.y, self.go.y + cloud.region.y do --sets the range of y to start where you place the script
if y < 32 then --skip loops where y exceed the edge of the map
if not self.go.map:isWall(x, y) then --skip tiles that are walls
--assigns the (unknown) generated id string to cloudId, for temporary use
local cloudId = spawn(cloud.type, self.go.level, x, y, math.random(4)%3, self.go.elevation).id
cloud.members[#cloud.members+1] = cloudId --permanently records the id in the cloud.members table
local gas = findEntity(cloudId) --temporarily assigns an entity (via the id) to the variable: gas
--used to set cloudspell parameters
gas.cloudspell:setDuration(cloud.duration)
gas.cloudspell:setAttackPower(cloud.attackPower)
gas.cloudspell:setDamageInterval(cloud.damageInterval)
gas.cloudspell:setDamageType(cloud.damageType)
gas.particle:setDestroyObject(true)
end
end
end
end
end
end
--iterates through a list of recorded object id strings; sets each cloud to fade away using the value in cloud.cloudFadeOut
function disperseCloud()
for _,cloudId in pairs(cloud.members) do
findEntity(cloudId).particle:fadeOut(cloud.cloudFadeOut)
end
cloud.members={}
end
Last edited by Isaac on Wed Apr 25, 2018 8:45 am, edited 2 times in total.
Re: Ask a simple question, get a simple answer
Thanks for the advice, Isaac! This is exactly what I've been doing, but I guess I'm just not built for it.
I'm struggling, even though I have accumulated a massive collection of scripting examples from the forum.
I go through the scripts occasionally, trying to parrot and modify things as needed, but sometimes there just isn't anything I can do.
I will try to think of some clearly formulated questions about specific things that stump me the most when I read script and post those tomorrow.
Thanks for your responsiveness and assistance once again!
I'm struggling, even though I have accumulated a massive collection of scripting examples from the forum.
I go through the scripts occasionally, trying to parrot and modify things as needed, but sometimes there just isn't anything I can do.
I will try to think of some clearly formulated questions about specific things that stump me the most when I read script and post those tomorrow.
Thanks for your responsiveness and assistance once again!
Re: Ask a simple question, get a simple answer
I was familiarizing myself with assets a bit more in-depth and plopped all "beach_" entities on a sandy map today, and saw that (at least?) three of them came up as untextured milky-grey models (beach_rock_overhang_1x1, beach_wall_decoration_grass_02, beach_wall_decoration_grass_01).
Is there a list of all "unused" and unusable editor assets somewhere?
I also saw a mod that had green crystals in place of the blue ones in the "mine_" assets. Does this require changing material definitions or is it simpler?
Finally, is there a way to control / push a pushable block with a pressure plate 'on' signal? I'm trying to recreate some simple EOTB2 puzzles.
[Edit] Woah, woah, my very first script, which actually works and I didn't completely copy-paste it from somewhere else!
I have 3x3 area, 2x3 plates and 1x3 with the movable block behind them. I just hooked all plates to the script and now the block moves together with the party, trying to block their way.
Is there a list of all "unused" and unusable editor assets somewhere?
I also saw a mod that had green crystals in place of the blue ones in the "mine_" assets. Does this require changing material definitions or is it simpler?
Finally, is there a way to control / push a pushable block with a pressure plate 'on' signal? I'm trying to recreate some simple EOTB2 puzzles.
[Edit] Woah, woah, my very first script, which actually works and I didn't completely copy-paste it from somewhere else!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Code: Select all
function mover()
if party.y == 10 then
pushie_1.pushableblock:push(2)
elseif party.y == 8 then
pushie_1.pushableblock:push(0)
elseif party.y == 9 and pushie_1.y == 8 then
pushie_1.pushableblock:push(2)
elseif party.y == 9 and pushie_1.y == 10 then
pushie_1.pushableblock:push(0)
else end
end
Re: Ask a simple question, get a simple answer
Curunir wrote:[Edit] Woah, woah, my very first script,
![Image](https://dl.dropboxusercontent.com/s/dbq93rp8j15aejb/foodndrink-2%20-%20Copy.gif)
The crystals are a bit of a special case.
viewtopic.php?f=22&t=13970&p=105765&hil ... al#p105765
viewtopic.php?f=22&t=12814&p=101988#p101988
Re: Ask a simple question, get a simple answer
I was thinking about the crystals in the walls of the crystal mine tileset, not the healing huge ones. Or is it that they simply share the same material definitions?Isaac wrote: The crystals are a bit of a special case.
viewtopic.php?f=22&t=13970&p=105765&hil ... al#p105765
viewtopic.php?f=22&t=12814&p=101988#p101988
Re: Ask a simple question, get a simple answer
They use the same material.
Re: Ask a simple question, get a simple answer
Is there a way to choose what height to place objects at, the way you can with tiles?
I just did a riverbed decoration with weeds and good god, it was a PAIN to lower each entity below water level.
My hand hurts, 400 objects and it's the map is not even 25% done. Gonna have to scale down on the next maps...![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
I just did a riverbed decoration with weeds and good god, it was a PAIN to lower each entity below water level.
My hand hurts, 400 objects and it's the map is not even 25% done. Gonna have to scale down on the next maps...
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Re: Ask a simple question, get a simple answer
Yes. There are a couple of ways in script. Unfortunately the default elevation in the editor is always zero.
The relevant script functions to move an object allow it to be placed precisely where one wishes it to be.
These functions are:
The relevant script functions to move an object allow it to be placed precisely where one wishes it to be.
These functions are:
Code: Select all
GameObject:setPosition(x, y, facing, elevation, level)
GameObject:setSubtileOffset(x, y)
GameObject:setWorldPosition(vec)
GameObject:setWorldPositionY(y)
GameObject:setWorldRotation(...)
GameObject:setWorldRotationAngles(x, y, z)
GameObject:setWorldRotationAnglesWithOrder(x, y, z, order)