Party scripting hooks
Party scripting hooks
I never messed with the scripting hooks for the party in LoG 1; can someone explain to me in which lua file you defined the callbacks for party hooks in LoG 1, and an example?
- SnowyOwl47
- Posts: 148
- Joined: Fri Sep 12, 2014 10:41 pm
Re: Party scripting hooks
party_hooks.lua we created our own file then imported it in the init.luaJgwman wrote:I never messed with the scripting hooks for the party in LoG 1; can someone explain to me in which lua file you defined the callbacks for party hooks in LoG 1, and an example?
But in the party_hooks.lua we had to define the party and add somethings:
viewtopic.php?f=14&t=5803&hilit=+hook
But that is just for LOG1 we'd have to port it over to LOG2
Re: Party scripting hooks
Cool. I'll look into it tonight. Thanks.
Re: Party scripting hooks
I made some quick testing with old party hook-names and here are the results (and an example of defining party-hooks):
Main difference to LoG1 is that all hooks receive party-object as a first argument.
(And you can define objects in any .lua file which is imported to init.lua)
Main difference to LoG1 is that all hooks receive party-object as a first argument.
(And you can define objects in any .lua file which is imported to init.lua)
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Party",
-- WORKS
onMove = function(party,dir,arg1)
print(party.go.id,"moving to",dir)
end,
-- WORKS
onTurn = function(party,dir,arg1)
print(party.go.id,"turning to",dir)
end,
-- WORKS (NOT with bare hands)
onAttack = function(party,champion,weapon)
print(champion:getName(),'is attacking with',weapon.go.id)
end,
-- WORKS
onDamage = function(party, champion,damage,damageType)
print(party.go.id, champion:getName(), 'received damage', damage,damageType)
end,
-- WORKS
onProjectileHit = function(party,champion,projectile,damage,damageType)
print(party.go.id,champion:getName(),'is hit by a',projectile.go.name,damage,damageType)
end,
-- WORKS
onDie = function(party,champion)
print(party.go.id,champion:getName(),'died')
end,
-- WORKS
onRest = function(party)
print(party.go.id,'is resting')
end,
-- WORKS
onWakeUp = function(party)
print(party.go.id,'woke up')
end,
-- NOT WORKING (Also tested onDrawUI,onDrawGUI,onDraw,onDrawAll but no luck)
onDrawGui = function(g) print('gui') end,
-- WORKS
onDrawInventory = function(g,champion)
--print('inventory')
end,
-- WORKS
onDrawStats = function(g,champion) print('stats') end,
-- NOT WORKING
onDrawSkills = function(g,champion) print('skills') end,
-- NOT WORKING
onDrawTraits = function(g,champion) print('traits') end,
-- UNTESTED
onUseItem = function(party,champion,item,slot)
print(party.go.id,champion:getName(),'is using',item,slot)
end,
onReceiveCondition = function(party,champ,condition,condNumber) end,
onCastSpell = function(party,champion,spellName) end,
onLevelUp = function(party,champion) end,
onPickUpItem = function(party,item) end
}
},
}
- 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
- cloneObject viewtopic.php?f=22&t=8450
Re: Party scripting hooks
Thanks JKos! That's great!JKos wrote:I made some quick testing with old party hook-names and here are the results (and an example of defining party-hooks):
Main difference to LoG1 is that all hooks receive party-object as a first argument.
(And you can define objects in any .lua file which is imported to init.lua)
Code: Select all
defineObject{ name = "party", baseObject = "party", components = { { class = "Party", -- WORKS onMove = function(party,dir,arg1) print(party.go.id,"moving to",dir) end, -- WORKS onTurn = function(party,dir,arg1) print(party.go.id,"turning to",dir) end, -- WORKS (NOT with bare hands) onAttack = function(party,champion,weapon) print(champion:getName(),'is attacking with',weapon.go.id) end, -- WORKS onDamage = function(party, champion,damage,damageType) print(party.go.id, champion:getName(), 'received damage', damage,damageType) end, -- WORKS onProjectileHit = function(party,champion,projectile,damage,damageType) print(party.go.id,champion:getName(),'is hit by a',projectile.go.name,damage,damageType) end, -- WORKS onDie = function(party,champion) print(party.go.id,champion:getName(),'died') end, -- WORKS onRest = function(party) print(party.go.id,'is resting') end, -- WORKS onWakeUp = function(party) print(party.go.id,'woke up') end, -- NOT WORKING (Also tested onDrawUI,onDrawGUI,onDraw,onDrawAll but no luck) onDrawGui = function(g) print('gui') end, -- WORKS onDrawInventory = function(g,champion) --print('inventory') end, -- WORKS onDrawStats = function(g,champion) print('stats') end, -- NOT WORKING onDrawSkills = function(g,champion) print('skills') end, -- NOT WORKING onDrawTraits = function(g,champion) print('traits') end, -- UNTESTED onUseItem = function(party,champion,item,slot) print(party.go.id,champion:getName(),'is using',item,slot) end, onReceiveCondition = function(party,champ,condition,condNumber) end, onCastSpell = function(party,champion,spellName) end, onLevelUp = function(party,champion) end, onPickUpItem = function(party,item) end } }, }
Re: Party scripting hooks
Fantastic! Appreciation Station!
Is anyone aware of an event that's triggered by putting an item into inventory? event(p,champ,item)
I've tried quite a few now: onDropItem, onDropItemInventory, onSetDownItem, onAquireItem plus a few more embarrassing ones. =)
Is anyone aware of an event that's triggered by putting an item into inventory? event(p,champ,item)
I've tried quite a few now: onDropItem, onDropItemInventory, onSetDownItem, onAquireItem plus a few more embarrassing ones. =)