LoG Framework (dynamic hooks etc.)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Wow, great way of implementing this JKos. Thanks so much. So grimq is always on by default now as well?

I'll update the setup instructions in exsp and post another update (1.3.2) tonight with updates to the code with the new functions from the editor update.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

@Stephen

Thanks, I hope it makes the modding a bit easier to you. Personally I could't even think about modding LoG without dynamic hooks or Xanathars GrimQ anymore, it's just so much easier and versatile.

@Diarmuid

Yes, GrimQ is loaded automatically and no additional setup is required. I'm going to try your exsp soon, I just wish I would have more time to test every awesome thing published on these forums.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Great, thanks for the info! Wait until I publish 1.3.2 tonight/tomorrow morning before downloading it, I'll update it with the new functions from the grimrock patch. I have some more funky spell ideas to show off too, just need some time to code them.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Hi,

I get the following error:

mod_assets/framework/modules/fw.lua:489: bad argument 'gfxAtlas' to 'cloneObject' (string expected, got userdata)

on loading dungeon. Bugging code:

Code: Select all

defineObject {
	name = "iron_bracelet",
	uiName = "Iron Bracelet",
	class = "Item",
	model = "assets/models/items/brace_fortitude.fbx",
	gfxAtlas = "mod_assets/textures/gui/items.tga",
	gfxIndex = 1,
	slot = "Bracers",
	description = "The material remains cold to the touch, and heavier than it appears. You feel you should hold on to it.",
	protection = 2,
	resistCold = 10,
	weight = 0.6,
}
fw_addHooks("iron_bracelet","item","accessory")
All my other items defined with gfxAtlas do the same.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

That seems to be a bug in Grimrock, because the fw_addHooks doesn't do anything else but adds the hook functions to the object by cloning it.
So this should produce the same error:

Code: Select all

defineObject {
   name = "iron_bracelet",
   uiName = "Iron Bracelet",
   class = "Item",
   model = "assets/models/items/brace_fortitude.fbx",
   gfxAtlas = "mod_assets/textures/gui/items.tga",
   gfxIndex = 1,
   slot = "Bracers",
   description = "The material remains cold to the touch, and heavier than it appears. You feel you should hold on to it.",
   protection = 2,
   resistCold = 10,
   weight = 0.6,
}

cloneObject{
   name = "iron_bracelet",
   baseObject = "iron_bracelet",
}
You could try to use cloneObject instead of defineObject.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

I'm gonna do fw_defineObject function which fixes this and all possible other problems, because it just wraps the defineObject function, so it works exactly like defineObject but adds hooks automatically.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

Fixed and new version uploaded.
I hope it works now.

Dynamic hooks with custom assets

All custom assets should be included after the framework.lua or otherwise the dynamic hooks won't work with them. All cloned objects should work out of the box, but if you have created totally new assets with defineObject, you have use fw_defineObject-function instead, IF you want to use dynamic hooks with your custom assets.
fw_defineObject(objDef)

Is used exactly like the original defineObject, but it has an additional optional argument itemCategory, which defines the hook-namespace for the item and is used on various help-module functions (eg.isEntityType). Default value is 'custom'.
Possible ItemCategory values: weapon, shield,accessory,bomb,food, missileweapon, tome,armor,cloth,herb,machinepart,potion,staff,treasure,container,key,miscitem,scroll, custom


Examples

Code: Select all

fw_defineObject{
    name='snail_king',
    class = 'Monster',
  ...
}

fw_defineObject{
    name='my_super_weapon',
    class = 'Item',
  ...
  itemCategory='weapon'
}
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Hi, I can confirm it works fine now, thanks!
User avatar
slackmg
Posts: 20
Joined: Fri Nov 09, 2012 12:21 am
Location: Here I am.

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by slackmg »

For some reason with the latest framework, I get this when using stock items:

Code: Select all

mod_assets/framework/modules/fw.lua:498: attempt to concatenate global 'category' (a nil value)
stack traceback:
	mod_assets/framework/modules/fw.lua:498: in function 'onUseItem'
	[string "Item.lua"]: in function 'useItem'
	[string "CharSheet.lua"]: in function 'slotClicked'
	[string "CharSheet.lua"]: in function 'draw'
	[string "Gui.lua"]: in function 'draw'
	[string "GameMode.lua"]: in function 'update'
	[string "Grimrock.lua"]: in function 'display'
	[string "Grimrock.lua"]: in main chunk
The error gets thrown using potions (potion_healing), compass and tomes (tome_health). Just starting running into this with the last update to include the fw_defineobject. Is there something special we need to do to get the stock items working with the last framework version?
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

Hi, i think you have downloaded a non working version which I uploaded by accident and just hoped that no one wasn't quick enough to download it.
So if you update the fw.lua (or the whole framework) it should work now.
https://docs.google.com/file/d/0B7cR7sc ... JRWFU/edit

Let me know if the problem still occurs and I will fix it.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
Post Reply