LoG Framework (dynamic hooks etc.)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: LoG Framework (new: D&D style spell book and 8 EoB spell

Post by Neikun »

When we develop a book that can be loaded with scroll images with multiple pages, I'll be so excited.

-Not even just for carrying multiple spells in a single inv. slot, but for like diaries and things. Books full of descriptive images -for artists in the modding community-
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: D&D style spell book and 8 EoB spell

Post by JKos »

@Neikun: Spell book could easily be converted to that.
I may write a short tutorial how to do this kind of book(without the framework).
- 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
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: LoG Framework (new: D&D style spell book and 8 EoB spell

Post by Neikun »

That'd be really cool, man.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: D&D style spell book and 8 EoB spell

Post by JKos »

Update:
- createSpell now automatically creates corresponding scroll for the spell, scroll casts the spell once and is consumed.
- added eob_spells.testMode. if set to true Mages can cast any spells even if they are not learned.
- added flame arrow spell
- minor bugfixes
- 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 9 EoB spel

Post by JKos »

New update:
- Magic missile projectile replaced.
- Added hook namespace projectiles.onHit, which is called when a projectile hits monster, blockage or champion.
Usage example:

Code: Select all

fw.addHooks('arrow','test',{
  onHit = function(projectile,target,damage,damageType)
      print('Arrow hits '..target.name)
  end
})
Also global hook namespace 'projectiles' ( which catches all projectiles) and id-specific (eg. arrow_1) hooks are supported.

- Added a new monster for demonstration purposes: crowern_from_hell, which can cast 2 magic missiles.
Basically it's possible to give ability to cast magic missiles to any monster without even touching the .lua files.

Example:

Code: Select all

	fw.addHooks('crowern_from_hell','eob_spells_test',{
		onMove = function(monster,dir)
		-- cast a magic missile spell if party is 3 tiles ahead (at most)
			if (help.nextEntityAheadOf(monster, 3,'party',true)) then
				eob_spells.magicMissile(monster)
				local count = data.get(monster,'magic_missile_count')
				if count == nil then count = 1 end
				if (count == 2) then
				-- remove this hooks when 2 magic missiles are cast
					fw.removeHooks('crowern_from_hell','eob_spells_test')
				end
				data.set(monster,'magic_missile_count',count + 1)
			end
		end
	})
But if you change the hook namespace to snail, then all snails will cast 2 magic missiles:
fw.addHooks('snail','eob_spells_test',{...

or you can add magic missiles to individual monsters if you want:
fw.addHooks('snail_1','eob_spells_test',{...

@djodgames This is WIP, so I don't recommend to use this feature in your mod yet because I'm going to make it easier to use and more reusable, something like:
eob_spells.addSpellsToMonster(spellName,amount,monsterHookNamespace,distance)
So you could use it like this:
eob_spells.addSpellsToMonster('magic_missile',2,'snail',3)

- Updated to google drive and steam

Edit: Also documentation of the framework updated (see first post of this thread).
- 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
hannamarin
Posts: 41
Joined: Sat Mar 31, 2012 11:48 am
Location: Yeovil, England, UK

Re: LoG Framework (new: AD&D style spell book and 9 EoB spel

Post by hannamarin »

Tried to add this as per instructions - but it then crashes the Grimrock program to desktop.

Can you make a proper instruction manual for adding this and it sounds pretty good.
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 9 EoB spel

Post by JKos »

What did you actually tried to do? To add the framework to your existing dungeon?

I just tested it and for me it worked. Created an empty dungeon and copied the framework.lua to mod_assets/scripts
and then modified the init.lua so it looked like this:

Code: Select all

-- This file has been generated by Dungeon Editor 1.3.1

-- import standard assets
import "assets/scripts/standard_assets.lua"

-- import framework
import "mod_assets/scripts/framework.lua"

-- import custom assets
import "mod_assets/scripts/items.lua"
import "mod_assets/scripts/monsters.lua"
import "mod_assets/scripts/objects.lua"
import "mod_assets/scripts/wall_sets.lua"
import "mod_assets/scripts/recipes.lua"
import "mod_assets/scripts/spells.lua"
import "mod_assets/scripts/materials.lua"
import "mod_assets/scripts/sounds.lua"
then I added script entity named logfw_init

Code: Select all

options = {}
-- load modules
options.modules = {
   monsters_can_open_doors = false,
   damage_dealing_doors = true,
   illusion_walls = true,
   talk = true,
}

spawn("LoGFramework", 1,1,1,0,'fwInit')
fwInit:open() -- this loads all script entites defined in framework.lua

-- timer will call this method automatically 
-- 0.5 second after the game is started
-- activate loaded modules here
-- you can also set debug-flag on here
function main()
   fw.debug.enabled = true
   talk.activate()
   illusion_walls.activate()
   damage_dealing_doors.activate()
   fwInit:close() --must be called
end
Reloaded the dungeon and it worked fine.

For validation I added this to logfw_init main function after fwInit:close() --must be called

Code: Select all

fw.addHooks('party','test',{
	onMove = function()
		print('test')
	end
})	
And it printed test to console when I moved the party.

Maybe your dungeon has some conflict with the framework, do you have a script entities named help, data or illusion_walls for example?

Btw. I uploaded a new version of framework.lua here: https://docs.google.com/file/d/0B7cR7sc ... tDbm8/edit
And FYI, turn based combat and AD&D magic system are not in framework yet because they are still under development. They are in demo dungeon only.
- 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
hannamarin
Posts: 41
Joined: Sat Mar 31, 2012 11:48 am
Location: Yeovil, England, UK

Re: LoG Framework (new: AD&D style spell book and 9 EoB spel

Post by hannamarin »

Hi, I am just trying to use your test dungeon to see what you are doing.
Whatever you changed in framework.lua has allowed my first problem to pass "spell_projectile.model" this first gave the error " cannot find" and when I added to the 'model folder' it crashed the program.
Now it cannot find "crowern_from_hell"
should there be a special monsters.lua file ? to go with the dungeon/framework ?
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 9 EoB spel

Post by JKos »

Hi,

Demo dungeon should work fine (I tested it) if you just download the demo dungeon from here
https://docs.google.com/open?id=0B7cR7s ... UN4SGZGNEk

Choose File -> Download from upper left corner. And unzip it to your Dungeons folder.
It contains all required files. Delete the previous LoGFramework directory just in case.
- 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
hannamarin
Posts: 41
Joined: Sat Mar 31, 2012 11:48 am
Location: Yeovil, England, UK

Re: LoG Framework (new: AD&D style spell book and 9 EoB spel

Post by hannamarin »

Yep that works - Thank You.

Now i can see what it actually does.
Post Reply