Wagtunes' Modding Questions
Re: Useful scripts repository
The baseObject field is for referring to an object that you've previously defined with defineObject or cloneObject. There aren't hardcoded base objects except for starting_location (and you probably don't want to clone that one).
Of course if you imported assets/scripts/standard_assets.lua, (or assets/scripts/objects.lua, etc.), those are "just" a bunch of defineObject, cloneObject, defineMaterial, etc. calls, so you can use any of those as baseObjects. The Creating Custom Assets page has an example of this.
Of course if you imported assets/scripts/standard_assets.lua, (or assets/scripts/objects.lua, etc.), those are "just" a bunch of defineObject, cloneObject, defineMaterial, etc. calls, so you can use any of those as baseObjects. The Creating Custom Assets page has an example of this.
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: Useful scripts repository
Okay, I'm probably not making myself clear. That's on me.minmay wrote: ↑Tue May 04, 2021 2:03 pm The baseObject field is for referring to an object that you've previously defined with defineObject or cloneObject. There aren't hardcoded base objects except for starting_location (and you probably don't want to clone that one).
Of course if you imported assets/scripts/standard_assets.lua, (or assets/scripts/objects.lua, etc.), those are "just" a bunch of defineObject, cloneObject, defineMaterial, etc. calls, so you can use any of those as baseObjects. The Creating Custom Assets page has an example of this.
Take this code that I posted above
Code: Select all
cloneObject{
name = "exploding_barrel_block",
baseObject = "barrel_crate_block",
onDie = function(self)
for i = -1, 1 do
for j = -1, 1 do
spawn("fireburst", self.level, self.x + i, self.y + j, 0)
end
end
end
}
Say I wanted to clone an object in the game that looks like a shovel. Wouldn't I have to know what that object was called in the game in order to do that?
Re: Useful scripts repository
That's what minmay meant—as I read it.
Defined objects appear in the editor; any of those will work as a baseObject. What this does is tell the engine to start with the defined [base] object, and add the changes defined in the new [cloned] definition.I am assuming that this is an object already defined in the base game, like altar or alcove or snail and the script is cloning this object to create a variation of it so that it can explode. Without knowing what the base objects are, how would I know what to clone?
Re: Useful scripts repository
Ah, so if I see something in the editor (assuming I haven't imported any custom items from other dungeons) that's a base object. I can then use its name to make my own object from. So then if I don't see a shovel listed anywhere in the editor, that means I have to create my own model? I'll assume yes. And then I need to make my own texture for it from scratch. I guess that's most of the work, creating objects that don't exist and don't have anything close to them in the game.Isaac wrote: ↑Tue May 04, 2021 3:01 pmThat's what minmay meant—as I read it.
Defined objects appear in the editor; any of those will work as a baseObject. What this does is tell the engine to start with the defined [base] object, and add the changes defined in the new [cloned] definition.I am assuming that this is an object already defined in the base game, like altar or alcove or snail and the script is cloning this object to create a variation of it so that it can explode. Without knowing what the base objects are, how would I know what to clone?
Re: Useful scripts repository
The distinction here is that base objects are the named templates that the map objects are —based upon.wagtunes wrote: ↑Tue May 04, 2021 3:16 pm
Ah, so if I see something in the editor (assuming I haven't imported any custom items from other dungeons) that's a base object. I can then use its name to make my own object from. So then if I don't see a shovel listed anywhere in the editor, that means I have to create my own model? I'll assume yes. And then I need to make my own texture for it from scratch. I guess that's most of the work, creating objects that don't exist and don't have anything close to them in the game.
So, 'rock' is a base object, and the 'rock_1' in the dungeon is based upon the original 'rock' definition. So a cloned rock would use 'rock' as its base object, and create a new base object of a different name—or would overwrite the original if it were given the exact same name.
You can use your imported objects as baseObjects too; a cloned custom_rune_sword could use a regular sword as a baseObject, and a variant of the custom_rune_sword could itself use the cloned_rune_sword as its baseObject.
* BaseObjects are the definitions; the object.name, rather than ID. You cannot use the 'rock_1' dungeon item (for instance) as a baseObject.
Re: Useful scripts repository
Okay, got it. I think I'm going to study ORR 2 in detail. There is a lot of custom stuff in it and I think I can learn a ton just from pulling that dungeon apart.Isaac wrote: ↑Tue May 04, 2021 3:29 pmThe distinction here is that base objects are the named templates that the map objects are —based upon.wagtunes wrote: ↑Tue May 04, 2021 3:16 pm
Ah, so if I see something in the editor (assuming I haven't imported any custom items from other dungeons) that's a base object. I can then use its name to make my own object from. So then if I don't see a shovel listed anywhere in the editor, that means I have to create my own model? I'll assume yes. And then I need to make my own texture for it from scratch. I guess that's most of the work, creating objects that don't exist and don't have anything close to them in the game.
So, 'rock' is a base object, and the 'rock_1' in the dungeon is based upon the original 'rock' definition. So a cloned rock would use 'rock' as its base object, and create a new base object of a different name—or would overwrite the original if it were given the exact same name.
You can use your imported objects as baseObjects too; a cloned custom_rune_sword could use a regular sword as a baseObject, and a variant of the custom_rune_sword could itself use the cloned_rune_sword as its baseObject.
* BaseObjects are the definitions; the object.name, rather than ID. You cannot use the 'rock_1' dungeon item (for instance) as a baseObject.
Re: Useful scripts repository
Okay, I have just run into the strangest bug. I have no idea what could be causing this.
I created 3 temple_catacomb_alcove locations in this one room. Each alcove has an item in it. For alcoves 1 and 2 I can take the item out and put it back in. For the 3rd alcove, I can take the item out but once I do, I can't put it back in. I can put any of the 3 items in alcoves 1 and 2. But I can put none of the items into alcove 3.
There is no fancy coding involved. In fact, here is the code that I copied from a script in ORR 2, word for word.
The alcoves themselves, I simply clicked on Add New Item and chose the item I wanted for that alcove.
Why would 2 of the alcoves allow item replacement but the 3rd one won't.
I created 3 temple_catacomb_alcove locations in this one room. Each alcove has an item in it. For alcoves 1 and 2 I can take the item out and put it back in. For the 3rd alcove, I can take the item out but once I do, I can't put it back in. I can put any of the 3 items in alcoves 1 and 2. But I can put none of the items into alcove 3.
There is no fancy coding involved. In fact, here is the code that I copied from a script in ORR 2, word for word.
Code: Select all
defineObject{
name = "temple_catacomb_alcove",
class = "Alcove",
anchorPos = vec(0, 0.75, 0.3),
targetPos = vec(0, 1.3, 0),
targetSize = vec(0, 0.5, 0.6),
model = "assets/models/env/temple_catacomb_empty.fbx",
placement = "wall",
replacesWall = true,
editorIcon = 92,
}
Why would 2 of the alcoves allow item replacement but the 3rd one won't.
Re: Useful scripts repository
You need to download the asset pack and look at the files in the assets/scripts/ directory. That is where barrel_crate_block, and every other standard asset, is defined.wagtunes wrote: ↑Tue May 04, 2021 2:44 pmSee where it says baseObject = "barrel_crate_block". I am assuming that this is an object already defined in the base game, like altar or alcove or snail and the script is cloning this object to create a variation of it so that it can explode. Without knowing what the base objects are, how would I know what to clone?
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: Useful scripts repository
Ah, okay. Actually, I did download that pack. Maybe it's time I started going through it in detail.minmay wrote: ↑Tue May 04, 2021 7:55 pmYou need to download the asset pack and look at the files in the assets/scripts/ directory. That is where barrel_crate_block, and every other standard asset, is defined.wagtunes wrote: ↑Tue May 04, 2021 2:44 pmSee where it says baseObject = "barrel_crate_block". I am assuming that this is an object already defined in the base game, like altar or alcove or snail and the script is cloning this object to create a variation of it so that it can explode. Without knowing what the base objects are, how would I know what to clone?
Thanks.
Re: Useful scripts repository
I can't replicate the problem; I used the definition you posted; it worked as expected.
Have you checked that there are not two alcoves on the same tile?
(Alcove 3 and a 4th).