Defining Object with PressurePlate base class

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
chaoscommencer
Posts: 119
Joined: Sun Jan 05, 2014 7:48 pm

Defining Object with PressurePlate base class

Post by chaoscommencer »

Hello, I'm not sure if I was supposed to post this to an existing thread or not, so I put it here... I was just trying to define a new type with PressurePlate as a base, using the dungeon_stairs_down model. I guess this is sort of a two-parter.

One, I noticed that the model is offset by half a tile or so (and it also doesn't rotate with the facing direction...), and I'm wondering if there's a way to change the model coordinates for this new class.

Two, inheriting PressurePlate requires defining both an activateAnim and a deactivateAnim. And when I've tried to set the dungeon_pressure_plate_down/up animations to these values, the editor will (on first trying to open the dungeon) give me the error:
[string "PressurePlate.lua"]:0: Could not find asset processor for file: ...dungeon_pressure_plate_down...
and on the second try crash.

I have tried setting the animations to each of the following variations with the same results:
dungeon_pressure_plate_down
dungeon_pressure_plate_down.animation
assets/animations/env/dungeon_pressure_plate_down
assets/animations/env/dungeon_pressure_plate_down.animation

Does anyone possibly have any idea what I might be doing incorrectly? Please find some sample code below (the project loads and works fine without the following definition):

Code: Select all

defineObject {
    name = "dungeon_fake_stairs_down",
    class = "PressurePlate",
    model = "assets/models/env/dungeon_stairs_down.fbx",
    placement = "floor",
    replacesFloor = true,
    silent = true,
    activateAnim = "dungeon_pressure_plate_down", --assets/animations/env/
    deactivateAnim = "dungeon_pressure_plate_up", --assets/animations/env/
}
Thanks for any suggestions!

Edit: I was able to fix the second part with the following format for the animations (with the .fbx suffix) and by defining editorIcon: "assets/animations/env/dungeon_pressure_plate_down.fbx". Still need help on offsetting the model though, if anyone has any ideas?

Also, is there any way inside this definition to initialize triggeredByMonster and triggeredByItem to false? I added the following lines, but they did not have any effect:

Code: Select all

triggeredByMonster = false,
triggeredByItem = false,
Working on a dungeon that displays a massive collection of assets while sorting them into convenient reusable plugin format (concept from some of leki's mods). Will contribute some of my own models as well eventually and follow that with custom dungeon.
User avatar
Leki
Posts: 550
Joined: Wed Sep 12, 2012 3:49 pm

Re: Defining Object with PressurePlate base class

Post by Leki »

Well... I have no idea what are you triing do achieve with this :-)

Your problem is that anmation defined in

Code: Select all

activateAnim = "dungeon_pressure_plate_down", --assets/animations/env/
deactivateAnim = "dungeon_pressure_plate_up", --assets/animations/env/
is probably looking for a "pressure_plate" node to animate it. So if you use model without that node, crash happens. You can try to renamne "Mesh" to "pressure_plate" in GMT in stairs model or make the new one by simple adding the node to the stairs down model.
If you need to change position of the model of stairs, in GMT, Nodes, select Node 1: Mesh (on the right side), then fing Translate button onthe right, bottom and change 0 to -1,5 in thirt position, then click Traslate button and save as new model. Don't forget to update script definition to new model path.

Activators can be set up by following instructions - see Scripting references in Moding. You cannot set activators in object definition. Normal way is to add plate in scene and set up it in the editor.

Code: Select all

PressurePlate:setTriggeredByMonster(enable)
Sets whether the pressure plate is activated when a monster steps on the plate.

PressurePlate:setTriggeredByItem(enable)
Sets whether the pressure plate is activated when an item is placed on the plate.
[/color]
I'm the Gate I'm the Key.
Dawn of Lore
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Defining Object with PressurePlate base class

Post by msyblade »

It may also be a nice workaround to use the "hidden_pressure_plate" as the base. It may not have an animation at all (since it is invisible). I think you should also be able to import the stairs model into GMT and offset it however you like, then name it a new model (ie: cc_stairs_down_offset). Clone the stairs in your objects.lua, and use the new model with it. Haven't tried either of these, but they are the first workarounds I would investigate.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
chaoscommencer
Posts: 119
Joined: Sun Jan 05, 2014 7:48 pm

Re: Defining Object with PressurePlate base class

Post by chaoscommencer »

Thanks for the quick responses guys; I really appreciate it. I had a feeling it might have to do with the model not having the same control points/vertices or something, but I have not done any modeling yet :/. So thanks for the idea, I'll dl the GMT and try that tonight. As per the pressure_plate_hidden, I had considered that, but I thought that since it's hidden it won't display whatever model I set for it at all... I might try that later too. Again, thanks for the suggestions!

Edit:
So when I tried to make the custom model (translated and recalculated normals and tangents), I found that the GMT also allows making custom animations. I made an identity animation and applied it as both the up and down animations figuring it shouldn't matter, because it shouldn't do anything. I was able to get the stairs to align properly with the edge of the tile, but while walking onto it, the stairs model simply vanishes. Any ideas?

Also, using the cloneObject method with pressure_plate_hidden, applying a model did make it visible. This version does not suffer from the vanishing act.

Both versions suffered from seeing the floor of the next tile though; is there a way to hide a tile your object isn't on (without having to make another invisible object that replaces the floor of that tile)?

Thanks for the advice!
Working on a dungeon that displays a massive collection of assets while sorting them into convenient reusable plugin format (concept from some of leki's mods). Will contribute some of my own models as well eventually and follow that with custom dungeon.
Post Reply