Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
This line:
spawn("forest_ogre", party.map, x, y, 0, e.elevation)
Should be:
spawn("forest_ogre", party.level, x, y, 0, e.elevation)
The same for the tile damager, use party.level and e.elevation instead of e.go.elevation :
damageTile(party.level, x, y, 0, e.elevation, 256, fire, 500)
Although, there are still some bad arguments in the damageTile call you're making. I'd have to explore it more to see what's wrong. At first glance, I think "fire" has to be in quotes. Also, TileDamage will crash if there are different elevations. Make sure the area that can be impacted is flat.
spawn("forest_ogre", party.map, x, y, 0, e.elevation)
Should be:
spawn("forest_ogre", party.level, x, y, 0, e.elevation)
The same for the tile damager, use party.level and e.elevation instead of e.go.elevation :
damageTile(party.level, x, y, 0, e.elevation, 256, fire, 500)
Although, there are still some bad arguments in the damageTile call you're making. I'd have to explore it more to see what's wrong. At first glance, I think "fire" has to be in quotes. Also, TileDamage will crash if there are different elevations. Make sure the area that can be impacted is flat.
Re: Ask a simple question, get a simple answer
Try this:Kuro01 wrote:Here's a simple question I need help with. I'm trying to get hudPrint text to not fade out so soon. Is there a way to have it so the text can be controlled by a timer or something? I read the text but it fades before I can finish reading it.
Code: Select all
function linePrint(text)
-- clear upper lines
hudPrint("") hudPrint("")
hudPrint("") hudPrint("")
-- print single line
hudPrint(tostring(text))
end
function thudPrint(self, text, delay)
if type(text) == "string" then
if delay then
for reprint = 1, delay, 7 do
delayedCall(self.go.id, reprint, "linePrint", text)
end
delayedCall(self.go.id, delay, "linePrint", "")
end
linePrint(text)
end
end
Example usage:
thudPrint("Hello world!")
thudPrint("Hello world!", 4)
thudPrint("Hello world!", 15)
Re: Ask a simple question, get a simple answer
Little confused, Can't figure how to get this to work. I get a text on screen that reads "table: 0x02b84bao
along with what i put in hudPrint("")
I change the delay from 7 to another but it still same.
I must be doing something wrong
Where do I add thudPrint("Hello world!")
along with what i put in hudPrint("")
I change the delay from 7 to another but it still same.
I must be doing something wrong
Code: Select all
function linePrint(text)
-- clear upper lines
hudPrint("") hudPrint("")
hudPrint("") hudPrint("")
-- print single line
hudPrint(tostring(text))
end
function thudPrint(self, text, delay)
if type(text) == "string" then
if delay then
for reprint = 1, delay, 7 do
delayedCall(self.go.id, reprint, "linePrint", text)
end
delayedCall(self.go.id, delay, "linePrint", "")
end
linePrint(text)
end
end
Re: Ask a simple question, get a simple answer
Ideally you place it in a new script_entity, then you call the script and function from any other script.Kuro01 wrote:Little confused, Can't figure how to get this to work.
Example: if the name of the script you put it in is: utl
then you type utl.script:thudPrint("my text message")
This should display the text for about seven seconds.
If you want to change that duration ( plus or minus ), then add the number of seconds desired, as the next/last argument.
Example:
utl.script:thudPrint("my text message", 5)
**I've made an alternate version with a type check for the first argument. This lets thudPrint ~[short for timed hudPrint], be called with or without reference to the caller, from within the same script; so you could place these functions in your existing script and call
thudPrint("my text message", 12) for instance.
SpoilerShow
Code: Select all
function thudPrint(caller, text, delay)
if type(caller) == "string" then
text = caller
caller = self
end
if type(text) == "string" then
if delay then
for reprint = 1, delay, 7 do
delayedCall(caller.go.id, reprint, "linePrint", text)
end
delayedCall(caller.go.id, delay, "linePrint", "")
end
linePrint(text)
end
end
function linePrint(text)
-- clear upper lines
hudPrint("") hudPrint("")
hudPrint("") hudPrint("")
-- print single line
hudPrint(tostring(text))
end
Re: Ask a simple question, get a simple answer
Thanks, it works great now.
Re: Ask a simple question, get a simple answer
Is it possible to correctly spawn a chasm? I face some trouble when trying to spawn it like i normally spawn objects.
This is what it looks like:
It looks horrible and it doesn't even collide correctly (The key should fall into the pit). How do i fix this?
Code: Select all
spawn("forest_chasm", party.level-1, spawnX, spawnY, 0, 0)
SpoilerShow
Re: Ask a simple question, get a simple answer
Here's another simple question messin with my mind. It doesn't specify in the editor whats modified in the stats when monsters go from level 1 > 2 > 3 > 4 > 5
Such as hitPoints, attackPower etc. Is there imfo on this anywhere?
Such as hitPoints, attackPower etc. Is there imfo on this anywhere?
Re: Ask a simple question, get a simple answer
It looks like that because you spawned it after the heightmap mesh for the level was already created. Once the heightmap mesh is made once, it won't be made again (unless maybe the dungeon is reloaded). If you really need to dynamically spawn a replacesFloor object on a tile with a heightmap material, put a "dummy" replacesFloor object there at the start of the dungeon so that the mesh excludes that tile. Or just, you know, don't use a tile with a heightmap material on that square, since you apparently don't want the heightmap material there in the first place!The cube wrote:Is it possible to correctly spawn a chasm? I face some trouble when trying to spawn it like i normally spawn objects.
This is what it looks like:Code: Select all
spawn("forest_chasm", party.level-1, spawnX, spawnY, 0, 0)
It looks horrible and it doesn't even collide correctly (The key should fall into the pit). How do i fix this?SpoilerShow
The key doesn't fall into the pit because you spawned the pit after the key landed on the floor, so it's no longer checking if there's a floor under it (because it already landed). If you really need to dynamically spawn an object with an open PitComponent...change whatever you're trying to do so that you don't need to dynamically spawn a PitComponent, because there is no conceivable circumstance where you would want to do that. It introduces way too many problems. If you absolutely insist on doing something that terrible, call this function immediately after spawning the pit, passing the pit's map, x, y:
Code: Select all
function itemGravityHack(pitMap,pitX,pitY)
for e in pitMap:entitiesAt(pitX,pitY) do
if e.item and not e.projectile then
local rot = e:getWorldRotation()
e.item:throwItem(e.facing,0)
e.projectile:setFallingVelocity(0)
e:setWorldRotation(rot)
end
end
end
But really, what's wrong with just placing a closed pit at dungeon start instead, and opening it when the time comes?
I also think it is a very bad idea to use objects without reading their definitions first. I strongly recommend downloading the asset pack and doing that.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
minmay wrote:I also think it is a very bad idea to use objects without reading their definitions first. I strongly recommend downloading the asset pack and doing that.
The file, log2_asset_defs is approximately 14,850 lines of code. The scripting reference page is over 2,00 lines of information. If it is a bad idea for Modders to use the Grimrock Editor software to build mods before reading over 16,000 lines of information, then the argument isn't that the Modder is doing something bad; that is illogical and irrational. The only real conclusion is that no one should be developing Grimrock 2 Mod's until Almost Human updates the Grimrock Editor to present those 16,000 lines of information in a much more meaningful and user-friendly way.
And I'm pretty sure that reading those 16,000 lines of information would be detrimental to a normal persons social skills. They could end up spending way too much time on this forum telling everyone how terrible their ideas are
But I digress,
From the description you gave, it's hard to tell exactly what should be happening, and when. If you can provide the exact details to how the area looks before, what the player does to trigger an event, and how it looks after, then perhaps we can recreate a much more effective way to achieve the same end result. You can PM me the description, and I can make a 1 room dungeon that (hopefully) achieves the same outcome.the cube wrote:It looks horrible and it doesn't even collide correctly (The key should fall into the pit). How do i fix this?
For example, if you want to spawn a pit and then have a key fall through it, then simply have the key hidden somewhere on the map with an inactive teleporter on it. Then when the trigger event occurs, have the teleporter activate, which sends the key directly over the newly spawned chasm. That will fix the key location issue, and if the player is standing in front of the pit at the time, we can even make it so that the player sees the key fall down the pit.
Re: Ask a simple question, get a simple answer
most of those lines are whitespace, brackets, etc. which don't exactly take a lot of time to readAzel wrote:minmay wrote:I also think it is a very bad idea to use objects without reading their definitions first. I strongly recommend downloading the asset pack and doing that.
The file, log2_asset_defs is approximately 14,850 lines of code. The scripting reference page is over 2,00 lines of information. If it is a bad idea for Modders to use the Grimrock Editor software to build mods before reading over 16,000 lines of information, then the argument isn't that the Modder is doing something bad; that is illogical and irrational. The only real conclusion is that no one should be developing Grimrock 2 Mod's until Almost Human updates the Grimrock Editor to present those 16,000 lines of information in a much more meaningful and user-friendly way.
this won't work; it doesn't account for items that the player may have placed on that square prior to the pit being spawned. If you were to try to fix that by adding a teleporter on the pit's square as well, the items would still lose their subtile position/rotation information, so it still wouldn't be a good solution.Azel wrote:For example, if you want to spawn a pit and then have a key fall through it, then simply have the key hidden somewhere on the map with an inactive teleporter on it. Then when the trigger event occurs, have the teleporter activate, which sends the key directly over the newly spawned chasm. That will fix the key location issue, and if the player is standing in front of the pit at the time, we can even make it so that the player sees the key fall down the pit.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.