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).